Webhook service
To use fulfillment in a production system, you should implement and deploy a webhook service. To handle fulfillment, your webhook service needs to accept JSON requests and return JSON responses as specified in this guide. The detailed processing flow for fulfillment and webhooks is described in the fulfillment overview document.
Webhook service requirements
The following requirements must be met by your webhook service:
It must handle HTTPS requests. HTTP is not supported.
Its URL for requests must be publicly accessible.
It must handle POST requests with a JSON WebhookRequest body.
It must respond to WebhookRequest requests with a JSON WebhookResponse body.
Webhook request
When an intent configured for fulfillment is matched, Tiledesk sends an HTTPS POST webhook request to your webhook service. The body of this request is a JSON object with information about the matched intent.
In addition to the end-user query, many integrations also send some information about the end-user as well. For example, an ID to uniquely identify the user.
Here is a sample request:
The token
While repling to the end-users may look as a synchronous action, it is not.
To reply you use the HTTP "res" object, but using the conversation token you can send as many messages as you want back to the conversation, using Tiledesk messaging APIs.
Simply set this token in the Authorization field of the send-message API.
The webhook payload
When an intent configured for fulfillment is matched, Tiledesk sends an HTTPS POST webhook request to your webhook service. The body of this request is a JSON object with information about the matched intent. The payload property contains the most of the information needed.
Intent data
Whitin the payload you can find many information about the current detected intent, i.e. his display name:
Intent static reply
The original static text that you set to reply to the user is also embedded in the payload:
Chatbot metadata
Chatbot metadata are sent to your webhook, so you can have enough data to take the right actions based on the selected chatbot:
Chatbot id
Just two words about the chabot ID. In Tiledesk the chatbot ID is a UUID. But inside a support conversation (that is 'group' conversation, where many partecipants can be involved) the chatbot partecipant ID always has a "bot_" prefix. This prefix helps Tiledesk to immediatly recognize a chatbot among the other partecipants, taking the right actions.
If you want to play with chatbots in the conversation (using orchestration APIs) always remember to prefix the chatbot ID with "bot_" before adding it to a conversation or to recognize it in the same conversation, like in the following example:
User language
This property is the language the user is using (i.e. the browser language):
Project id
The Request metadata
Last updated