Let your website know when something happens in your user’s conversation.
You can send custom events from Webchat to your website. This is useful if you want your website to perform an action when your user reaches a certain point in its conversation with your bot.
You will need:
In Botpress Studio, add a Send Custom Event Card to the Node you want to trigger the event from:
Set the Conversation ID to {{event.conversationId}}
. Then, add any valid JSON to the Event field.
The contents of the Event field should clearly identify the action you want your website to perform. For example, if you want to checkout with the user’s current shopping cart, you could add something like {"action": "checkout"}
.
You can also use variables to dynamically insert the contents of the Event field.
Now, you can react to the event in your website’s source code using a custom event listener.
Here, event
contains whatever data you put in the Event field of the Send Custom Event Card. You can read its contents if you want your website to react differently depending on which custom event you send. For example:
You can listen to other kinds of Webchat events, too.
Let your website know when something happens in your user’s conversation.
You can send custom events from Webchat to your website. This is useful if you want your website to perform an action when your user reaches a certain point in its conversation with your bot.
You will need:
In Botpress Studio, add a Send Custom Event Card to the Node you want to trigger the event from:
Set the Conversation ID to {{event.conversationId}}
. Then, add any valid JSON to the Event field.
The contents of the Event field should clearly identify the action you want your website to perform. For example, if you want to checkout with the user’s current shopping cart, you could add something like {"action": "checkout"}
.
You can also use variables to dynamically insert the contents of the Event field.
Now, you can react to the event in your website’s source code using a custom event listener.
Here, event
contains whatever data you put in the Event field of the Send Custom Event Card. You can read its contents if you want your website to react differently depending on which custom event you send. For example:
You can listen to other kinds of Webchat events, too.