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
URL | Protocol | Description |
---|---|---|
wss://{server}:{port}/ws/notification | wss | After connection to the websocket a new session is created. |
URL Variables
Name | Default value | Possible values | Description |
---|---|---|---|
server | HOST-REGION.avayacloud.com | Any | - |
port | 443 | 443 | Secure connection (TLS) is available through port 443. |
Security Requirements
Type | In | Name | Scheme | Format | Description |
---|---|---|---|---|---|
oauth2 | - | - | - | - | - |
Channels
/v1beta/agent-engagement Channel
publish
Operation
publish
OperationUpon 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
authentication
The first message the client should send to server after establishing the connection must be an authentication message.
Payload
Name | Type | Description | Accepted values |
---|---|---|---|
event (required) | string | authentication - A constant parameter. | Any |
subscriptionId (required) | string | The unique id of the subscription. | Any |
token (required) | string | The 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
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
Name | Type | Description | Accepted values |
---|---|---|---|
event (required) | string | ping - A constant parameter. | Any |
subscriptionId | string | Optional. The id of the subscription. | Any |
Examples of payload
pingMessage
Example of an ping message to server.
{
"event": "ping"
}
Tags
- Heartbeat
subscribe
Operation
subscribe
OperationNotification messages that you receive from the server
Accepts one of the following messages:
Message notification
notification
Notification event consumed over the WebSocket connection
Payload
Name | Type | Description | Accepted values |
---|---|---|---|
correlationId | string | The unique ID of the notification being sent | Any |
subscriptionId | string | The unique ID of the Agent and Engagement subscription | Any |
family | string | The family of events the subscription is for | Any |
sentAt | string | Datetime (in ISO 8601 format) of when the notification event was sent | Any |
accountId | string | The unique identifier for the Account. | Any |
loginId | string | The unique login handle for the Agent. | |
NOTE Only present on Agent related events | Any | ||
initiatingLoginId | string | The unique login handle for the Agent initiating a transfer. | |
NOTE Only present on Single Step Transfer related events | Any | ||
destinationLoginId | string | The unique login handle for the Agent the transfer is being made to. | |
NOTE Only present on Single Step Transfer to User related events | Any | ||
body | objectoneOf | The raw event payload that will be different based on the event. | Any |
body.0 | object | - | Any |
body.0.agentId | string | The unique identifier for the Agent | Any |
body.0.profileId | string | The profile ID used to login the agent. The profile indicates what channels should be logged in. | Any |
body.0.state | string | The current state of the agent. | LOGGED_IN, LOGGED_OUT, READY, NOT_READY |
body.0.reasonCode | string | The reason code for going not ready. Only for AGENT_NOT_READY state | Any |
body.0.cause | string | The cause of the agent not being ready. Only for AGENT_NOT_READY state | Any |
body.0.id | string | Each event has its own unique ID | Any |
body.0.timestamp | string | Timestamp (milliseconds since epoch) when the event was generated | Any |
body.1 | object | - | Any |
body.1.engagementId | string | The unique identifier for this engagement | Any |
body.1.channelProviderId | string | The unique identifier for this engagement provider | Any |
body.1.connectionId | string | The unique identifier for this appearance of this specific participant on the engagement | Any |
body.1.action | string | The agent participant action | ADDED, HELD, UNHELD, INVITED, REMOVED |
body.1.agentId | string | The unique identifier for the Agent | Any |
body.1.dialogId | string | The identifier for the dialog. NOTE this will equate to the UCID created by the ASBCE for an inbound call | Any |
body.1.extension | string | The extension/line of the agent | Any |
body.1.channelId | string | The channel ID which represents the media type | Any |
body.1.providerEngagementId | string | The provider-native identifier for the engagement | Any |
body.1.agentInitiatedDisconnect | boolean | An indication if the agent initiated disconnect from the dialog. Only for REMOVED action | Any |
body.1.id | string | Each event has its own unique ID | Any |
body.1.timestamp | string | Timestamp (milliseconds since epoch) when the event was generated | Any |
body.2 | object | - | Any |
body.2.engagementId | string | The unique identifier for this engagement | Any |
body.2.channelProviderId | string | The unique identifier for this engagement provider | Any |
body.2.automationParticipantId | string | The unique identifier for the automation participant | Any |
body.2.action | string | The automation participant action | ADDED, REMOVED |
body.2.dialogId | string | The identifier for the dialog. NOTE this will equate to the UCID created by the ASBCE for an inbound call | Any |
body.2.automationType | string | The type of automation being added | Any |
body.2.connectionId | string | The unique identifier for this appearance of this specific participant on the engagement | Any |
body.2.channelId | string | The channel ID which represents the media type | Any |
body.2.providerEngagementId | string | The provider-native identifier for the engagement | Any |
body.2.automationInitiatedDisconnect | boolean | An indication if the automation participant initiated disconnect from the dialog | Any |
body.2.id | string | Each event has its own unique ID | Any |
body.2.timestamp | string | Timestamp (milliseconds since epoch) when the event was generated | Any |
body.3 | object | - | Any |
body.3.engagementId | string | The unique identifier for this engagement | Any |
body.3.channelProviderId | string | The unique identifier for this engagement provider | Any |
body.3.externalParticipantId | string | The Channel Provider's identifier for this external participant (aka the Customer) | Any |
body.3.action | string | The external participant action | ADDED, REMOVED, INVITED |
body.3.connectionId | string | The unique identifier for this appearance of this specific participant on the engagement | Any |
body.3.dialogId | string | The identifier for the dialog. NOTE this will equate to the UCID created by the ASBCE for an inbound call | Any |
body.3.channelId | string | The channel ID which represents the media type | Any |
body.3.providerEngagementId | string | The provider-native identifier for the engagement | Any |
body.3.externalParticipantInitiatedDisconnect | boolean | An indication if the external participant (aka the Customer) initiated disconnect from the dialog | Any |
body.3.id | string | Each event has its own unique ID | Any |
body.3.timestamp | string | Timestamp (milliseconds since epoch) when the event was generated | Any |
body.4 | object | - | Any |
body.4.engagementId | string | The unique identifier for this engagement | Any |
body.4.dialogId | string | The identifier for the dialog. NOTE this will equate to the UCID created by the ASBCE for an inbound call | Any |
body.4.orchestrationFlow | string | The orchestration flow name that should be used for this engagement | Any |
body.4.attributes | arrayobject | A list of Category and Values identified for routing the call | Any |
body.4.attributes.category | string | A category for routing | Any |
body.4.attributes.values | arraystring | A list of values specific to the category | Any |
body.4.attributeList | arraystring | A simplified flat list of attributes | |
NOTE this flat array of attributes will help to easily identify “System.Outbound” to represent a POM call | Any | ||
body.4.engagementParameters | object | Additional information that could be tagged on an engagement | Any |
body.4.agentRoutingStrategy | object | Agent routing strategy configuration | Any |
body.4.agentRoutingStrategy.type | string | LAR: last Agent routing, PAR: preferred Agent Routing | LAR, PAR |
body.4.agentRoutingStrategy.waitTime | integer | Wait time in minutes before default routing is applied | Any |
body.4.adhocEmail | boolean | Flag to determine if adhoc email or not (email routing only) | Any |
body.4.autoResponse | string | The auto response suggested to be used | Any |
body.4.channelProviderId | string | The unique identifier for this engagement provider | Any |
body.4.channelId | string | The channel ID which represents the media type | Any |
body.4.channelIdentifier | string | The channel identifier of the engagement | Any |
body.4.queue | object | The queue details | Any |
body.4.queue.queueId | integer | The unique identifier of the queue | Any |
body.4.queue.queueName | integer | The name of the queue | Any |
body.4.queue.priority | integer | The priority of the queue | Any |
body.4.queue.proficiencyRangeMin | integer | The minimum proficiency of the queue | Any |
body.4.queue.proficiencyRangeMax | integer | The maximum proficiency of the queue | Any |
body.4.customerIdentifiers | object | A 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.phoneNumbers | arraystring | - | Any |
body.4.customerIdentifiers.emailAddresses | arraystring | - | Any |
body.4.customerIdentifiers.accountIds | arraystring | - | Any |
body.4.externalParticipantId | string | The Channel Provider's identifier for this external participant (aka the Customer) | Any |
body.4.sourceAddress | string | The source address of the external participant, e.g. calling number or customer email | Any |
body.4.destinationAddress | string | Destination number or uri | Any |
body.4.subject | string | The subject field of the incoming email | Any |
body.4.id | string | Each event has its own unique ID | Any |
body.4.timestamp | string | Timestamp (milliseconds since epoch) when the event was generated | Any |
body.5 | object | - | Any |
body.5.engagementId | string | The unique identifier for this engagement | Any |
body.5.channelProviderId | string | The unique identifier for this engagement provider | Any |
body.5.connectionId | string | The unique identifier for this appearance of this specific participant on the engagement | Any |
body.5.externalParticipantId | string | The Channel Provider's identifier for this external participant (aka the Customer) | Any |
body.5.dialogId | string | The identifier for the dialog. NOTE this will equate to the UCID created by the ASBCE for an inbound call | Any |
body.5.callingNumber | string | The calling number of the external participant | Any |
body.5.dialledNumber | string | The original dialed number for the engagement | Any |
body.5.channelId | string | The channel ID which represents the media type | Any |
body.5.customerIdentifiers | object | A 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.phoneNumbers | arraystring | - | Any |
body.5.customerIdentifiers.emailAddresses | arraystring | - | Any |
body.5.customerIdentifiers.accountIds | arraystring | - | Any |
body.5.providerEngagementId | string | The provider-native identifier for the engagement | Any |
body.5.engagementParameters | object | Additional information that could be tagged on an engagement | Any |
body.5.id | string | Each event has its own unique ID | Any |
body.5.timestamp | string | Timestamp (milliseconds since epoch) when the event was generated | Any |
body.6 | object | - | Any |
body.6.engagementId | string | The unique identifier for this engagement | Any |
body.6.matchId | string | The unique identifier for this match | Any |
body.6.correlationId | string | The correlation Id from the original match request (can be ignored) | Any |
body.6.strategy | string | The agent selection strategy used for this match (values include MOST_IDLE or OCCUPANCY) | MOST_IDLE, OCCUPANCY |
body.6.offeredQueue | object | The offered queue details including offered agent | Any |
body.6.offeredQueue.queueId | integer | The unique identifier of this queue | Any |
body.6.offeredQueue.channelId | integer | The channel of this queue | Any |
body.6.offeredQueue.priority | integer | The priority of this service | Any |
body.6.offeredQueue.rank | integer | The rank of this service | Any |
body.6.offeredQueue.proficiencyRangeMin | integer | The minimum proficiency of this service | Any |
body.6.offeredQueue.proficiencyRangeMax | integer | The maximum proficiency of this service | Any |
body.6.offeredQueue.attributes | arrayobject | A list of Category and Values identified for routing the call | Any |
body.6.offeredQueue.attributes.category | string | A category for routing | Any |
body.6.offeredQueue.attributes.values | arraystring | A list of values specific to the category | Any |
body.6.offeredQueue.offeredAgentData | object | Details about the agent | Any |
body.6.offeredQueue.offeredAgentData.agentId | string | The unique identifier for the Agent | Any |
body.6.offeredQueue.offeredAgentData.providerAgentId | string | The provider agent id of the offered agent | Any |
body.6.offeredQueue.offeredAgentData.channelProviderId | string | The unique identifier for this engagement provider | Any |
body.6.offeredQueue.offeredAgentData.channelId | string | The channel ID which represents the media type | Any |
body.6.offeredQueue.offeredAgentData.channelProviderAddress | string | The address of the engagement provider | Any |
body.6.offeredQueue.offeredAgentData.providerAgentAddress | string | The address of the agent | Any |
body.6.offeredService | object | Details about the service offered including the offered agent | Any |
body.6.offeredService.priority | integer | The priority of this service | Any |
body.6.offeredService.rank | integer | The rank of this service | Any |
body.6.offeredService.proficiencyRangeMin | integer | The minimum proficiency of this service | Any |
body.6.offeredService.proficiencyRangeMax | integer | The maximum proficiency of this service | Any |
body.6.offeredService.attributes | arrayobject | A list of Category and Values identified for routing the call | Any |
body.6.offeredService.attributes.category | string | A category for routing | Any |
body.6.offeredService.attributes.values | arraystring | A list of values specific to the category | Any |
body.6.offeredService.offeredAgentData | object | Details about the agent | Any |
body.6.offeredService.offeredAgentData.agentId | string | The unique identifier for the Agent | Any |
body.6.offeredService.offeredAgentData.providerAgentId | string | The provider agent id of the offered agent | Any |
body.6.offeredService.offeredAgentData.channelProviderId | string | The unique identifier for this engagement provider | Any |
body.6.offeredService.offeredAgentData.channelId | string | The channel ID which represents the media type | Any |
body.6.offeredService.offeredAgentData.channelProviderAddress | string | The address of the engagement provider | Any |
body.6.offeredService.offeredAgentData.providerAgentAddress | string | The address of the agent | Any |
body.6.offeredSpecifiedAgent | object | Details about the agent specified in the match request | Any |
body.6.offeredSpecifiedAgent.rank | integer | The rank of this agent | Any |
body.6.offeredSpecifiedAgent.offeredSpecifiedAgentData | object | - | Any |
body.6.offeredSpecifiedAgent.offeredSpecifiedAgentData.agentId | string | The unique identifier for the Agent | Any |
body.6.offeredSpecifiedAgent.offeredSpecifiedAgentData.providerAgentId | string | The provider agent id of the offered agent | Any |
body.6.offeredSpecifiedAgent.offeredSpecifiedAgentData.channelProviderId | string | The unique identifier for this engagement provider | Any |
body.6.offeredSpecifiedAgent.offeredSpecifiedAgentData.channelId | string | The channel ID which represents the media type | Any |
body.6.offeredSpecifiedAgent.offeredSpecifiedAgentData.channelProviderAddress | string | The address of the engagement provider | Any |
body.6.offeredSpecifiedAgent.offeredSpecifiedAgentData.providerAgentAddress | string | The address of the agent | Any |
body.6.id | string | Each event has its own unique ID | Any |
body.6.timestamp | string | Timestamp (milliseconds since epoch) when the event was generated | Any |
body.7 | object | - | Any |
body.7.engagementId | string | The unique identifier for this engagement | Any |
body.7.agentId | string | The unique identifier for the Agent | Any |
body.7.dialogId | string | The identifier for the dialog. NOTE this will equate to the UCID created by the ASBCE for an inbound call | Any |
body.7.destinationAddress | string | Destination number or uri | Any |
body.7.channelProviderId | string | The unique identifier for this engagement provider | Any |
body.7.channelId | string | The channel ID which represents the media type | Any |
body.7.customerIdentifiers | object | A 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.phoneNumbers | arraystring | - | Any |
body.7.customerIdentifiers.emailAddresses | arraystring | - | Any |
body.7.customerIdentifiers.accountIds | arraystring | - | Any |
body.7.engagementParameters | object | Additional information that could be tagged on an engagement | Any |
body.7.id | string | Each event has its own unique ID | Any |
body.7.timestamp | string | Timestamp (milliseconds since epoch) when the event was generated | Any |
body.8 | object | - | Any |
body.8.engagementId | string | The unique identifier for this engagement | Any |
body.8.initiatingAgentId | string | The unique identifier for the agent that initiated the transfer | Any |
body.8.transferTo | string | The type of the transfer | QUEUE, USER, AUTOMATION, EXTERNAL |
body.8.destination | string | Contains 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.8.queueId | string | The destination queue identifier for the transfer or the fallback queue in the event destination agent is not available | Any |
body.8.queueName | string | The destination queue name of the transfer or the fallback queue in the event destination agent is not available | Any |
body.8.channelProviderId | string | The unique identifier for this engagement provider | Any |
body.8.connectionId | string | The unique identifier for this appearance of this specific participant on the engagement | Any |
body.8.dialogId | string | The identifier for the dialog. NOTE this will equate to the UCID created by the ASBCE for an inbound call | Any |
body.8.providerDialogId | string | The unique identifier of the dialog generated by provider | Any |
body.8.channelId | string | The channel ID which represents the media type | Any |
body.8.correlationId | string | The correlationId for the request. This should be referenced when notifying a related error | Any |
body.8.timestamp | string | Timestamp (milliseconds since epoch) when the event was generated | Any |
body.9 | object | - | Any |
body.9.engagementId | string | The unique identifier for this engagement | Any |
body.9.initiatingAgentId | string | The unique identifier for the agent that initiated the transfer | Any |
body.9.transferTo | string | The type of the transfer | QUEUE, USER, AUTOMATION, EXTERNAL |
body.9.errorType | string | The type of the error | CANCELLED, FAILED |
body.9.destination | string | Contains 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
pong
Server pong response to a ping message.
Payload
Name | Type | Description | Accepted values |
---|---|---|---|
event (required) | string | pong - A constant parameter. | Any |
Examples of payload
pongMessage
Example of a pong message to client.
{
"event": "pong"
}
Tags
- Heartbeat
Message authenticationResponse
authenticationResponse
Authentication response message sent to the client after websocket authentication.
Payload
Name | Type | Description | Accepted values |
---|---|---|---|
event | string | authenticationResponse - A constant parameter. | Any |
status | string | You 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
Updated over 1 year ago