Question

Parameter "attachments" is invalid

  • 22 February 2019
  • 5 replies
  • 501 views

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:

https://devcommunity.ringcentral.com/ringcentraldev/topics/new-glip-features-post-attachments-and-th...

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 replies

Hi Neil, could you please share the full body of your API request?
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:{ "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 } ] }
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.
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.
Yes, we accidentally changed the text attribute to be a mandatory one. We'll update the API Reference and the changelog. Thanks for your feedback!

Reply