Links

Messages

Messages

You can use the API to get the message information.
The Message model
Key
Type
Description
id
String
The unique identifier for the message which is given by Tiledesk.
sender
String
A unique identifier of the sender. It can be: the user identifier, a bot identifier or the system user
senderFullname
String
The sender fullname. It can be: the user fullname, the bot name or an alias
recipient
String
A unique identifier of the recipient. It can be: the request_id field (external id) of the request
status
Number
The message status: FAILED : -100, SENDING : 0, SENT : 100, DELIVERED : 150, RECEIVED : 200, RETURN_RECEIPT: 250, SEEN : 300
text
String
The message text.
type
String
The message type. Accepted values: text (default), image
metadata
Object
The message metadata.
attributes
Object
The custom attributes which are set for the message.
createdAt
String
The time (ISO-8601 date string) when the message was created.
updatedAt
String
The time (ISO-8601 date string) when the message was updated.
createdBy
String
The unique identifier of the row creator
id_project
String
The unique identifier of the project
post
https://api.tiledesk.com/v2
/:project_id/requests/:request_id/messages
Send a message
Example sending text message:
curl -v -X POST -H 'Content-Type: application/json' -u [email protected]:123456 -d '{"text":"hello from api"}' https://api.tiledesk.com/v2/5b55e806c93dde00143163dd/requests/support-group-1234/messages
Example sending image:
curl -v -X POST -H 'Content-Type: application/json' -u [email protected]:123456 -d '{"text":"Alternative text from api", "type":"image", "metadata": {"src": "https://tiledesk.com/tiledesk-logo-x1.png", "width": 200, "height": 200}}' https://api.tiledesk.com/v2/5b55e806c93dde00143163dd/requests/support-group-1234/messages

Attributes

When you send a message you can use the following attributes to activate advanced features:
  • attributes.clienttimestamp: use this property to force the message timestamp in milliseconds. This parameter is used by the clients (widgets and chat agents) to perform a client side reordering of messages based on the value of the timestamp field. This property doesn’t guarantees the order of arrival, but only the ordering or reordering on the client side.
  • attributes.attachment: use this property to set the response additional reply componenst as quick replies, buttons, links etc. (see: https://developer.tiledesk.com/widget/advanced/widget-json-protocol)
  • attributes.subtype.info: If “true” it hides the message to the end-user channels (Widget, whatsapp, Telegram, Facebook etc.)
  • attributes.microlanguage: set this property to true to enable the microlanguage pre-processor. You can find more info here: Chatbot buttons, images, video and microlanguage example
  • attributes.disableInputMessage: if true it disables the input message, until the next message arrival
  • attributes.inputMessagePlaceholder: if set, it modify the default input text placeholder
  • attributes.updateUserEmail and attributes.updateUserFullname: If set, the back forward user fullname and email to the widget. Useful if you set user fullname or email in a webhook or external service.

Advanced features

Tiledesk uses Chat21 as messaging engine. When you send a message to Tiledesk using the REST API, Tiledesk will forward the call to the Chat21 REST API. You can see how the Chat21 REST Api works here: https://github.com/chat21/chat21-cloud-functions/blob/master/docs/api.md#send-a-message
You can enable special message features following this paragraph: https://github.com/chat21/chat21-cloud-functions/blob/master/docs/api.md#message-attributes
get
https://api.tiledesk.com
/v2/:project_id/requests/:request_id/messages
Get the messages of a request by id
Example:
curl -v -X GET -u [email protected]:123456 https://api.tiledesk.com/v2/5b55e806c93dde00143163dd/requests/support-group-L_OG76RYhR0XFiMf2PK/messages
get
https://api.tiledesk.com
/v2/:project_id/requests/:request_id/messages/:message_id
Get the message by request id and message id
Example:
curl -v -X GET -u [email protected]:123456 https://api.tiledesk.com/v2/5b55e806c93dde00143163dd/requests/support-group-L_OG76RYhR0XFiMf2PK/messages/5c81593adf767b0017d1aa68
post
https://api.tiledesk.com/v2
/:project_id/requests/:request_id/messages/multi
Insert multiple messages
Example of inserting multiple messages:
curl -v -X POST -H 'Content-Type: application/json' -u [email protected]:123456 -d '[{"sender":"bb0d809b-b093-419b-8b48-11a192cc3619","text":"1"},{"sender":"bb0d809b-b093-419b-8b48-11a192cc3619", "text":"2"}]' https://api.tiledesk.com/v2/5b55e806c93dde00143163dd/requests/support-group-1234/messages/multi
Last modified 1mo ago