I was working with dialogflow es and discovered that i could use my nodejs server to send and receive messages from it. I was wondering if i could do the same with my yellow ai bot since i couldnt find anything in the docs or online for something like this. Thanks in advance
To send and receive messages using an event-based approach in a chatbot, you can use the sendEvent
node to send messages from the bot to an external service and listen for incoming messages using an event. Here’s a simplified explanation:
Sending Messages from Bot to Outside:
Use the sendEvent
node in your bot’s flow to trigger an event. For example, you can use this node to send a message to an external API or service.
Receiving Messages from Outside to Bot (Event):
Here’s a simplified example of how you might use this approach:
document.getElementById('ymIframe').contentWindow.postMessage(JSON.stringify({
event_code: 'ym-client-event',
data: JSON.stringify({
event: {
code: "your event name",
data: object
}
})
}), '*');