Answers
Create a chatbot
Create rule-based chatbot

Create Rule-based Chatbot

This tutorial is an example of a simple rule-based chatbot. The tutorial is for a weather app and uses WhatsApp as the channel.

The tutorial is divided into the following sections.

  • Creating and configuring the chatbot
  • Designing the chatbot flow

For information about designing the chatbot flow, using entry points, and designing conversations, refer to the Guidelines and best practices section.

Create and Configure the Chatbot

  1. Log on to the Infobip web interface (opens in a new tab).
  2. In the menu the left, navigate to Answers > Chatbots.
  3. Click New chatbot.
  4. Click Start from scratch.
  5. In the Configure your chatbot screen, do the following:
    • Enter a name for the chatbot. Infobip recommends that you specify a unique name.
    • Select the required channel.
    • Define the sender account. You can do this any time before you activate the chatbot.
    • Choose the chatbot language.
    Answers Tutorial 1
  6. Click Create chatbot. The chatbot editor opens at the Dialogs tab.
  7. Go to the Keywords tab. Add words that end users are likely to use in their responses. These words enable your chatbot to understand how to route end users. Example: End users could ask about the forecast, wind speed, or precipitation. So, add these items as keywords. Answers Tutorial 3
  8. Go to the Attributes tab. Create the custom objects that capture and store responses from end users. Set the attribute type depending on the format in which you want to receive the responses. Example: Text, JSON, or XML. Answers Tutorial 4
  9. (Optional) To edit the chatbot configuration, add escape phrases, configure the chatbot timeout logic, and do other actions, go to the Settings tab. Answers Tutorial 2

Design the Flow

  1. Go to the Dialogs tab.

  2. By default, you will be in the Default dialog. Use this dialog for a greeting message, and to find out why the end user contacted the chatbot. Do the following.

    1. Rename this dialog to 'Start'.
    2. Drag and drop the Text element onto the editor. Enter a greeting message.
    3. Drag and drop the Reply button element under the Text element. Add buttons based on the keywords. Example: forecast, pollution, and something else. End users can choose one of these options. Set the Postback value to match the relevant keyword.
    Answers Tutorial 5
  3. Use the Add dialog option and add dialogs for each topic of conversation as required. These dialogs must correspond to the keywords that you configured. If the dialogs contain similar content and/or logic, create a base dialog and then use the duplicate option.

    Answers Tutorial 6
  4. Go to the Default dialog.

    1. Add the User Input element to process the response that the end user chooses in the Reply Button. Select the keywords that you added earlier. Answers Tutorial 8
    2. Drag and drop the To dialog element under each option of the User Input element to route the conversation to the relevant dialog. Example: For the keyword/user response 'forecast', direct the end user to the Forecast dialog.
    3. Add a fallback action for the User Input element so that the chatbot knows how to handle unrecognized inputs from the end user. Either select an existing dialog to fall back to or create a dedicated fallback dialog. Answers Tutorial 9
  5. Add a closing dialog to which you can redirect end users when they finish their query.

    1. Add a new dialog.
    2. Drag and drop the Text element and add a goodbye message to it.
    3. Drag and drop the Conditions element below the Text element. In the condition, set the lastReceivedMessage attribute tois not null.
    4. Drag and drop the To dialog element under the condition. Select a relevant dialog.
    5. Drag and drop the Close session element under Else. Answers Tutorial 7
  6. Configure additional dialogs based on their function. Example: The Forecast dialog makes a call to a weather app through API and saves the response to the dedicated attribute. Configure how to store the data from the response, either from headers or from the body. Add the relevant chatbot element to display the response in a readable format to end users.

    Answers Tutorial 10
  7. Route end users to the next steps in their conversation. Example: back to the main menu, or to the closing dialog.

Need assistance

Explore Infobip tutorials

Encountering issues

Contact our support

What's new? Check out

Release notes

Unsure about a term? See

Glossary

Research panel

Help shape the future of our products
Service Terms & ConditionsPrivacy policyTerms of use