Setting up a webhook
Before you start
Make sure you have a ChatShipper admin account.
Setting up the webhook
All bots listen to ChatShipper events via a webhook. With a webhook you can tell ChatShipper to send one or more events from ChatShipper to your bot (the url your bot is connected listening on). Let's create a new webhook by following the click directions in the image below:
Adding a webhook to your organization. Webhooks are found by:
(1) Selecting Settings > <Your Organization>
(2) Selecting Integrations sidebar
(3) Clicking on + on bottom right of page.
The webhook creation page will open. Configure it by following the directions in the image below:
(1) Fill in the Webhook URL (the ngrok https url from the previous chapter),
(2) Clicking on Create Service
When we created the webhook ChatShipper did a GET request on the webhook endpoint and expects it to return a 200 OK. And it did. But how, you might ask. The answer is the ChipChat SDK does this for us. It will create the GET endpoint for us and return the 200 OK for us.
actually it does a bit more, but that is outside the scope of this project
What do we have so far:
- We have a running bot that listens to all events and logs them.
- We have a webhook that pushes the default message and conversation events.
I think it is time for to test the bot