Triggering Flows

A flow is triggered in response to a customer request or action. Previously, if you wanted to trigger a flow with Events, you were required to either start your flow with an Event Trigger or add an Event Reply after the first trigger. To make the process of triggering flows easier, you can now directly trigger a flow with event replies, buttons, and quick replies.

Additionally, you can trigger a specific flow from Code Actions and Webhooks. This approach reduces the development time and enhances the user experience.

Event Replies

Pre-requisites- You need to create a separate flow to be able to trigger the flow using the Event Replies.

To trigger flow using the Event Replies:

  1. Create a flow.
  2. Drag any trigger to the canvas.
  3. Drag an Event Reply to the canvas.
  4. In the Event panel, open the Trigger Type menu and click Flow.
  5. Select the flow to be triggered from the Flow Name menu.
  6. Click Save.

Buttons

Pre-requisites- You need to create a separate flow to be able to trigger the flow using Buttons.

To trigger flow using Buttons:

  1. Create a flow.
  2. Drag any trigger to the canvas.
  3. Drag a Button Reply to the canvas.
  4. In the Button panel, enter the Title.
  5. Click Add and enter the button name in the Label field.
  6. Select Trigger Flow in the Trigger Type window.
  7. Select the flow to be triggered from the Flow Name menu.
  8. Click Save.

Quick Replies

Pre-requisites- You need to create a separate flow to be able to trigger the flow using Quick Replies.

To trigger Flow using the Quick Replies:

  1. Create a flow.
  2. Drag any trigger to the canvas.
  3. Drag a Text Reply to the canvas.
  4. Enter a message in the Add text response field.
  5. In the Quick Replies section, click ADD QUICK REPLY.
  6. Select Trigger Flow in the Send Text menu.
  7. Select the applicable flow in the Flow menu.
  8. Enter the button name in the Label field.
  9. Click Save.

Webhooks

To trigger Flow using Webhooks, copy the Flow immutable ID and paste it into the Code Action:

const replyBody = {  
    verifyToken,  
    flows: [{  
      flowImmutableId: 'fQ2Heilnc'  
    }]  
  }

Code Action Example

To trigger Flow using a Code Action, copy the Flow immutable ID and paste it into the code action. Update the Call Back URL in the Webhook window.

async payload => {  
  try {  
     trigger({  
       type: 'flow',  
       flowImmutableId: 'fxA2ExdQF'  
     })

  } catch(err) {  
    console.error(err)  
  }  
}

Try it out

To trigger a flow from the Try it out window:

  1. In the Try it out window, click the flag icon.
  2. Select Trigger Type Event from the drop-down menu.
  3. Select the applicable flow from the Flow menu.
  4. Click SEND.

Read more about Khoros Flow Triggers and Replies.