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.

Available actions

  • Trigger a Flow
  • Execute a BaaS
  • Send a Response
  • Trigger a goal
  • Send Markup
  • Transfer to a bot
  • Push bot to stack
  • Set Context

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"
  }
]

Message Variance

Takes a list of messages and at runtime will randomly select one to send to the user

Flow Action

It is possible to trigger a flow as a botnet actionThe best place to use this feature is for fulfillment, it might work for elicitation but might not work as intended.

When you have the defer release set to true you need to use the action complete to remove this flow from the stack

How it works

It refocuses the bot on to a flow. 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 new nodes in the classic flow worker these are used specifically for this flow action.

  • actionStart
  • actionComplete

They setup the context that was passed and perform the necessary release/popWorkerFromBot. Right now the context is not passed back to the business intent worker once the flow has completed its task, this would be needed for the asynchronous actions.

The deferRelease option on the filter worker is whats used to figure out if we call release inside of the business intent worker logic. When this is true we don”t call release and leave it to the flow to do it.

Accessing Context in a Flow Action

You will have access to any existing context collected thus far at this point plus some extras. 1. The intent used to trigger this flow action (triggeredIntent) 2. The message from the user that triggered the flow action (message)

An example of using the triggered intent is shown below :

<TimelineMessage>
  <TextMsg>You triggered the ${context.triggeredIntent}</TextMsg>
</TimelineMessage>

Limitations

  1. Works best for synchronous requests
  2. Only supported in the business intent and flow worker
  3. Only supported as a fulfillment action
  4. Context is only one way, doesn”t return
  5. The release/lock need 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"
    }
  }