External Data

With xBrain custom communication protocol, the client can send data to the agent that will be accessible through Athena.

Sending data to the agent

To send data to the agent, you must send a custom message with key xbrain.session.data, following this schema:


{
    "key":"athenaVariableName",
    "value": "value"
}

The value contained in the xbrain.session.data message can be any json type

Example using the xBrain javascript client :


client.sendCustomMessage("xbrain.session.data", {
  key: "userInfo",
  value: {
      "userName":"John Doe"
  }
});

Using the data in Athena

Once the data has been sent to the agent, you can use directly in your agent, following this syntax:


? GET VALUE OF SESSION DATA
    - %myKey.myProperty

Following the previous example in Sending data to the agent :


? MY USER INFO
    - %userInfo.userName // will return 'John Doe'