Whenever a Circuit Bot is getting added to a Circuit conversation, I want to trigger an event like,
1) A Bot introducing itself. 2) Send some Circuit Forms to get some info etc.
Whenever a Circuit Bot is getting added to a Circuit conversation, I want to trigger an event like,
1) A Bot introducing itself. 2) Send some Circuit Forms to get some info etc.
There are two ways to do so :
If you use the JS SDK to implement your bot, you can subscribe to the event
// register a webhook to listen to new items added
await fetch(`${DOMAIN}/rest/v2/webhooks`, {
method: 'POST',
headers: {
'Authorization': 'Bearer ' + token
},
body: `url=${encodeURI(`${URL}/webhook`)}&filter=CONVERSATION.CREATE`
});
Doing so, every time your bot is added to a conversation, you will receive an event and you can then execute the logic to post a welcome message or form
Use the Rest API to subscribe to the same CONVERSATION.CREATE event and, same as option 1, when the bot is added to a conversation, your webhook Url will be triggered.