Skip to content

Guest API: Messenger

Conversations with your team, the messenger’s home, pictures and ratings.

What it doesRoute
Upload a picturePOST /guest/v1/attachments
List the user’s conversationsGET /guest/v1/conversations
Start a conversationPOST /guest/v1/conversations
Read a conversationGET /guest/v1/conversations/{conversation_id}
Answer the help botPOST /guest/v1/conversations/{conversation_id}/bot
Write in a conversationPOST /guest/v1/conversations/{conversation_id}/messages
Rate a conversationPOST /guest/v1/conversations/{conversation_id}/rating
Mark a conversation readPOST /guest/v1/conversations/{conversation_id}/read
Wait for a replyGET /guest/v1/conversations/{conversation_id}/wait
The messenger’s homeGET /guest/v1/messenger

POST /guest/v1/attachments

Asks for somewhere to upload one picture (JPEG, PNG, GIF or WebP) before sending it in a message: put the bytes at the answer’s upload address, then name its id in the message.

Needs: the app key (X-CRM-App-Key) and the signed-in user’s token (Authorization: Bearer …), or their id for an app with unverified sign-in. See From a website or web app.

Body (application/json): AttachmentBody

FieldTypeDescription
bytes (always)integerThe picture’s size, at most MaxAttachmentBytes.
content_type (always)stringOne of AttachmentTypes.

Answers

StatusBodyMeaning
201AttachmentUploadMade
400problemThe request could not be read: the problem names the field.
401problemNo credential, or one that is not right.
403problemRefused: the app is switched off, or this is not allowed.
404problemNot found, or the part is switched off.
422problemA value that is not right: the problem says which.
429problemToo many requests: wait for Retry-After.

GET /guest/v1/conversations

Newest first, a page at a time: pass the page’s next_before as before for the next one.

Needs: the app key (X-CRM-App-Key) and the signed-in user’s token (Authorization: Bearer …), or their id for an app with unverified sign-in. See From a website or web app.

Parameters

NameInDescription
beforequeryWhere the page starts: the next_before (or before) of the page before it.
limitqueryHow many to answer, at most.

Answers

StatusBodyMeaning
200ConversationPageOK
400problemThe request could not be read: the problem names the field.
401problemNo credential, or one that is not right.
403problemRefused: the app is switched off, or this is not allowed.
429problemToo many requests: wait for Retry-After.

POST /guest/v1/conversations

Starts a conversation with the user’s first message, or with the help bot’s opening that the messenger’s home offered.

Needs: the app key (X-CRM-App-Key) and the signed-in user’s token (Authorization: Bearer …), or their id for an app with unverified sign-in. See From a website or web app.

Parameters

NameInDescription
Idempotency-KeyheaderYour own id for this send (at most 100 characters): sent again after a timeout, it is kept once.

Body (application/json): StartBody

FieldTypeDescription
attachment_idsarray of string
buttonstringThe id of the opening’s button the guest tapped, with no words or pictures; empty when they wrote.
openingOpeningRefThe opening the guest was shown when they wrote or tapped; nil for none.
text (always)string

Answers

StatusBodyMeaning
201ConversationMade
400problemThe request could not be read: the problem names the field.
401problemNo credential, or one that is not right.
403problemRefused: the app is switched off, or this is not allowed.
404problemNot found, or the part is switched off.
409problemRefused as things stand: the problem says why.
422problemA value that is not right: the problem says which.
429problemToo many requests: wait for Retry-After.

GET /guest/v1/conversations/{conversation_id}

The conversation with every part the user may see.

Needs: the app key (X-CRM-App-Key) and the signed-in user’s token (Authorization: Bearer …), or their id for an app with unverified sign-in. See From a website or web app.

Parameters

NameInDescription
conversation_id (required)pathThe conversation’s id.

Answers

StatusBodyMeaning
200ConversationOK
400problemThe request could not be read: the problem names the field.
401problemNo credential, or one that is not right.
403problemRefused: the app is switched off, or this is not allowed.
404problemNot found, or the part is switched off.
429problemToo many requests: wait for Retry-After.

POST /guest/v1/conversations/{conversation_id}/bot

The user’s answer to the help bot’s question: a button, or what it asked them to type.

Needs: the app key (X-CRM-App-Key) and the signed-in user’s token (Authorization: Bearer …), or their id for an app with unverified sign-in. See From a website or web app.

Parameters

NameInDescription
conversation_id (required)pathThe conversation’s id.

Body (application/json): BotReplyBody

FieldTypeDescription
buttonstring
part_id (always)string
valuestring

Answers

StatusBodyMeaning
201PartMade
400problemThe request could not be read: the problem names the field.
401problemNo credential, or one that is not right.
403problemRefused: the app is switched off, or this is not allowed.
404problemNot found, or the part is switched off.
409problemRefused as things stand: the problem says why.
422problemA value that is not right: the problem says which.
429problemToo many requests: wait for Retry-After.

POST /guest/v1/conversations/{conversation_id}/messages

Adds the user’s message, with up to four pictures uploaded first.

Needs: the app key (X-CRM-App-Key) and the signed-in user’s token (Authorization: Bearer …), or their id for an app with unverified sign-in. See From a website or web app.

Parameters

NameInDescription
conversation_id (required)pathThe conversation’s id.
Idempotency-KeyheaderYour own id for this send (at most 100 characters): sent again after a timeout, it is kept once.

Body (application/json): MessageBody

FieldTypeDescription
attachment_idsarray of stringPictures uploaded through an AttachmentUpload and not yet sent.
text (always)string

Answers

StatusBodyMeaning
201PartMade
400problemThe request could not be read: the problem names the field.
401problemNo credential, or one that is not right.
403problemRefused: the app is switched off, or this is not allowed.
404problemNot found, or the part is switched off.
409problemRefused as things stand: the problem says why.
422problemA value that is not right: the problem says which.
429problemToo many requests: wait for Retry-After.

POST /guest/v1/conversations/{conversation_id}/rating

The user’s rating of a closed conversation that asked for one, once.

Needs: the app key (X-CRM-App-Key) and the signed-in user’s token (Authorization: Bearer …), or their id for an app with unverified sign-in. See From a website or web app.

Parameters

NameInDescription
conversation_id (required)pathThe conversation’s id.

Body (application/json): RatingBody

FieldTypeDescription
rating (always)integer1 (bad) to MaxRating (great).
remarkstringAnything they want to add.

Answers

StatusBodyMeaning
200PartOK
400problemThe request could not be read: the problem names the field.
401problemNo credential, or one that is not right.
403problemRefused: the app is switched off, or this is not allowed.
404problemNot found, or the part is switched off.
409problemRefused as things stand: the problem says why.
429problemToo many requests: wait for Retry-After.

POST /guest/v1/conversations/{conversation_id}/read

Marks the conversation read up to a part, and answers the user’s unread count.

Needs: the app key (X-CRM-App-Key) and the signed-in user’s token (Authorization: Bearer …), or their id for an app with unverified sign-in. See From a website or web app.

Parameters

NameInDescription
conversation_id (required)pathThe conversation’s id.

Body (application/json): ReadBody

FieldTypeDescription
seq (always)integer

Answers

StatusBodyMeaning
200UnreadCountOK
400problemThe request could not be read: the problem names the field.
401problemNo credential, or one that is not right.
403problemRefused: the app is switched off, or this is not allowed.
404problemNot found, or the part is switched off.
429problemToo many requests: wait for Retry-After.

GET /guest/v1/conversations/{conversation_id}/wait

A long poll: answers as soon as the conversation has something newer than after, or after about 25 seconds with nothing new. Ask again straight away while the conversation is on screen.

Needs: the app key (X-CRM-App-Key) and the signed-in user’s token (Authorization: Bearer …), or their id for an app with unverified sign-in. See From a website or web app.

Parameters

NameInDescription
conversation_id (required)pathThe conversation’s id.
afterqueryThe version already held: an answer comes only once there is something newer.

Answers

StatusBodyMeaning
200ConversationUpdateOK
400problemThe request could not be read: the problem names the field.
401problemNo credential, or one that is not right.
403problemRefused: the app is switched off, or this is not allowed.
404problemNot found, or the part is switched off.
429problemToo many requests: wait for Retry-After.

GET /guest/v1/messenger

What the messenger’s first screen shows this user: the greeting, the team’s faces and reply time, the cards your team published, open conversations, a few articles and tickets, and the help bot’s opening when one would start.

Needs: the app key (X-CRM-App-Key) and the signed-in user’s token (Authorization: Bearer …), or their id for an app with unverified sign-in. See From a website or web app.

Answers

StatusBodyMeaning
200MessengerHomeOK
400problemThe request could not be read: the problem names the field.
401problemNo credential, or one that is not right.
403problemRefused: the app is switched off, or this is not allowed.
429problemToo many requests: wait for Retry-After.