Example of passing a value between bots
- Updated: 2023/10/17
Example of passing a value between bots
Learn how to pass a value from one Task Bot to another by using a dictionary variable.
Build a parent Task Bot and a child Task Bot that do the
following:
- The parent bot prompts the user to enter a song title and passes it to the child bot.
- The child bot takes the input string and returns a new string to the parent bot.
- The parent bot receives the string that the child bot passes as a dictionary.
Procedure
-
Build a child bot.
- From the Control Room interface, go to the Automation tab.
- Click .
- Enter the name for the bot as GetSongDetails.
- Click Create and Edit.
-
Create a variable named sMySong.
- In the Variables panel, click the Create variable button.
- In Type, select String if it is not already selected.
- In Name, enter sMySong.
- Select the Use as input and Use as output check boxes.
- Click Create.
-
To build a return string, use the
action.
-
Build the parent bot.
- Create a variable named sMySong.
-
Use the action to capture a song title.
- From the Actions panel, find and add the action to the parent bot flow.
- In the Prompt window caption field, enter Favorite Song.
- In the Prompt message field, enter Type the title of your favorite song.
- In the Assign the value to a variable field, enter sMySong.
- Click Save.
-
Use the action to call the child bot:
- From the Actions panel, find and add the action to the parent bot flow.
- In Task Bot to run, select Control Room and then click Choose.
- Click Browse and navigate to the folder that contains the child bot and select GetSongDetails.
- In Input values, select Set sMySong and then enter $sMySong$ in the variable field.
- In Save the outcome to a variable (option), select Dictionary and then create a variable named dOutput.
- Click Save.
-
Use the Message box
action to display the string that the child bot
returns.
-
Test the bot.