BotNet Actions

BotNet Actions provide bot builders access to provisioned API connectors, CMS content, co-browsing commands, universal timeline elements, bot orchestration, NLP, and analytics. This provides a rich bot building space, decoupled from the outside world. When a user enters an utterance and the corresponding intent is detected, the botnet action will automatically be triggered.

Available actions

  • Send Message: sends a plaintext response
  • Markup: allows you to enhance your messages by adding advanced visual elements.
  • Call an API: calls on an API that you have already created in the API Connectors section on portal
  • Trigger an Action Flow: an action flow allows you to apply a specific flow to a given intent. when an intent with an action flow is triggered, the bot will complete the actions in the flow automatically.
  • Trigger a Goal: allows you to see how many users get to that part of the flow. The goal node does not interfere with the flow itself
  • Host Notification: sends a host notification to the embedding application
  • Send CMS content: sends content that you have stored in CMS
  • Send Message Variant: takes a list of messages and randomly selects one to send to the user at runtime.
  • Push Bot to Stack: transfers control to another bot or worker. When the next bot calls botMissionDone, the conversation will return to the original bot.
  • Transfer to a Bot: transfers control to another bot. Control will stay with the other bot unless it is intentionally returned.
  • Set Context: merges json data into the conversational context so that custom information can be stored

Example Actions

[
  {
    "type": "executeApi",
    "value": "apiFindSourceAccountByAccountNumber2",
  },
  {
    "type": "flow",
    "value": {
      "id": "my-flow-id",
      "type": "r2-avalanche-worker",
      "deferRelease": true
    },
  },
  {
    "type": "markup",
    "value":"<TimelineMessage> <TextMsg>hello</TextMsg></TimelineMessage>"
  },
  {
    "type": "message",
    "value":"hello"
  },
  {
    "type": "messageVariance",
    "value": ["hello", "hola", "howdy"]
  },
  {
    "type": "pushBotToStack",
    "value": "bot-name"
  },
  {
    "type": "transferToBot",
    "value": "bot-name"
  },
  {
    "type": "setContext",
    "value": { "name": "ServisBot" } //Context to set
  }
  {
    "type": "goal",
    "value":"goal-name"
  },
    {
    "type": "hostNotification",
    "value":"notification to send"
  }
]

Action Flow

It is possible to trigger a flow as a botnet action. When the flow is triggered, the bot will complete the actions within that flow automatically. The best place to use this feature is in fulfillment for an intent.

In the json examples above, you can see the field deferRelease.When you have the deferRelease set to true you need to use the action complete node to remove this flow from the bot’s worker stack. Input to the bot will continue to be sent to this action flow until it is removed from the top of the worker stack.

How it works

When an intent with an action flow is triggered, the bot will refocus on that specific action flow until it is completed. This means that any messages that come in to the bot will go to that flow. All context for the original bot will be included. There are 2 nodes in the classic flow worker associated with an action flow:

  • actionStart
  • actionComplete

Note that the context is not passed back to the ServisBOT intent worker once the flow has completed its task.

Accessing Context in an Action Flow

You will have access to any existing context collected thus far at this point plus the following two pieces of information:

  1. The intent used to trigger this action flow (triggeredIntent)
  2. The message from the user that triggered the action flow (msg.payload.user.message)

An example of using the triggered intent is shown below:

Limitations

  1. Works best for synchronous requests.
  2. Only supported in the ServisBOT intent and flow worker.
  3. Only supported as a fulfillment action.
  4. Context is only one way, doesn’t return.
  5. The release/lock needs to be deferred inside the worker.

Examples

const organization = 'flowit';
const messageContext = {
  some:'context',
  you:'want',
  to:'pass'
}
const actions = [
  {
    Type: 'flow',
    value: { id: 'my-flow-id', type: 'r2-avalanche-worker', deferRelease: true },
  }
]


await botnet.performActions(organization, messageContext, actions)

Data object of BI worker, the flow action is in the actions, section under fulfillment.

{
    "orchestrator": {
      "businessIntent": {
        "name": "passwordReset",
        "businessRules": [...],
        "api": {...},
        "businessSlots": [...],
        "successMessages": [...],
        "actions": {
          "fulfillment":[
            {
              "type": "flow",
              "value":{
                "type": "r2-avalanche-worker",
                "id":"worker-id"
              }
            }
          ]
        }
      },
      "responseVoice": {
        "type": "GenericAdvisorResponse"
      },
      "promptStrategy": {
        "type": "FlowStrategy"
      },
      "userIntents": []
    },
    "operator": {
      "aws": "some-secret",
      "type": "Lex",
      "templateBusinessIntentBotName": "botname"
    }
  }