These docs are for v0.0.1. Click to read the latest docs for v1.0.61.

Agent and Engagement API

API definition

Agent and Engagement Events 0.1.1 documentation

Contact Center Agent and Engagement events are available for the streaming needs of client applications via websockets. The Notification API facilitates subscribing to different families of events and transport protocols (Websockets and Webhooks). Agent & Engagement are one of these available families.
This following focuses on the websocket implementation of Agent and Engagement events.

Create Subscription

The example provided below will create a subscription for a WebSocket stream of Agent & Engagement events. Upon a successful response a transport endpoint URL will be provided for the WebSocket interface to connect and begin consuming events from.

  POST https://{{CCaaS_FQDN}}/api/notification/v1beta/accounts/{accountId}/subscriptions
  Content-Type: application/json
  Accept: application/json
  Header: Authorization: Bearer {{token}}

Request Body:

    {
      "family": "AGENT_ENGAGEMENT",
      "events": ["ALL"],
      "transport": {
        "type": "WEBSOCKET"
      }
    }

Response:

    {
      "subscriptionId": "fdbec917-e76e-4645-8120-4eac46f29487",
      "createdAt": "2020-08-01T14:25:23.162Z",
      "expiresAt": "2020-08-01T15:25:23.177Z",
      "expiresIn": 900,
      "status": "ACTIVE",
      "family": "AGENT_ENGAGEMENT",
      "events": [
        "ALL"
      ],
      "transport": {
        "type": "WEBSOCKET",
        "endpoint": "wss://uk.cc.avayacloud.com/ws/notification/v1beta/agent-engagement",
        "pingInterval": 300
      }
    }

As you have seen above agent and engagement events are subscribed to via the Notification API. In choosing WEBSOCKET as the transport option these events are then consumed through a WebSocket connection. The events are contained within JSON that makes up the payload of the WebSocket messages.
The following section shows how to use the Websocket interface.

Table of Contents

Servers

production Server

URLProtocolDescription
wss://{server}:{port}/ws/notificationwssAfter connection to the websocket a new session is created.

URL Variables

NameDefault valuePossible valuesDescription
serverHOST-REGION.avayacloud.comAny-
port443443Secure connection (TLS) is available through port 443.

Security Requirements

TypeInNameSchemeFormatDescription
oauth2-----

Channels

/v1beta/agent-engagement Channel

publish Operation

Upon creating a subscription and connecting to the WebSocket endpoint you will need to send a message to the server confirming you are authenticated before any notification events will be sent. This token must be obtained from the A&A service.

NOTE: For further details and code examples please refer to: How to Authenticate with Avaya Experience Platform™ APIs

Accepts one of the following messages:

Message authentication

The first message the client should send to server after establishing the connection must be an authentication message.

Payload
NameTypeDescriptionAccepted values
event (required)stringauthentication - A constant parameter.Any
subscriptionId (required)stringThe unique id of the subscription.Any
token (required)stringThe access token string as issued by the authorization server.Any

Examples of payload (generated)

{
  "event": "authentication",
  "subscriptionId": "fdbec917-e76e-4645-8120-4eac46f29487",
  "token": "7e0cd42a22b451701fg29c3bde214…"
}
Tags
  • Authentication
Message ping

Client must send ping to the server in order to determine whether connection is alive, server responds with pong.
The ping is also used to keep the websocket connection alive, by keep sending ping messages every pingInterval time to the server.

It is recommended the client send ping more frequently (every 30 seconds) to preclude any proxies from closing the connection.

Payload
NameTypeDescriptionAccepted values
event (required)stringping - A constant parameter.Any
subscriptionIdstringOptional. The id of the subscription.Any

Examples of payload

pingMessage

Example of an ping message to server.

{
  "event": "ping"
}
Tags
  • Heartbeat

subscribe Operation

Notification messages that you receive from the server

Accepts one of the following messages:

Message notification

Notification event consumed over the WebSocket connection

Payload
NameTypeDescriptionAccepted values
correlationIdstringThe unique ID of the notification being sentAny
subscriptionIdstringThe unique ID of the Agent and Engagement subscriptionAny
familystringThe family of events the subscription is forAny
sentAtstringDatetime (in ISO 8601 format) of when the notification event was sentAny
accountIdstringThe unique identifier for the Account.Any
loginIdstringThe unique login handle for the Agent.
NOTE Only present on Agent related eventsAny
initiatingLoginIdstringThe unique login handle for the Agent initiating a transfer.
NOTE Only present on Single Step Transfer related eventsAny
destinationLoginIdstringThe unique login handle for the Agent the transfer is being made to.
NOTE Only present on Single Step Transfer to User related eventsAny
bodyobjectoneOfThe raw event payload that will be different based on the event.Any
body.0object-Any
body.0.agentIdstringThe unique identifier for the AgentAny
body.0.profileIdstringThe profile ID used to login the agent. The profile indicates what channels should be logged in.Any
body.0.statestringThe current state of the agent.LOGGED_IN, LOGGED_OUT, READY, NOT_READY
body.0.reasonCodestringThe reason code for going not ready. Only for AGENT_NOT_READY stateAny
body.0.causestringThe cause of the agent not being ready. Only for AGENT_NOT_READY stateAny
body.0.idstringEach event has its own unique IDAny
body.0.timestampstringTimestamp (milliseconds since epoch) when the event was generatedAny
body.1object-Any
body.1.engagementIdstringThe unique identifier for this engagementAny
body.1.channelProviderIdstringThe unique identifier for this engagement providerAny
body.1.connectionIdstringThe unique identifier for this appearance of this specific participant on the engagementAny
body.1.actionstringThe agent participant actionADDED, HELD, UNHELD, INVITED, REMOVED
body.1.agentIdstringThe unique identifier for the AgentAny
body.1.dialogIdstringThe identifier for the dialog. NOTE this will equate to the UCID created by the ASBCE for an inbound callAny
body.1.extensionstringThe extension/line of the agentAny
body.1.channelIdstringThe channel ID which represents the media typeAny
body.1.providerEngagementIdstringThe provider-native identifier for the engagementAny
body.1.agentInitiatedDisconnectbooleanAn indication if the agent initiated disconnect from the dialog. Only for REMOVED actionAny
body.1.idstringEach event has its own unique IDAny
body.1.timestampstringTimestamp (milliseconds since epoch) when the event was generatedAny
body.2object-Any
body.2.engagementIdstringThe unique identifier for this engagementAny
body.2.channelProviderIdstringThe unique identifier for this engagement providerAny
body.2.automationParticipantIdstringThe unique identifier for the automation participantAny
body.2.actionstringThe automation participant actionADDED, REMOVED
body.2.dialogIdstringThe identifier for the dialog. NOTE this will equate to the UCID created by the ASBCE for an inbound callAny
body.2.automationTypestringThe type of automation being addedAny
body.2.connectionIdstringThe unique identifier for this appearance of this specific participant on the engagementAny
body.2.channelIdstringThe channel ID which represents the media typeAny
body.2.providerEngagementIdstringThe provider-native identifier for the engagementAny
body.2.automationInitiatedDisconnectbooleanAn indication if the automation participant initiated disconnect from the dialogAny
body.2.idstringEach event has its own unique IDAny
body.2.timestampstringTimestamp (milliseconds since epoch) when the event was generatedAny
body.3object-Any
body.3.engagementIdstringThe unique identifier for this engagementAny
body.3.channelProviderIdstringThe unique identifier for this engagement providerAny
body.3.externalParticipantIdstringThe Channel Provider's identifier for this external participant (aka the Customer)Any
body.3.actionstringThe external participant actionADDED, REMOVED, INVITED
body.3.connectionIdstringThe unique identifier for this appearance of this specific participant on the engagementAny
body.3.dialogIdstringThe identifier for the dialog. NOTE this will equate to the UCID created by the ASBCE for an inbound callAny
body.3.channelIdstringThe channel ID which represents the media typeAny
body.3.providerEngagementIdstringThe provider-native identifier for the engagementAny
body.3.externalParticipantInitiatedDisconnectbooleanAn indication if the external participant (aka the Customer) initiated disconnect from the dialogAny
body.3.idstringEach event has its own unique IDAny
body.3.timestampstringTimestamp (milliseconds since epoch) when the event was generatedAny
body.4object-Any
body.4.engagementIdstringThe unique identifier for this engagementAny
body.4.dialogIdstringThe identifier for the dialog. NOTE this will equate to the UCID created by the ASBCE for an inbound callAny
body.4.orchestrationFlowstringThe orchestration flow name that should be used for this engagementAny
body.4.attributesarrayobjectA list of Category and Values identified for routing the callAny
body.4.attributes.categorystringA category for routingAny
body.4.attributes.valuesarraystringA list of values specific to the categoryAny
body.4.attributeListarraystringA simplified flat list of attributes
NOTE this flat array of attributes will help to easily identify “System.Outbound” to represent a POM callAny
body.4.engagementParametersobjectAdditional information that could be tagged on an engagementAny
body.4.agentRoutingStrategyobjectAgent routing strategy configurationAny
body.4.agentRoutingStrategy.typestringLAR: last Agent routing, PAR: preferred Agent RoutingLAR, PAR
body.4.agentRoutingStrategy.waitTimeintegerWait time in minutes before default routing is appliedAny
body.4.adhocEmailbooleanFlag to determine if adhoc email or not (email routing only)Any
body.4.autoResponsestringThe auto response suggested to be usedAny
body.4.channelProviderIdstringThe unique identifier for this engagement providerAny
body.4.channelIdstringThe channel ID which represents the media typeAny
body.4.channelIdentifierstringThe channel identifier of the engagementAny
body.4.queueobjectThe queue detailsAny
body.4.queue.queueIdintegerThe unique identifier of the queueAny
body.4.queue.queueNameintegerThe name of the queueAny
body.4.queue.priorityintegerThe priority of the queueAny
body.4.queue.proficiencyRangeMinintegerThe minimum proficiency of the queueAny
body.4.queue.proficiencyRangeMaxintegerThe maximum proficiency of the queueAny
body.4.customerIdentifiersobjectA set of attributes used to identify the customer if any are known at engagement creation.
NOTE: the list of Customer Identifiers is configurable per account so expect this to be dynamic per customer. This will include all known customer identifiers, but some customers may have more or less collected than others.'Any
body.4.customerIdentifiers.phoneNumbersarraystring-Any
body.4.customerIdentifiers.emailAddressesarraystring-Any
body.4.customerIdentifiers.accountIdsarraystring-Any
body.4.externalParticipantIdstringThe Channel Provider's identifier for this external participant (aka the Customer)Any
body.4.sourceAddressstringThe source address of the external participant, e.g. calling number or customer emailAny
body.4.destinationAddressstringDestination number or uriAny
body.4.subjectstringThe subject field of the incoming emailAny
body.4.idstringEach event has its own unique IDAny
body.4.timestampstringTimestamp (milliseconds since epoch) when the event was generatedAny
body.5object-Any
body.5.engagementIdstringThe unique identifier for this engagementAny
body.5.channelProviderIdstringThe unique identifier for this engagement providerAny
body.5.connectionIdstringThe unique identifier for this appearance of this specific participant on the engagementAny
body.5.externalParticipantIdstringThe Channel Provider's identifier for this external participant (aka the Customer)Any
body.5.dialogIdstringThe identifier for the dialog. NOTE this will equate to the UCID created by the ASBCE for an inbound callAny
body.5.callingNumberstringThe calling number of the external participantAny
body.5.dialledNumberstringThe original dialed number for the engagementAny
body.5.channelIdstringThe channel ID which represents the media typeAny
body.5.customerIdentifiersobjectA set of attributes used to identify the customer if any are known at engagement creation.
NOTE: the list of Customer Identifiers is configurable per account so expect this to be dynamic per customer. This will include all known customer identifiers, but some customers may have more or less collected than others.'Any
body.5.customerIdentifiers.phoneNumbersarraystring-Any
body.5.customerIdentifiers.emailAddressesarraystring-Any
body.5.customerIdentifiers.accountIdsarraystring-Any
body.5.providerEngagementIdstringThe provider-native identifier for the engagementAny
body.5.engagementParametersobjectAdditional information that could be tagged on an engagementAny
body.5.idstringEach event has its own unique IDAny
body.5.timestampstringTimestamp (milliseconds since epoch) when the event was generatedAny
body.6object-Any
body.6.engagementIdstringThe unique identifier for this engagementAny
body.6.matchIdstringThe unique identifier for this matchAny
body.6.correlationIdstringThe correlation Id from the original match request (can be ignored)Any
body.6.strategystringThe agent selection strategy used for this match (values include MOST_IDLE or OCCUPANCY)MOST_IDLE, OCCUPANCY
body.6.offeredQueueobjectThe offered queue details including offered agentAny
body.6.offeredQueue.queueIdintegerThe unique identifier of this queueAny
body.6.offeredQueue.channelIdintegerThe channel of this queueAny
body.6.offeredQueue.priorityintegerThe priority of this serviceAny
body.6.offeredQueue.rankintegerThe rank of this serviceAny
body.6.offeredQueue.proficiencyRangeMinintegerThe minimum proficiency of this serviceAny
body.6.offeredQueue.proficiencyRangeMaxintegerThe maximum proficiency of this serviceAny
body.6.offeredQueue.attributesarrayobjectA list of Category and Values identified for routing the callAny
body.6.offeredQueue.attributes.categorystringA category for routingAny
body.6.offeredQueue.attributes.valuesarraystringA list of values specific to the categoryAny
body.6.offeredQueue.offeredAgentDataobjectDetails about the agentAny
body.6.offeredQueue.offeredAgentData.agentIdstringThe unique identifier for the AgentAny
body.6.offeredQueue.offeredAgentData.providerAgentIdstringThe provider agent id of the offered agentAny
body.6.offeredQueue.offeredAgentData.channelProviderIdstringThe unique identifier for this engagement providerAny
body.6.offeredQueue.offeredAgentData.channelIdstringThe channel ID which represents the media typeAny
body.6.offeredQueue.offeredAgentData.channelProviderAddressstringThe address of the engagement providerAny
body.6.offeredQueue.offeredAgentData.providerAgentAddressstringThe address of the agentAny
body.6.offeredServiceobjectDetails about the service offered including the offered agentAny
body.6.offeredService.priorityintegerThe priority of this serviceAny
body.6.offeredService.rankintegerThe rank of this serviceAny
body.6.offeredService.proficiencyRangeMinintegerThe minimum proficiency of this serviceAny
body.6.offeredService.proficiencyRangeMaxintegerThe maximum proficiency of this serviceAny
body.6.offeredService.attributesarrayobjectA list of Category and Values identified for routing the callAny
body.6.offeredService.attributes.categorystringA category for routingAny
body.6.offeredService.attributes.valuesarraystringA list of values specific to the categoryAny
body.6.offeredService.offeredAgentDataobjectDetails about the agentAny
body.6.offeredService.offeredAgentData.agentIdstringThe unique identifier for the AgentAny
body.6.offeredService.offeredAgentData.providerAgentIdstringThe provider agent id of the offered agentAny
body.6.offeredService.offeredAgentData.channelProviderIdstringThe unique identifier for this engagement providerAny
body.6.offeredService.offeredAgentData.channelIdstringThe channel ID which represents the media typeAny
body.6.offeredService.offeredAgentData.channelProviderAddressstringThe address of the engagement providerAny
body.6.offeredService.offeredAgentData.providerAgentAddressstringThe address of the agentAny
body.6.offeredSpecifiedAgentobjectDetails about the agent specified in the match requestAny
body.6.offeredSpecifiedAgent.rankintegerThe rank of this agentAny
body.6.offeredSpecifiedAgent.offeredSpecifiedAgentDataobject-Any
body.6.offeredSpecifiedAgent.offeredSpecifiedAgentData.agentIdstringThe unique identifier for the AgentAny
body.6.offeredSpecifiedAgent.offeredSpecifiedAgentData.providerAgentIdstringThe provider agent id of the offered agentAny
body.6.offeredSpecifiedAgent.offeredSpecifiedAgentData.channelProviderIdstringThe unique identifier for this engagement providerAny
body.6.offeredSpecifiedAgent.offeredSpecifiedAgentData.channelIdstringThe channel ID which represents the media typeAny
body.6.offeredSpecifiedAgent.offeredSpecifiedAgentData.channelProviderAddressstringThe address of the engagement providerAny
body.6.offeredSpecifiedAgent.offeredSpecifiedAgentData.providerAgentAddressstringThe address of the agentAny
body.6.idstringEach event has its own unique IDAny
body.6.timestampstringTimestamp (milliseconds since epoch) when the event was generatedAny
body.7object-Any
body.7.engagementIdstringThe unique identifier for this engagementAny
body.7.agentIdstringThe unique identifier for the AgentAny
body.7.dialogIdstringThe identifier for the dialog. NOTE this will equate to the UCID created by the ASBCE for an inbound callAny
body.7.destinationAddressstringDestination number or uriAny
body.7.channelProviderIdstringThe unique identifier for this engagement providerAny
body.7.channelIdstringThe channel ID which represents the media typeAny
body.7.customerIdentifiersobjectA set of attributes used to identify the customer if any are known at engagement creation.
NOTE: the list of Customer Identifiers is configurable per account so expect this to be dynamic per customer. This will include all known customer identifiers, but some customers may have more or less collected than others.'Any
body.7.customerIdentifiers.phoneNumbersarraystring-Any
body.7.customerIdentifiers.emailAddressesarraystring-Any
body.7.customerIdentifiers.accountIdsarraystring-Any
body.7.engagementParametersobjectAdditional information that could be tagged on an engagementAny
body.7.idstringEach event has its own unique IDAny
body.7.timestampstringTimestamp (milliseconds since epoch) when the event was generatedAny
body.8object-Any
body.8.engagementIdstringThe unique identifier for this engagementAny
body.8.initiatingAgentIdstringThe unique identifier for the agent that initiated the transferAny
body.8.transferTostringThe type of the transferQUEUE, USER, AUTOMATION, EXTERNAL
body.8.destinationstringContains different values accordingly to transferTo: - If transferTo is QUEUE, then returns the queueId - If transferTo is USER, then returns the destinationAgentId - If transferTo is AUTOMATION, then returns the ivrAddress - If transferTo is EXTERNAL, then returns the externalAddressAny
body.8.queueIdstringThe destination queue identifier for the transfer or the fallback queue in the event destination agent is not availableAny
body.8.queueNamestringThe destination queue name of the transfer or the fallback queue in the event destination agent is not availableAny
body.8.channelProviderIdstringThe unique identifier for this engagement providerAny
body.8.connectionIdstringThe unique identifier for this appearance of this specific participant on the engagementAny
body.8.dialogIdstringThe identifier for the dialog. NOTE this will equate to the UCID created by the ASBCE for an inbound callAny
body.8.providerDialogIdstringThe unique identifier of the dialog generated by providerAny
body.8.channelIdstringThe channel ID which represents the media typeAny
body.8.correlationIdstringThe correlationId for the request. This should be referenced when notifying a related errorAny
body.8.timestampstringTimestamp (milliseconds since epoch) when the event was generatedAny
body.9object-Any
body.9.engagementIdstringThe unique identifier for this engagementAny
body.9.initiatingAgentIdstringThe unique identifier for the agent that initiated the transferAny
body.9.transferTostringThe type of the transferQUEUE, USER, AUTOMATION, EXTERNAL
body.9.errorTypestringThe type of the errorCANCELLED, FAILED
body.9.destinationstringContains different values accordingly to transferTo:
  • If transferTo is QUEUE, then returns the queueId
  • If transferTo is USER, then returns the destinationAgentId
  • If transferTo is AUTOMATION, then returns the ivrAddress
  • If transferTo is EXTERNAL, then returns the externalAddress | Any |
    | body.9.dialogId | string | The identifier for the dialog. NOTE this will equate to the UCID created by the ASBCE for an inbound call | Any |
    | body.9.channelProviderId | string | The unique identifier for this engagement provider | Any |
    | body.9.channelId | string | The channel ID which represents the media type | Any |
    | body.9.correlationId | string | The correlationId for the request. This should be referenced when notifying a related error | Any |
    | body.9.title | string | The error description | Any |
    | body.9.detail | string | The cause of the error | Any |
    | body.9.id | string | Each event has its own unique ID | Any |
    | body.9.timestamp | string | Timestamp (milliseconds since epoch) when the event was generated | Any |
    | body.event | string | The name of the specific event being sent. For instance AgentState, AgentParticipant, InboundEngagementCreated, etc... | Any |

Examples of payload (generated)

{
  "correlationId": "a425851d-5225-4b76-8ca0-4fa31ecfd5db",
  "subscriptionId": "fdbec917-e76e-4645-8120-4eac46f29487",
  "family": "AGENT_ENGAGEMENT",
  "sentAt": "2020-08-24T08:20:23.395Z",
  "accountId": "DYNNUG",
  "loginId": "[email protected]",
  "body": {
    "event": "AgentState",
    "agentId": "4a785201-73b8-4842-abf7-36f5e572d310",
    "profileId": "HomeProfile",
    "state": "NOT_READY",
    "reasonCode": 514,
    "cause": "RONA",
    "id": "d3c8400d-c44f-4451-8316-e75c4efb8bb2",
    "timestamp": 9223372036854776000
  }
}
Tags
  • Agent and Engagement Data
Message pong

Server pong response to a ping message.

Payload
NameTypeDescriptionAccepted values
event (required)stringpong - A constant parameter.Any

Examples of payload

pongMessage

Example of a pong message to client.

{
  "event": "pong"
}
Tags
  • Heartbeat
Message authenticationResponse

Authentication response message sent to the client after websocket authentication.

Payload
NameTypeDescriptionAccepted values
eventstringauthenticationResponse - A constant parameter.Any
statusstringYou will then receive 1 of 5 statuses:
  • CONNECTION_CONFIRMED: Connection was confirmed
  • CONNECTION_FAILED_INVALID_TOKEN: Authentication token is invalid
  • CONNECTION_FAILED_UNKNOWN_SUBSCRIPTION: Unknown Subscription, can be for a subscription that never existed or one that is no longer active
  • CONNECTION_FAILED_INTERNAL_SERVER_ERROR: Server Error, client can retry later
  • CONNECTIONFAILED_CONSTRAINT_VIOLATION: Client issue, malformed client request, client must update payload and rerty | CONNECTION_CONFIRMED, CONNECTION_FAILED_INVALID_TOKEN, CONNECTION_FAILED_UNKNOWN_SUBSCRIPTION, CONNECTION_FAILED_INTERNAL_SERVER_ERROR, CONNECTION_FAILED_CONSTRAINT_VIOLATION |
    | subscriptionId | string | The unique id of the subscription. | _Any
    |
    | pingInterval | integer | The maximum interval (seconds) at which a ping is expected to be sent by the client before websocket is closed and subscription set to INACTIVE.

It is recommended the client send ping more frequently (every 30 seconds) to preclude any proxies from closing the connection. | Any |
| expiresInterval | integer | Expiration interval in seconds before the subscription is set to INACTIVE. | Any |

Examples of payload (generated)

{
  "event": "authenticationResponse",
  "status": "CONNECTION_CONFIRMED",
  "subscriptionId": "fdbec917-e76e-4645-8120-4eac46f29487",
  "pingInterval": 300,
  "expiresInterval": 900
}
Tags
  • Authentication