Importing Sb-Intents (Syncing with Lex)

In this tutorial we will import 1000 intents into ServisBOT and sync them with Lex.

Prerequisites

The following items are required before importing intent and actions into the ServisBOT platform.

  1. Valid AWS credentials with the following Lex permissions.
    • lex:GetBot
    • lex:GetBotAlias
    • lex:GetIntent
    • lex:CreateBotVersion
    • lex:CreateIntentVersion
    • lex:PutBot
    • lex:PutBotAlias
    • lex:PutIntent
  2. A ServisBot AWS Secret containing the accessKeyId, secretAccessKey and region of the previous step.

Create your bots

For this demo, use the Lex Bot blueprint.

Define Your Bot’s Intents

Take note of your bot’s name in the system and then use our common definition format to define the intents, utterances, and actions.

eg. utterances.csv

bot, intent, utterance
Sbimport, welcome, hi
Sbimport, welcome, hello
Sbimport, welcome, hey
Sbimport, howAreYou, how are you
Sbimport, howAreYou, sup
Sbimport, howAreYou, how are u
Sbimport, botimport, how does the intent import work
Sbimport, botimport, what does the import function look like
Sbimport, botimport, How do I import intents

Sample Utterance File

Actions are expected to be in the following CSV file format.

eg. actions.csv

bot, intent,lifecycleTrigger ,type , value
Sbimport, welcome, fulfilment, message, hi!
Sbimport, howAreYou, fulfilment, markup, "<TimelineMessage>\n\t<Card title='Im doing great!' imgUrl='https://picsum.photos/250/250/?random&amp;g' alt='Lovely image' />\n</TimelineMessage>"
Sbimport, botimport, fulfilment ,message ,You first set up your csvs for intents and for actions then import them

Columns

Column Label Required Default Notes
bot True the botname for the bot you are assigning it to
intent True the intent alias you want to set an action for
lifecycleTrigger False fulfilment Whether you want your action to be triggered when the intent is detected (but slots are still pending) Detection, or once an intent is ready to be fullfilled.
value True the value of the response


Sample Action File

lifecycleTrigger and type are optional columns. Everything defaults to “Fulfillment” and “message”

Import Your intents

You can use either the Portal or the ServisBOT CLI to import your intents.

Importing through the Portal

In the Intent tab of each Bot page you can use the Import Intent button to upload your utterance and action CSV files.

Importing through the CLI

“botName” relates to the name of the ServisBOT bot that you created - not the name of your AWS Lex Bot. “utterances.csv” and “actions.csv” can be supplied as the directory path to each associated file.

sb-cli intent import utterances.csv actions.csv

Available in version 2.11.1 and later

After importing intents, you should be able to see your intents by navigating back to your bot detail pages, and exploring the Intents Tab.

Play and Test

  1. Navigate to your bot in the Bot Army Section of portal
  2. At the top of the bot detail page, click on the Publish button
  3. Wait for the Your bot has been successfully published, click on the Test button
  4. Once you are on the test page, you can interact with your bot.