Real-Time Data Delivery Using Webhooks in KiboPush
Real-Time Data Delivery Using Webhooks in KiboPush
If you’ve ever done any form of backend development, then you’ve probably heard of webhooks and know how useful they can be. As a recap, the main advantage of the webhooks pattern is that your application doesn’t have to make periodic calls to APIs while it’s waiting for changes. Instead, APIs will call your application on a specific endpoint informing that something interesting has happened. For example, if you’re developing a chatbot application, then it makes sense to have a webhook for whenever a message is received. This way your application won’t have to constantly check if a message was received; this would not only slow down performance due to constant API calls, it can even cause your application to be blocked if there is a limit to the number of API calls you can make in a given time frame.
KiboPush also provides real time data delivery using webhooks. You can register to any one of the various webhooks, and add custom handling according to your needs. This is an incredibly powerful tool that will allow you to be notified whenever any action of interest happens and deal with it automatically right then without having to go and check periodically yourself.
So how can you do this?
As with other things in KiboPush, it is incredibly simple!
Go to settings from the sidebar and click on Webhooks Tab
Click on Add Endpoint:
Select the page you wish to receive updates for:
Enter the callback URL; this will be the URL that will be called whenever an event of interest occurs:
Note: You can only set one callback URL per page.
Enter the verify token ‘VERIFY_ME’ .This is a token that will be defined in your code inside the method that handles the callback url. KiboPush will pass this verify token as a request parameter. Your method should check if the correct token is being received to validate if the request is trusted:
And now select an event that you wish to receive real time updates for:
Here’s a brief overview of all of the currently available webhooks for which you can receive updates:
New Subscriber: whenever a user subscribes to your page
Chat Message: whenever a message is sent or received on the page
Session Assignment: whenever a chat is assigned or unassigned to a team or agent on the page
Chat Bot Option Selected: whenever a subscriber interacts with the page chatbot by tapping any quick reply
Checkbox Optin: whenever a user optins to the checkbox plugin on any website to receive messages from your bot on messenger.
After you’re done, hit save, and that’s it; you will now receive real-time updates to your callback URL for whichever event you’ve selected.
All Comments
Write a Comment