Example: Fetch data from an external system and show it to the agent

In this example, we'll fetch customer data from an external system that can be, for example, a customer data platform (CDP) or customer relationship management (CRM) system.

The data will be visible to the agent in Communication Panel's Conversation Details extension.

For the response, see Configuring a JSON response.

Terminology

Several terms are used to refer to the data added to a conversation: CAD, contact/call attached data, attached data, and extra data. Communication Panel uses Attached Data. In System Configurator, the settings to configure attached data in the channel settings is Extra Data whereas IVR, reporting, and Visitor Intermediate Client API use Call Attached Data and CAD. Sinch Conversation API uses metadata.

Configuration

For this example integration, you'll need to configure the following:

  • Events: Received, Transferred, Forwarded
  • Conversation Direction: Inbound or Both (but will only apply to inbound)

    You can use this example for both inbound calls and chats.

  • Direct Conversations / Queues: You can use this example for both queue and direct calls and chats.

    For calls, you need to configure Extra Data Included When Allocating Calls in voice channel settings (System Management > Channels > Voice Channel > Extra Data Settings). For both calls and chats, if you want to store CAD in the database and show it in reports and the History view in Communication Panel, configure Extra Data Included in Statistics. For more information on extra data related settings, see Saving Extra Data.

  • JSON for Configuration:
    {
      "request": {
        "authentication": {
          "type": "basic"
        },
        "method": "GET",
        "headers": {
          "Accept": "application/json"
        },
        "params": {
          "phone": "{contact.source}"
        }
      },
      "response": {
        "save": {
          "customer_data": {
            "id": "{response.body.id}",
            "firstname": "{response.body.properties.firstname}",
            "lastname": "{response.body.properties.lastname}",
            "company": "{response.body.properties.company}",
            "jobtitle": "{response.body.properties.jobtitle}",
            "lastticket": "{response.body.tickets[-1].id}"
          }
        }
      }
    }

    This example uses basic authentication and the GET method for retrieving customer data based on a phone number. It will work on channels where the customer identifier is a phone number. The response saves the returned customer data (id, first name, last name, company, job title, and id of last ticket). This data will then be visible as conversation attached data (CAD) to the agent in Communication Panel's Conversation Details extension.