Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in chat.update API call #7459

Closed
gerricom opened this issue Jul 10, 2017 · 5 comments · Fixed by #7624
Closed

Bug in chat.update API call #7459

gerricom opened this issue Jul 10, 2017 · 5 comments · Fixed by #7624
Assignees
Milestone

Comments

@gerricom
Copy link

Rocket.Chat Version: 0.57.1
Running Instances: 1
DB Replicaset OpLog: Disabled
Node Version: 4.7.3


I'm using some of the API calls of Rocket.Chat to send and update status reports from our CRM. For one of this reports, it is necessary to update existing messages in Rocket.Chat and this is currently not working.

I'm trying to send the following request:

POST /api/v1/chat.update HTTP/1.1
X-Auth-Token: fw7KEtEU_XEcn-L1s568Xnqi_XT_bzCmOtWiwKzVwUx
X-User-Id: 5wh5EXP79hDg3L4WP
Content: application/json
Content-Type: application/json; charset=utf-8
Host: chat.local
Connection: close
User-Agent: Paw/3.1.1 (Macintosh; OS X/10.12.5) GCDHTTPRequest
Content-Length: 75

{"roomId":"K2EbA7Kg63CfngGfT","msgId":"GTmmkvqXsweHWXamm","text":"foo bar"}

And I get the following answer:

HTTP/1.1 400 Bad Request
Date: Mon, 10 Jul 2017 07:09:14 GMT
Access-Control-Allow-Origin: *
Cache-Control: no-store
Pragma: no-cache
content-type: application/json
Vary: Accept-Encoding
Connection: close
Transfer-Encoding: chunked

{
  "success": false,
  "error": "Cannot read property 'description' of undefined"
}
@MartinSchoeler
Copy link
Contributor

MartinSchoeler commented Jul 10, 2017

Maybe a message with a attachment is causing this? Since only messages with attachments have the description property

@gerricom
Copy link
Author

gerricom commented Jul 10, 2017

Ok. This is a message without an attachment - so this might be the problem here.

edit:

I guess, I'm producing this trouble by myself. The message, I'm going to update is posted with the chat.postMessage call. I don't want Rocket.Chat to create an attachment to this message by its own (there is a link included) and therefore I'm sending an empty list in the attachmen variable. This causes the error described above.

This results in another question: How can I prevent Rocket.Chat from creating an automated attachment?

@graywolf336
Copy link
Contributor

graywolf336 commented Jul 10, 2017

{ parseUrls: false }

@gerricom add the above code to your message

@gerricom
Copy link
Author

Thanks, @graywolf336!

@graywolf336
Copy link
Contributor

This should still be considered a bug since there is an error occurring.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants