Understanding Blocks
Blocks are the fundamental building units of your bot’s conversational flow. They are predefined components that handle specific functions, ensuring consistency and reliability. While you can’t create new block types, you can configure them to fit your needs.
Standard Block Structure
Section titled “Standard Block Structure”Every block in the system shares a standard structure with three key properties:
- Type: Defines the block’s purpose and behavior (e.g., sending a message, checking a condition).
- Actions/Configuration: Customizable settings that determine how the block operates.
- Return: Defines what happens after the block executes.
Default Block Types
Section titled “Default Block Types”Here are the default block types available in the Bot Builder Platform:
1. Message Block
Section titled “1. Message Block”The Message Block is used to display content to the user.
- Type:
MESSAGE - Configuration:
isActive: Enable or disable the block.content: The text message to display (must be between 5 and 200 characters).hyperlink: Add an array of clickable links to your messages.quickReply: Configure quick reply options to provide users with predefined responses.
- Return:
- By default, the conversation proceeds to the next connected block.
- If Quick Reply is enabled, the selected quick reply value is returned.
2. Button Block
Section titled “2. Button Block”The Button Block displays a message with up to three buttons for the user to choose from.
- Type:
MESSAGE - Configuration:
isActive: Enable or disable the block.buttons: An array of up to 3 buttons, each with a text label (1-20 characters) and a corresponding value.quickReply: This is always enabled for button responses.
- Return:
- The conversation proceeds to the next block based on the button selected.
- The value of the selected button is returned.
3. Conditional Block
Section titled “3. Conditional Block”The Conditional Block controls the conversational flow based on a set of conditions.
- Type:
CONDITIONAL - Configuration:
isActive: Enable or disable the block.conditions: An array of conditions, each with a variable, an operator (e.g., equals, contains), and a value to compare against.defaultPath: A fallback path to follow if none of the conditions are met.
- Return:
- If a condition is met, the conversation proceeds to the block associated with that condition.
- If no conditions are met, the conversation follows the
defaultPathto the fallback block.
4. User Input Block
Section titled “4. User Input Block”The User Input Block is used to collect information from the user.
- Type:
ACTION - Configuration:
isActive: Enable or disable the block.inputType: The type of input to collect (e.g., text, email, phone, number, date).placeholder: Guide text to display in the input field.validation: Rules to validate the user’s input (e.g., required, minLength, maxLength).saveInputAs: A variable name to store the user’s input for later use.
- Return:
- The validated user input is passed to the next block.
- The input is saved as a variable that can be used in subsequent blocks.
5. API Call Block (Beta)
Section titled “5. API Call Block (Beta)”The API Call Block allows you to make requests to external APIs.
- Type:
ACTION - Configuration:
isActive: Enable or disable the block.url: The API endpoint to call.method: The HTTP method to use (GET, POST, PUT, DELETE).headers: Configure any necessary HTTP headers.body: Configure the request body for POST, PUT requests.responseVariable: A variable name to store the API response.
- Return:
- By default, the conversation proceeds to the next block.
- The API response is saved as a variable that can be used in subsequent blocks.
Block Implementation
Section titled “Block Implementation”Blocks are connected within a Template to create a conversational flow. The TemplateBlock model manages the relationship between blocks and templates with the following properties:
configuration: Block-specific settings that can override the default block configuration.order: The position of the block in the template’s sequence.condition: Logic that determines when the block should be triggered.display_name: A custom name for the block instance within the template, making it easier to identify.