Custom Payload as a bot trigger.
- Bot Builder
Consider Custom Payload to be a bot trigger but for the branching process. Each button, if assigned a unique custom payload, can then be used to direct the user conversation into any branch based on Rules.
Remember that each custom payload must be unique and should not be the same as any other payload or any bot.
In order to branch out the Bot using Payload follow the steps below.
- First, add your Message Types and edit/add the info, here we have added 3 Message types for our example.
(Note: Here we will be using only 2 conditions, though 2 is not the limit for adding rules and conditions.)
- Once you have added a Message Type supporting buttons, you can set a Payload under button actions by selecting Custom action.
- Now enter the payload which you want to set.
Note: Refrain from using any common words for your payload.
- Enter the button title for your button and click on Save option.
- Repeat the same steps to add another Payload for the second Button (e.g. summer collection) and click on Add a rule.
- Now under Rule 1 click on +Add condition and select Check user input.
- Select the first option in the dropdown (i.e. Winter Collections), to set your first condition and select the Go to step for the same.
In the example below we have selected the Winter Collections and the Go to step has been set to For Winter.
- Now Select the message type created for the added rule. In the below example we have chosen For Summer message template for the summer collection's Payload.
- Once you have added the rules, you have set the conditions for the user, using the Payload method. You can use the added Custom payload in further added message types as well.
(Note: You can add multiple conditions for the added rules.)
Now you can continue building your bot with the further user journey or end your bot flow. (Below image is the template view output of conditional methods.)
Branching out Bots using custom Payload. What is Payload?
While breaking down your bots into smaller more manageable sections is always the best approach, there will be times when you may want to branch out your bot journey based on the user input. (Eg. if the user chooses option A, show Message 1 else if the user chooses option B, show Message 2). This method of branching usually depends on guided choices via buttons. And you may have seen that amongst other button actions such as Start a Product Flow or Start a Collection Flow, there is an option of Custom Payload listed in button action. This option is used to branch out the bot into multiple segments. (below image is an example of branching)