Extra data

"Extra data" is an JSON-like container through which a bot can receive additional (non-required) data in the gateway request.

Defining extra_data in requests to the bot

When any platform (voice integrator, Whatsapp, Telegram etc.) interacts with Automate to provide bot experience to the users, it uses Automate's Gateway API. Besides required input fields, there is an extra_data input field there. API's user can write any object to it which will be sent to the bot with the rest of the request.

Each time a platform sends a request to the bot (or, in other words, each time the bot's user says or writes something), the request can contain new extra_data, providing the bot with additional custom data.

608

extra_data example

Accessing extra data with external

In Flows, extra data can be accessed using external object.

To access or print the whole extra data object, use external.

To access a specific property, use dot notation, eg. external.hotline_available.

Extra data availability

Received extra data is available throughout the whole session.

If the newly received extra_data property has the same key as one of the previously stored properties, it will overwrite it.

Mocking extra data

You can mock extra data for testing and debugging purposes in a chat-tester and Test suites.

{"working_hours": "8-18"}

Example

In the request to the bot via gateway, we received an extra_data object with two properties:

  • hotline_available informs if the bot owner's hotline is currently available and the user can be redirected to the consultant,
    system_failure informs if there is some system failure that will cause the bot to work in safe mode, not providing all of the services.
external

// Result:
{
  hotline_available: true,
  system_failure: false
}
if (external.system_failure = true) "Please call another time, we have temporary problems." else "Hello!

// Result for external.system_failure = false:
"Hello!"

What’s Next

Learn about Expression language: