Import multiple messages into Tiledesk using REST APIs from third party app
Last updated
Last updated
This tutorial will help you to understand how to insert multiple messages into Tiledesk using REST API from third party app. Suppose you have an application (ex. a chatbot framework or a customer support system) and you want to connect it with Tiledesk. For example suppose you have a chatbot software that automatically serves the users (via a widget or others channels) but at some point you want to forward the chat to Tiledesk so that the agents ( and no longer the chatbot) serve the request.
Signup a user on Tiledesk
Anonymous end-user authentication through APIs
Creating the conversation (request)
Sending messages to a conversation
To use Tiledesk APIs is mandatory to signup a new user on our beta environment available on https://panel.tiledesk.com/v3/dashboard
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 REST API. We will do an anonymous authentication in order to get the id of the user (requester) who will create the conversation (next paragraph).
This will reply with the JWT token that we'll use to send our first message:
Now let's use Create a conversation REST API by setting mainly four parameters:
YOUR_ADMIN_EMAIL and PASSWORD: use your admin credentials here
SENDER: the anonymous user id created with the previous step.
FIRST_MESSAGE: this text is used to summarize the conversation subject. Normally this is the first message send by the user requester.
PROJECT_ID: your project id
You will get a reponse like this:
Now an empty (without message) conversation is created. Pay attention to the request_id field for the next paragraph.
Let us Insert multiple messages REST API to import the messages. We need the following parameters :
request_id: the unique request identifier generated by the previous endpoint call
the admins credentials
An array of messages where:
text: is the message text
sender is the user indentifier of the user who send the message
attributes.clienttimestamp: use this property to force the message timestamp in milliseconds.
Looking at the dashboard of your project you will see your 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).
Do you have feedback on this article? Please send us your feedback writing an email to info@tiledesk.com