Send custom events from Webchat to your website
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:
- A website with an embedded bot
- Familiarity with JavaScript
1
Add a Send Custom Event Card
- In Botpress Studio, add a Send Custom Event Card to any Node:
- Set the Conversation ID to
{{ event.conversationId }}
- Add anything you want to the Event field.
The Event field contents must be in JSON format.
2
Listen for the event on your website
Now, you can listen for the event in your website’s source code:
index.js
You can listen to other kinds of Webchat events, too.
Now your website can respond to your custom event!