Configuring JSON response handling

If you are adding an integration that also needs to return a response to Sinch Contact Pro, you can find the options for configuring how the JSON response is handled in the tables below.

You can configure several operations in the same event-driven integration (for example, set preferred agent and save CAD).

Table 1. Response configuration
Name Parent object JSON data type Description Example values
set - object Parent object for set operation definitions -
priority set string

Specifies either the name of an element in the response JSON body or the name of a response header whose value should be used to set a new priority value for the associated contact

You can also use static values instead.

Expected value: an unsigned integer or a value convertible to an unsigned integer.

Response body data received:
{
   "priority": "100"
}

JSON configuration:

{"priority": "{response.body.priority}"}
queue set object
Specifies either the name of an element in the response JSON body or the name of a response header whose value should be used to set a new queue for the contact. The new queue can be specified using one of the following:
  • queue ID, with configuration object property name id

    Note: If the queue has several queue addresses, the system will use one of them randomly.
  • queue address, with configuration object property name address

Expected value:
  • For queue ID: a UUID string that matches the unique identifier of an existing queue with the conversation's channel type

  • For queue address: a string whose value matches a queue address of an existing queue with the conversation's channel type

UUID supports uppercase or lowercase, and can optionally include hyphens.

Configuration for:

{"id": "{response.body.queue.id}"}

Expected (part of) response body data:

{
   "queue": {
      "id": "C9177D585DA5EE11B3ED58961D1810CC"
   }
}

Configuration for:

{"address": "{response.body.queue.address}"}

Expected (part of) response body data:

{
   "queue": {
      "address": "chat.queue@acme.com"
   }
}
preferredAgent set object

Specifies either the name of an element in the response JSON body or the name of a response header whose value should be used to set the preferred agent for the contact.

Expected value: a non-empty string based on which an individual agent can be identified

This can be:
  • For calls: chat address or phone extension number
  • For chats: agent's chat address
  • For emails: agent's chat address or phone extension number

Configuration

{"preferredAgent": "{response.body.agent}"}

Expected (part of) response body data:

{
   "agent": "agent@acme.com"
}
requiredAgents set object

Specifies which parts of data within response payload should be extracted and used to set required agents and required agent timeout for the conversation.

Expected value: For the element containing required agent identifiers, the value is expected to be a list of non-empty strings where each string should contain data with which an individual agent can be identified.

This can be:
  • For chats: agent's chat address
  • For emails: agent's chat address or phone extension number

The value of the element containing required agent timeout is expected to be an unsigned integer or a value convertible to an unsigned integer. You can also use static values instead.

Configuration

Response payload contains an array of strings (chat addresses) and timeout:

{
  "requiredAgents": {
    "agents": "{response.body.agents}",
    "timeout": "{response.body.timeout}"
  }
}

Expected (part of) response body data:

{
   "agents": [
      "agent.1@acme.com",
      "agent.2@acme.com"
   ],
   "timeout": 60
}

Configuration

Response body contains an array of objects:

{
  "requiredAgents": {
    "agents": [
      "{response.body[0].address}",
      "{response.body[1].address}"
    ],
    "timeout": "90"
  }
}

Expected response body data:

[   
      {"id": "1", "address": "agent.1@acme.com"},
      {"id": "5", "address": "agent.5@acme.com"}
]
save - object

Specifies which parts of data within response payload should be extracted and added as contact CAD, and the structure for storing the data.

You can also use static values instead (or in conjunction with data extracted from response payload).

Data can be extracted from either response headers or response JSON body, and may also be configured to include, for example, request duration and response HTTP status code as debug information.

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

Supported events for operations

Table 2. Set priority
Event Chats (in) Chats (out) Queue calls (in) Direct calls (in) Direct calls (out) Emails
Received
Queued
Allocated
Accepted
Rejected
Transferred 1 1
Forwarded 1 1
Ended
Abandoned

1 Only when the event is the initial trigger event after successful internal call forward (by a queue) or transfer (by an agent).

Table 3. Set queue
Event Chats (in) Chats (out) Queue calls (in) Direct calls (in) Direct Calls (out) Emails
Received
Queued
Allocated
Accepted -
Rejected
Transferred 1
Forwarded 1
Ended
Abandoned

1 Only when the event is the initial trigger event after successful internal call forward (by a queue) or transfer (by an agent).

Table 4. Set preferred agent
Event Chats (in) Chats (out) Queue calls (in) Direct calls (in) Direct calls (out) Emails
Received
Queued
Allocated
Accepted
Rejected
Transferred 1
Forwarded 1
Ended
Abandoned -

1 Only when the event is the initial trigger event after successful internal call forward (by a queue) or transfer (by an agent).

Table 5. Set required agents
Event Chats (in) Chats (out) Queue calls (in) Direct calls (in) Direct calls (out) Emails
Received
Queued
Allocated
Accepted
Rejected
Transferred
Forwarded
Ended
Abandoned
Table 6. Save CAD
Event Chats (in) Chats (out) Calls (in) Calls (out) Emails
Received
Queued 2 2
Allocated
Accepted
Rejected
Transferred 1
Forwarded 1
Ended
Abandoned

: Saving CAD is fully supported. CAD is saved and shown in Communication Panel.

: Saving CAD is partially supported. CAD is saved but not shown in Communication Panel.

: Saving CAD is not supported.

1 Only when the event is the initial trigger event after successful internal call forward (by a queue) or transfer (by an agent).

2 CAD is still not shown in some specific cases, such as when the conversation is allocated to an agent immediately after arriving in the queue, and the agent accepts the offered conversation so that it doesn't return to the queue due to, for example, allocation timeout.

Priority of set operations in the Contact Pro system

The set operations defined with EDI have the highest priority in the Sinch Contact Pro system. This means that they overwrite potential corresponding operations from other contexts, such as:

Exceptions are:

  • Required agent(s) are never overwritten by preferred agents.

  • An email queue set by either email keyword rules or a Contact Center customizer always overrides any set queue operation of an event-driven integration.