Configuring a JSON response

If you are adding an integration that also needs to return a response to Sinch Contact Pro, you can find the options for configuring the JSON for the response 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.

Configuration:

{"priority": "{response.body.priority}"}
Expected (part of) response body data:
{
   "priority": "100"
}
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: unique agent identifier (UUID) or agent's chat address
  • For chats: agent's chat address

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

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 calls: unique agent identifier (UUID) or agent's chat address
  • For chats: agent's chat address

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

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 Direct calls (in) Direct calls (out)
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 Direct calls (in) Direct Calls (out)
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 Direct calls (in) Direct calls (out)
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 Direct calls (in) Direct calls (out)
Received 1
Queued
Allocated
Accepted
Rejected
Transferred 1
Forwarded
Ended
Abandoned

1 Only when the chat does not already have existing agent requirement(s) or preference based on incoming routing data from Sinch Conversation API.

Table 6. Save CAD
Event Chats (in) Chats (out) Calls (in) Calls (out)
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.