How to send attachment using the [Public Client API -> Create a message] endpoint? #12139
|
We are building a testing app with live chat support features integrates with Chatwoot APIs. All going well except for making the live chat attaching images or files and send to the conversation. Does the Public Client API support sending attachments? From what we see in the (Public Client API) documentation, there is no mentions for this use case. If supported, would you please tell what should be the post messages header and body for attaching file? An example would be appreciated. If not supported by Public Client API, would you guide us with the right method to implement this feature? Thanks |
Replies: 1 comment
|
Found the solution after some trials I used the Public Client API and have to send a post request with the following in the body
*{filename}, self explanatory Here is a simple python code that worked for me: |
Found the solution after some trials
I used the Public Client API and have to send a post request with the following in the body
"attachments[]": {filename}, {encodedfile}, {mimetype}
*{filename}, self explanatory
*{encodedfile}, you need to read the raw data of the image file and include it
*{mimetype}, for example if the file is png you make it image/png, if the file is jpg, you make it image/jpg
Here is a simple python code that worked for me: