Code-based Actions: Channel-specific flows
You can connect Flow with multiple channels. Each channel has its own feature. For example, channels like Facebook Messenger or WhatsApp can receive user data that you can use in your flows. However, you don't have this capability with a Web Widget.
Example
A typical case use where it is recommended to change your flows based on the user's channel within Customer Service. When your user reaches out through the Web Widget, that person is still anonymous. Therefore you might want to ask for name, email, and phone. On the other hand, if a user contacts you through Facebook Messenger you will receive user data so that you can respond to him later.
Check the user's channel
Let's start by checking the channel of the user. Drag and drop an action onto your canvas and use the code below. The code below checks if the user's channel is a messenger or web socket.
If the channel is messenger, we will trigger an event called Channel-Messenger. If the channel is a socket, we will trigger an event called Channel-Socket.
async payload => {
let channel = payload.channelName
if(channel === 'messenger'){
trigger('Channel-Messenger')
}
if(channel === 'socket'){
trigger('Channel-Socket')
}
}
Create channel-specific flows
Ensure that your channel-specific flows start with an event with the name of that event that is in your cloud code. In this case, that is Channel-Messenger and Channel-Socket.
Design your channel-specific flows based on the user's channel, you can extract data of the user by using entities.
Other channels
Besides the example above that covers the messenger and socket, you can also use the following channels:
channels = ["alexa","events-webhook","google","mavenir",
"rbm","rest","telegram","whatsapp"]
Updated 10 months ago