Use the time selector messaging component with your bot to schedule appointments or deliveries within a bot conversation. The component works with an Apex class or flow to present customers with a selectable list of time slots and save their responses.
Required Editions
| View supported editions for Einstein Bots. |
| View supported editions for Messaging. |
| User Permissions Needed | |
|---|---|
| To build and manage Einstein Bots: |
Customize Application OR Modify Metadata OR Manage Bots |
Support for messaging components varies by channel.
Before you begin:
- From the Messaging Component page in Setup, create a time selector messaging component.
When you set up a time selector, you create a prompt that instructs the customer to select a time slot. The prompt isn’t visible in the Bot Builder, but you don’t need to add a separate dialog step to send it. In the bot conversation, the prompt is sent to the customer when they reach the dialog step that references your component.
You can view or edit the prompt from the Messaging Components page in Setup, in the Constants section of the Component Details page for your component.
- Create an Apex class or flow that dynamically generates session-specific choices each time the component is sent. In most cases, use an Apex class.
-
To generate a list of available time slots each time the component is sent, add an Apex
class or flow to your dialog.
- Go to the Bot Builder. Click Dialogs, and then select the dialog that you want to add the time selector component to.
- From the Dialog Component Library, drag the Apex or Flow action dialog step onto the canvas.
- In the Step Properties panel, select the Apex class or flow associated with the time selector component.
- For each output, create or select a bot variable to store the output of the Apex class or flow. You reference these variables again in the Time Selector dialog step to show available time slots and other information to the customer.
-
Add the time selector component to your bot.
- From the Dialog Component Library, drag the Time Selector dialog step onto the canvas.
- In the Step Properties panel, select the time selector component associated with your Apex class or flow.
-
To show available time slots and other information with the component, for each
input parameter, specify a bot variable. In most cases, specify the same output
variables you created in the previous Apex or Flow action steps in the corresponding
input parameter fields.
For example, in an Apex action step, you store the output of the Messaging Time Slot Options Apex class in the Available Times object list variable. In the associated Time Selector dialog step, in the Time Slot Options input parameter, you specify the same Available Times object list variable.
Apex dialog step Time Selector dialog step
- Specify a backup rule action for the bot to use if the required input parameters don’t return any time slots to show to your customer. Select Call Dialog or Redirect to Dialog, and then select the appropriate dialog.
-
In the output section, select or create an object variable to store the customer’s
choice.
- Tell the bot what to do if the variable already contains a value. The bot can keep the original value and skip the time selection, or the bot can prompt the customer to select a time and override the original value.
-
Optionally, add repair attempts to prompt the customer to try again if the bot
doesn’t recognize their response (for example, if the customer enters text instead of
selecting an available time). In the Repairing Misunderstanding section, include one
or two repair attempts.
After the bot makes these attempts, tell the bot how to resolve the issue. Specify whether the bot repeats the repair attempts until the customer selects a valid choice or moves on to the next dialog step without filling the variable.
-
Optionally, add a Message dialog step to confirm the customer’s time slot selection. To
include the specific time slot in the message, use standard merge syntax to reference the
output variable you specified in the Time Selector dialog step.
- Save your changes.