Getting agent details about most recent interaction

When you need to know what is the current or last interaction for the agent, you can use this method to check that information.

Request Scheme

HTTPS

Request Uri

GET v{v#}/{accountKey}/agents/{agentId}/latestInteractions

AuthorizationĀ (required)

This header requires an OAuth bearer token. For information on the bearer token, seeĀ Using the bearer access token.

AcceptĀ (required)

application/json;version=1

Indicates that the media type required from the server is JavaScript Object Notation (JSON)

Parameters (plans for versions > 1)

size: 1-n - limits the number returned; optional default is 1

type: optional; permitted values currently All|Phone|Chat|Email - filters out other types of interaction

activeLiveFirst: optional true|falseĀ - sorts any Active Live Interaction (e.g. Phone vs. Chat/Email/etc. non/semi-live interaction types) first for compatibility with Task Refresh/Dialler queries.

Response (version 1)


{


"interactions" : [ 


  {    


    "start": "2017-03-30T22:40:15Z",


    "guid": "015b212c-1487-46ba-bbb7-d78d6b1412a5", 


    "hasEnded": true


    }


  ]


}

Result contains current or the most recent interaction for an agent. If there is more than one active interaction the first return is interaction with type 'Phone". The interaction are ordered descending by InteractionStateChangedAt.


Response (plans for version > 1)


{
"interactions" : [ 
 {
 "type": "Phone", 
 "start": "2017-03-30T22:40:15Z",
 "guid": "015b212c-1487-46ba-bbb7-d78d6b1412a5", 
 "duration": 972,
 "direction": "Inbound",
 "channelGuid": "015b212c-1487-46ba-bbb7-d78d6b1412a5"
 },
 ...
 ]
}


Results are in order of the most recently started Channel first, followed by the one started before that, etc.

start is the time the agent's Channel started in UTC

guid is the Interaction GUID

type denotes the medium the agent used, e.g. Phone, Chat, Email, as per Vonage Contact Center type enumeration.

duration is null if the agent is still connected, otherwise it is the duration of their channel in seconds

direction - nice to have - direction of the Interaction not of the Channel

Examples


Most URLs in the example code use the following values:

  • ***. To access the API for your region, replace *** with the correct subdomain for your region:
  • a1b2c3d4e5. The value represents the Vonage Contact Center account on which the API request is run. To run the API request on your account data, you must replace a1b2c3d4e5, where used, with your account's API key. For example, if your API key is mtovfiliti3, use mtovfiliti3 in place of a1b2c3d4e5.
  • <ACCESS_TOKEN>. The value represents a bearer access token which you must use to validate every request. Replace <ACCESS_TOKEN> where used with your bearer access token. For information about getting a bearer access token, see Getting a bearer access token.

Current interaction is active

curl -X GETĀ "https://***.newvoicemedia.com/v0/a1b2c3d4e5/agents/recentinteraction"Ā -H "Authorization: Bearer <ACCESS_TOKEN>"Ā -H "Accept: application/json;version=1"

Returns HTTP status code of 200, containing the following message.

{
"interactions" : [ 
  {    
    "start": "2017-03-30T22:40:15Z",
    "guid": "015b212c-1487-46ba-bbb7-d78d6b1412a5", 
    "hasEnded": false
    }
  ]
}

Current interaction is not active

curl -X GETĀ "https://***.newvoicemedia.com/v0/a1b2c3d4e5/agents/recentinteraction"Ā -H "Authorization: Bearer <ACCESS_TOKEN>"Ā -H "Accept: application/json;version=1"

Returns HTTP status code of 200, containing the following message.

{
"interactions" : [ 
  {    
    "start": "2017-03-30T22:40:15Z",
    "guid": "015b212c-1487-46ba-bbb7-d78d6b1412a5", 
    "hasEnded": true
    }
  ]
}

Invalid Request

Returns an HTTP response code of 400

{
ā€‚ā€‚"message": "The InteractionType field is required."
}

Agent Not Found

Returns an HTTP response code of 404

{
ā€‚ā€‚"message": "The requested resource was not found."
}