Webhook
Last updated
Last updated
Your website team needs to call the REVE Chat Webhook API to transmit user information to the chatbot. It is recommended that your team needs call the API from server side. Follow the below steps to configure Webhook.
Navigate to the Bot: Login to your REVE Chat Dashboard. Click on Chatbot from the vertical nav bar, then select your bot that your team is working on.
Access Webhook Settings: Once you land into your chatbot, in the top navigation bar click on Settings > select Webhook in the left navigation menu of the chatbot settings page.
Find or Create a Webhook: You need to generate a webhook link for your chatbot. Please note that each bot will have separate webhook link.
Save your response: You can create your endpoint from here and define which attribute to save the webhook response. Also, you can define in the chatbot which flow will be triggered if you send data to this webhook. For e.g. customer logged in the website and you want to send data in the chatbot.
To send data to the webhook, include the following in the API header:
Authorization: Bearer <token from webhook configuration>
Each bot has a unique authorization token, which can be refreshed as needed. Refreshing invalidates any previous token, so avoid updating the token unless necessary.
The authorization token can be found on the webhook settings page.
Note: Authorization tokens can be refreshed at any time. However, doing so invalidates the previous token. Only refresh when necessary to maintain security and access continuity.
Example Curl:
To send the data to the website team needs to send user data in the webhook along with the sessionId and botId parameter. The ongoing session sessionId and botId can be found with below approach.
Your team should create a custom JavaScript function such as- `chatbot.someFunctionName(param)`.
You can get the sessionId and botId in the param object and your team can use that param object to access the sessionId and botId like param.session_id and param.chatbot_id in their function. Here's an example script:
You need to use another script to process the data you're sending in the webhook. For e.g. you are sending user login information Name, Phone etc. You can process this data with Script.
This will allow you to further save your response and take user to different flow with Condition action. Learn how to use condition action.
First you need to check from chatbot when to call the browser script. It will trigger the script and fetch information in the beginning. If it is not needed in the beginning, you can define when it can be called. This script will allow the REVE Chat widget to call a browser script to get data.
Then, in the webhook settings, you need to define which node it will trigger if an endpoint receives data. From there, you can process the user response and take user to separate flow with condition action.
Any questions? Please email us at issue.support@revechat.com or scan to chat with us.