Kindly Docs

Go to App
⌘K
▶️Introduction
🔹Getting started with webhooks
🔹Webhooks reference
🔹Message processing
🔹Pattern dialogues
🔹Context memory
🔹Languages
📄Guides and Examples
◽Checking webhook signatures (HMACs)
◽Example: Chatlog webhook
◽Kindly Chat authentication
◽Inbox backup to S3 bucket
◽Add the Spinnaker script tag to your site
◽Set up event tracking with Google Tag Manager (GTM)
⚙️APIs
▪️Application API
▪️Chat API
▪️Chat Log API
▪️Handover API
▪️Nudge API
▪️Statistics API
▪️Ticket webhooks (BETA)
📦Legacy
📝APIs Changelog
🛡️Security
©️License and Disclaimer
Docs powered by archbee 

Getting started with webhooks

The fastest way to connect a service or application with Kindly is using our webhooks.

Webhooks can be added to any dialogue or fallback, and are simply sent via a POST request by the Kindly backend to the predefined URL.

For a complete reference on webhooks see the webhooks reference article.

How to use

There are multiple steps to follow for setting up a successful webhook.

Set up a simple web server

For this example, we'll set up and use our own web server to POST to. Our server will have a single endpoint, that simply returns a message to our bot.

Python

The example server below is running Python through Flask. Upon receiving the webhook payload, the server will respond by returning a simple message.

Python
|

When running the script above, the server will run on localhost, with port 9000

Node

The example server below is running on Hapi. Upon receiving the webhook payload, the server will respond by returning a simple message.

JS
|

When running the script above, the server will run on localhost, with port 9000

Set up ngrok

To test our newly configured server, we'll need to serve the script through ngrok. Ngrok is necessary for Kindly to communicate with our development machine (localhost), using it makes it a lot faster to develop, test and prototype new integrations and webhooks.

Follow the link above to set up ngrok on your machine.

When ngrok is set up, we need to point it to the port on which our server is running. This can be acheived with the following command ./ngrok http 9000. Note that this needs to be done inside the folder you installed ngrok.

If the command is successful, something similar to the following will be visible in our terminal.

Text
|

Create a new dialogue

When our server is set up, and ngrok is running, we need to create a new dialogue and paste in the address we want to POST to.

In the Build section, navigate to a dialogue, then Output, and under Advanced features paste in the address ngrok provided. In my case, I would paste in http://725a9731.ngrok.io.

Webhook URL
Webhook URL

Be sure to include the endpoint path in the URL which we used in our server - /kindly - to get the correct response.

Trigger webhook

Now we're ready to test our webhook through the chat bubble, by triggering the dialogue we created earlier. If everything is set up correctly, the bot will respond with our message.

Webhook response
Webhook response

Inspect response

When the dialogue is triggered, and the response is received, we can inspect the response in the debug console. The object created in the console will give us a detailed overview of the payload sent, and received.

Debug console
Debug console

Examples

Check out chatlog webhook example for a complete webhook app.

Updated 05 Sep 2022
Did this page help you?
Yes
No
UP NEXT
Webhooks reference
Docs powered by archbee 
TABLE OF CONTENTS
How to use
Set up a simple web server
Python
Node
Set up ngrok
Create a new dialogue
Trigger webhook
Inspect response
Examples