Safe Exchange API

This page is about the Safe Exchange API in Ebbot. This API is for Ebbot chat only.

Safe Exchange API in Ebbot

Note: the Safe Exchange API in Ebbot is for chat only.

The Safe Exchange API is designed to securely inject sensitive data into an ongoing chat session.

Using the Safe Exchange API

Below is a step by step guide on the Safe Exchange API, how to set it up and use it effectively in Ebbot chat platform.

Inject sensitive data into an ongoing chat

  1. Fetch the Chat ID

This can be done when the information should be injected, for example when a user successfully logs in to the site. The chatId is required for the Safe Exchange API to know where the information should be injected.

  • When an Ebbot Chat widget is loaded on a web page, a unique chat ID is generated and saved in the client’s local storage.

  • Retrieve this chat ID from local storage. The key follows the format: <bot_id>_ebbot_chat_session_id.

  • You can find the botID in the Ebbot Chat platform.

  1. Performing the API call

Use the retrieved chat ID to make an API call to inject data. See API Call Details below.

  • Method & Endpoint: PUT https://<ebbot-url>/api/chats/<chatId>/vault

circle-exclamation
  • Authorization Headers: Include the API Key in the x-api-key header. This key can be generated in the Ebbot platform by navigating to: Settings -> Integrations -> API Keys

    Example format:

  • Payload: The data to be injected should be in JSON format.

    Example:

  • cURL Example:

  1. Listen to Chat Events

Your web page can listen to specific events in the chat widget using the Ebbot Chat widget API. This can help determine the appropriate time to inject data. See recommended events below:

  • onReset

  • onCreate

  • onStartConversation

Note: although the ChatWidgetAPI’s setUserAttribute function can also inject data into an ongoing chat, it's not recommended when dealing with sensitive information. This is due to security concerns of potential misuse through client browsers.

  1. Data Storage in Vault

  • Once injected, the data is stored in the vault section of the chat’s data object as key/value pairs.

  • You can access or expand these variables within the bot's responses using the format: {{ vault.key_name }}.

Last updated

Was this helpful?