Webhooks are a powerful resource that you can use to automate your use cases and improve your productivity.
Unlike the API resources, which represent static data that you can create, update and retrieve as needed, webhooks represent dynamic resources. You can configure them to automatically notify you when for example a new request occurs.
Typical use case for webhook integration is connecting Tiledesk to external CRM, marketing automation tools or data analytics platforms.
Follow this tutorial if you’re developing a Tiledesk integration that reacts to internal Tiledesk events, such as new incoming chat or queued visitor.
For instance if you’re integrating a marketing automation tool, you could add a new contact every time a Tiledesk visitor starts a chat.
To use this tool you need to have basic knowledge about webhooks and Tiledesk authorization protocol.
This tutorial is will not be helpful for integration that pulls data on demand (not in reaction to some Tiledesk event). If you just want to pull Tiledesk reports on user request, you’d rather just use REST API.
You’ll need a Tiledesk Account. Sign up to the Tiledesk Dashboard to create a new account.
Tiledesk uses RestHook patterns. REST Hooks itself is not a specification, it is a collection of patterns that treat webhooks like subscriptions. These subscriptions are manipulated via a REST API just like any other resource. More info about Rest Hook here.
Tiledesk can send notifications when some particular action is performed. Such a notification is called a webhook – it’s just a simple HTTP request that Tiledesk sends to your server when a particular event occurs.
To use RestHook you must Create a New Subscription. Each Subscription consists of the following properties:
event – determines when the webhook is sent to your web server.
target – address of your web server the webhook will be sent to.
Each webhook is a HTTP POST request made to the URL that you provide. The request’s POST body contains webhook information in JSON format.
Each webhook request contains the following properties:
hook – return the subscription object that triggered the webhook.
payload – It contains the data of the webhook.
When your server receives a webhook from Tiledesk, it should respond with HTTP 200 response. Otherwise, Tiledesk will retry sending the webhook to your service for a number of times unless it receives the correct HTTP 200 response.
Note: Tiledesk webhooks are sent with Content-Type: application/json header, so please make sure that your service can handle such requests.
The following Events are available and you can be notified when an action relating to that event occurs.
Subscribe to requests creations
Subscribe to request being updated
Subscribe to request being closed
Subscribe to messages creations
Subscribes to leads creations
Subscribes to faq creations
Subscribes to faq being updated
Subscribes to faq being deleted
Subscribes to bot creations
Subscribes to bot being updated
Subscribes to bot being deleted
Subscribes to department creations
Subscribes to department being updated
Subscribes to department being deleted
Subscribes to teammate project invitation
Subscribes to teammate being updated
Subscribes to teammate project leave
Subscribes to group creations
Subscribes to group being updated
Subscribes to group being deleted
Subscribes to event emitting
Subscribes to a specific event emitting. Example: event.emit.typing.start to subscribe to typing indicator events.
Subscribes synchronously to the assignment of the conversation to a specific agent or bot. Before Tiledesk assigns a conversation to an operator (agent or bot) you can create a custom endpoint that receive the webhook call and dynamically select the operator based on your custom logic (for example: skills, operating hours, etc..). The webhook returns the following payload: 1) the agents array 2) the available agents array 3) the suggested operator selected by Tiledesk engine if routing is "assigned" otherwise if "pooled" an empty array 4) the department model 5) the project model 6) the id of the operator selected in the previeous assignment 7) the conversation in the previeous assignment. Find an example here
A notification object contains the following fields:
Hook attribute contains the subscription object that triggered the webhook.
The Tiledesk defined id representing the subscription.
The timestamp the subscription was created.
The timestamp the subscription was updated
The subscription target url
Corresponds to an event, eg 'lead.create', 'request.create'
Payload is the data associated with the notification. To understand the payload object you must consider the model column of the Webhook Events table.
Each webhook notification is signed by Tiledesk via an x-hook-secret header. We do this so that you can verify the notification came from Tiledesk.