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

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": "goal",
    "value":"goal-name"
  },
    {
    "type": "hostNotification",
    "value":"notification to send"
  }
]

Experimental feature, use with caution

Flow Action

Currently only supported in filter and business intent workers

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 refocusesthe 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.

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