Sending and receiving messages with Tiledesk APIs
Last updated
Last updated
This tutorial will help you to understand how to send and receive "support messages" between Tiledesk's End Users and Agents using Tiledesk REST APIs and Webhooks.
Signup a user on Tiledesk
Anonymous end-user authentication through APIs
Sending messages to a conversation
Receiving new messages notifications using Webhooks
To use Tiledesk APIs is mandatory to signup a new user on our beta environment available on https://panel.tiledesk.com/v3/dashboard
The previous APIs end-point will change as soon as the beta version will be released as Tiledesk v2. This tutorial will be updated accordingly.
After signup please follow the proposed wizard to create your first Tiledesk project.
Get the PROJECT_ID of the created project under Project Settings menu. We will use this later.
In this tutorial we will authenticate end-users through anonymous authentication (you can find more info on anomymous authentication here).
All APIs in this tutorial will use the following endpoint:
The previous APIs end-point will change as soon as the beta version will be released as Tiledesk v2. This tutorial will be updated accordingly.
This will reply with the JWT token that we'll use to send our first message:
You can send a message using the Send Message API.
To send a message you need to choose a unique request identifier. A request is an object containing the all the metadata describing the conversation between end-user and support team).
The request identifier must follow the following pattern:
support-group-<UUID>
Please consider that the first message you send to a conversation also creates request and corresponding conversation if they do not exist.
Example with realistic variables instances:
Looking at the dashboard of your project you will see your first conversation in the Requests panel. The requests are updated in real time, so you don't have to manunally update the Requests' page. If you left unchanged all the default settings, the request will be assigned to you (make sure you are "available", looking in the lower right corner of your profile image in the left menu panel).
The agent (you) can now see the same conversation in the agent chat (first option of the menu panel will open the desktop chat).
You can subscribe to the messages events sent to a conversation using Webhooks.
You must first create a subscription to an event that points to a url on your server.
In this case we will subscribe to message creation event on a custom url (/test) on requestcatcher.com, a free, beautiful service to debug your webhooks:
The subscription endpoint returns:
Now you are notified for each messages sent to your Tiledesk project. Now, for example, if the agent sends a message to the end user, your webhook endpoint will be notified with the message payload.
This is the webhook notification with the message payload. You can use this notification to create a copy of all messages sent/received in your project, generate new custom events, communicate in real time on other channels etc.
Do you have feedback on this article? Please send us your feedback writing an email to info@tiledesk.com