Botlets are the building blocks of a conversational flow. They contain part of the flow logic. They are reusable and can be chained together to create a more complex user experience. Actions are the chaining mechanism for botlets. This is what we call composability. Botlets and services can be connected together into a unified flow passing entity types. To reuse and chain botlets together, your botlet must be semantic. This means that its actions must be defined semantically to pass and consume entity types.

For more information about how to define actions for botlets and services, refer to the Services.

The steps that follow will guide you how to:

  • Create a botlet
  • Delete a botlet
  • Create an Action on a botlet
  • Define an Action to a botlet

Creating a Botlet

The steps that follow will guide you through how to create and delete a botlet from the Workspace Items Tree.

To create a botlet, refer to the steps below:

  1. In the Items Tree, click the Create new icon, and then click New item.
alternate text
  1. Click Botlet, and then click Create New.
alternate text
  1. Enter the Organization name.

Note: To create a botlet, you must have permissions to an organization in the Items tree. For more details about the different types of permissions, see: Permissions.

alternate text
  1. Enter a Name for your botlet.
Note: The botlet name may contain any combination of upper and lower-case letters as well as special symbols. You may modify the botlet ID by typing in the text field. Botlet IDs are automatically generated from the botlet name.
  1. (Optional) Enter a Botlet ID.
Note: The botlet ID is automatically generated with a botlet name. You can modify the botlet ID by typing in the field.
  1. Click to choose a Category, and then click Next.
Note: Pick a category from the drop-down menu that best describes your botlet. Categories are used for browsing and filtering search results in the Store.
  1. Type a brief description in the Description text box.
alternate text

Using an Image for a Botlet

You have the option to use an image for your botlet. To add an image to your botlet:

  1. Click Upload an image.
  2. Select the File name, and then click Open.
  3. Click Done.

An example of the newly created botlet in the Items tree is shown in the image below.

alternate text

Now that you have created a botlet, the code sample shown below contains the syntax for calling your botlet in the Semantic Conversation Language (SCL).

[CALL <botlet_id> [, action] [, <name>=<value>] [TIMEOUT <seconds>] [STORE <variable>]
[ON_ERROR [error_id] [, error_id]]

You can also make calls to botlets in using other languages such as C#, Python, Java Script, and other languages. For more details about SCL and to see additional code samples, see: Semantic Composition Language

For more details about Using C# code to consume an Azure App Service in a service botlet, refer to the tutorial Using C # Code in your Botlet Logic.

Deleting a Botlet

The steps below describe how to delete a botlet from an organization.

  1. In the Items Tree, click the name of the organization that contains the botlet you want to delete.
alternate text
  1. Next, select the botlet under the organization, and then click Delete.
alternate text
  1. Click Ok to confirm the deletion of the botlet.
alternate text

Creating an Action on a Botlet

An action to a botlet is the chaining interface. If you want your botlet to be chained together and called by other botlets, you need an interface to use them. Creating an action on a botlet is like creating an action on a web service. The only difference is the way it is defined inside the code.

To create an action on a botlet, refer to the steps below.

  1. In the Items Tree, click an organization, and then click a botlet.
  2. In the Control Panel, click the Actions menu tab.
alternate text
  1. Enter an Action name and write a Description, and then click Add.
Notes: The Action name field is a required field and is limited to 30 characters. The description field is optional. The Action ID field is auto-generated, but you can modify it.
  1. Click Save.

It is at this point that you can now start adding parameters to your botlet’s actions. Refer to the high-level steps below for details on how to add parameters to a botlet’s actions.

Adding Parameters

  1. Click Add Parameters.
  2. To add Input Parameters, click + New input parameter.
  1. Enter the input Parameter name, Entity type, description, and then click Add.
  1. To add Output Parameters, click + New output parameter.
  1. Enter the output Parameter name, Entity type, description, and then click Add.

Note: You need an action to be declared in your botlet code as well. Refer to the section Defining an Action on a Botlet for these details.

Defining an Action on a Botlet

If you want to define an action to a botlet, you need to declare it inside your code. As shown in the code sample below, you enter the Action name (e.g., find) in the beginning of code, and then you write the action logic:

find: (**Example – find: is the action name**)
SET location = INPUT.location
(Example - get Chinese restaurant) GO  find_internal

RETURN result=business
CALL "lyft.lyftclient", "action_composable_book_ride", to_location = resolved_locationELSELOG "in the else statement"RETURN result = None

Note: All the code listed under the action’s name constitutes the action’s logic.