Parameter "attachments" is invalid
Tags: error
Feb 21, 2019 at 5:15pm • 5 replies • 0 likes
neil-joyer
We've been using the RC api to post conversations to glip. Some of the posts included images. To implement images, we used the "Attachments" feature outlined here:
It worked great and showed the images inline in chat.
However, a few weeks ago (not exactly sure when), all posts that contain attachments quit working.
I finally got around to debugging and can see that it is because RC/Glip is returning a 400 Bad Request error with the message: "Parameter "attachments" is invalid".
I tried getting a post to go through using the api explorer using attachments and I can't get that to work either.
Did something break with attachments? I'm pretty sure the format of our payloads to the api didn't change.
5 Answers
A couple of comments.
I should have included my exact payload rather than the one I generated using the api explorer. This is my actual payload that was getting denied:
{
"groupId": "191750150",
"attachments": [
{
"type": "Card",
"title": "[https://i.imgur.com/gQ3EeN3.gif](https://i.imgur.com/gQ3EeN3.gif)";,
"imageUri": "https://i.imgur.com/gQ3EeN3.gif";
}
]
}
This is what I found ended up working:
{
"groupId": "191750150",
"attachments": [
{
"type": "Card",
"text": "[https://i.imgur.com/gQ3EeN3.gif](https://i.imgur.com/gQ3EeN3.gif)";,
"imageUri": "https://i.imgur.com/gQ3EeN3.gif";
}
]
}
Basically, the title was causing it to fail. Switching that to "text" made it work. However, that used to work. Also, having both "title" and "text" works fine too.
I'll also add that the api reference generates the value "black" for color... which is why it was included in my sample. It would be good if that was updated to be hex because right now you can't get posts to generate since that is a drop down with only invalid values.
I'm unblocked. Thank you.
I should have included my exact payload rather than the one I generated using the api explorer. This is my actual payload that was getting denied:
{
"groupId": "191750150",
"attachments": [
{
"type": "Card",
"title": "[https://i.imgur.com/gQ3EeN3.gif](https://i.imgur.com/gQ3EeN3.gif)";,
"imageUri": "https://i.imgur.com/gQ3EeN3.gif";
}
]
}
This is what I found ended up working:
{
"groupId": "191750150",
"attachments": [
{
"type": "Card",
"text": "[https://i.imgur.com/gQ3EeN3.gif](https://i.imgur.com/gQ3EeN3.gif)";,
"imageUri": "https://i.imgur.com/gQ3EeN3.gif";
}
]
}
Basically, the title was causing it to fail. Switching that to "text" made it work. However, that used to work. Also, having both "title" and "text" works fine too.
I'll also add that the api reference generates the value "black" for color... which is why it was included in my sample. It would be good if that was updated to be hex because right now you can't get posts to generate since that is a drop down with only invalid values.
I'm unblocked. Thank you.
0
Hi Neil, the problem is with the color attribute, it should contain Hex color code, like
"color": "#00ff2a"The value "Black" was just ignored and now some validation added on the API level. Since Glip API is in Beta now, we may change its behavior from time to time, but we'll improve the process adding all the potential compatibility breakers to the common changelog and adding more self-descriptive error messages. Sorry for inconveniences.
0
Since I was having trouble with the payload generated by my app (even though it didn't change), I tried reproducing via the api explorer and was able to. Here is a simplified version:
A representation that is closer to what I'm trying to do:
{ "groupId": "191750150", "attachments": [ { "type": "Card", "title": "test", "color": "Black", "allDay": false } ] }
A representation that is closer to what I'm trying to do:
{ "groupId": "191750150", "attachments": [ { "type": "Card", "title": "test", "color": "Black", "text": "[https://i.imgur.com/gQ3EeN3.gif](https://i.imgur.com/gQ3EeN3.gif)", "imageUri": "https://i.imgur.com/gQ3EeN3.gif", "allDay": false } ] }
0
A new Community is coming to RingCentral!
Posts are currently read-only as we transition into our new platform.We thank you for your patience
during this downtime.
Try Workflow Builder
Did you know you can easily automate tasks like responding to SMS, team messages, and more? Plus it's included with RingCentral Video and RingEX plans!Try RingCentral Workflow Builder