Skip to main content

Hello

I am trying to create a conversation with an attachment via API Create conversation (frontapp.com)

Currently, I am receiving new messages but without attachments.

 

My code looks like this:

$headers=@{}

$headers.Add("Accept", "application/json")

$headers.Add("Content-Type", "application/json")

$headers.Add("Authorization", "Bearer rmy code]")

$response = Invoke-WebRequest -Uri 'https://api2.frontapp.com/channels/cha_XXX/messages' -Method POST -Headers $headers -ContentType 'application/json' -Body '{"to":""securitydesk@example.com"],"options":{"archive":false},"attachments":""data:text/plain;name=test.txt;base64,aBcDeF=="],"body":"test"}'

 

Taking a look at the above request, you'll want to make sure you change the HTTP Content-Type header to multipart/form-data. You can take a look at a Front API attachment example with some more information here.

 

Also, the options needs to be sent as optionsiarchive]:

 

 

--Leslie


It works!!!

THANKS!

Sent from Front


Reply