Skip to main content

Sparkcentral Real-Time Metrics API

The Real-time Metrics API gives you direct access to real-time metrics in the Sparkcentral platform via a convenient and secure RESTful API. The API provides Sparkcentral customers a means to integrate with internal contact center dashboards in conjunction with other traditional and/or digital communication channels such as phone, email, live chat, etc.

Real-Time Metrics API uses​

If you are building software, you can use the API to engage your customers by:

  • Displaying current wait time to customers in a mobile application or website.

If you’re a business, you can use the API to streamline internal business processes by:

  • Displaying current backlog and key metrics on digital channels alongside other contact center mediums on real-time dashboards maintained internally.
  • Keeping internal stakeholders informed by reporting on hourly trends in volume & backlog statistics across digital channels, to efficiently route agents to another channel if volume spikes.

Supported networks​

Sparkcentral is committed to supporting the most messaging networks on the market with the richest set of functionality. Today, you can use Sparkcentral to converse on:

  • Facebook
  • Twitter
  • Instagram
  • MessageBird
  • In-app messaging
  • WhatsApp
  • Twilio
  • WeChat
  • Mailgun
  • Telegram
  • Viber

Get started​

Access to the Sparkcentral proactive-messaging endpoints requires access keys. Users with admin level access can generate keys in Admin settings by expanding Integration and APIs and selecting Rest API Keys.

Authentication​

The Real-Time Metrics API uses the Client Credentials Grant flow of the Oauth 2.0 specification for client authentication and authorization. Clients are provided a client_id and client_secret to authenticate with Sparkcentral’s authorization server and receive an access_token to use for API request authorization. The access_token should be used in an authorization header, but it can optionally be passed as a query string parameter (see request/response details later in this article). When the access_token expires, the API returns a 401 unauthorized. The client can automate this by generating a new access token and replaying the failed request with the fresh access token, as documented in the following section.

Client Credentials Grant​

Retrieve an access_token to make authorized API requests. When the access_token expires, use this endpoint to generate a new token.

Request​

US Platform:

curl -X POST https://public-api.sparkcentral.com/oauth2/token \
-H 'content-type: application/x-www-form-urlencoded' \
-d 'grant_type=client_credentials&client_id=YOUR_CLIENT_ID_HERE&client_secret=YOUR_CLIENT_SECRET_HERE&scope=client-read'

EU Platform:

curl -X POST https://public-api-eu.sparkcentral.com/oauth2/token \
-H 'content-type: application/x-www-form-urlencoded' \
-d 'grant_type=client_credentials&client_id=YOUR_CLIENT_ID_HERE&client_secret=YOUR_CLIENT_SECRET_HERE&scope=client-read'
ParameterStatusDescription
grant_typerequiredMust be set to client_credentials
client_idrequiredSparkcentral provided client identifier
client_secretrequiredSparkcentral provided client secret
scoperequiredMust be set to client-read

Response​

{
"token_type": "bearer",
"access_token": "a1b2c3d4e5f6",
"expires_in": 43200
}
ParameterDescription
token_typeThe token type to be used in the authorization header. This will always be bearer for client credentials grant.
access_tokenThe token used to authorize requests. This should be added to requests as an authorization header: Authorization: Bearer a1b2c3d4e5f6. The API also accepts access_token as a query string parameter; however, using the authorization header is the preferred method.
expires_inThe number of seconds until the token expires (by default, 12 hours).

Metric APIs​

Inbound Message Volume​

A count of inbound messages based on applied filters.

Authorization

Bearer token

URI

POST /reporting-metrics/inbound-message-volume

Request Body Schema: application/json​

fromstring (required)
An ISO-8601 date time marking the inclusive start of the result. Must be URL encoded. The from filter can be a maximum of 14 days in the past.
tostring (schemas)
An ISO-8601 date time marking the exclusive end of the result. Must be URL encoded.
timezonestring (schemas)
The timezone name to be used in conjunction with groupByInterval; e.g. America/Los_Angeles. Must be URL encoded. If no timezone is provided, the default ‘UTC’ timezone is used.
mediumIdsArray of strings (mediumId)
Items Enum: "fb" "twit" "instagram" "rtm" "whatsapp" "linkedin"
channelIdsArray of strings (channelId)
Filter by channel identifier (use Channel API, and GET /channel/ to get a list of your channels). If no channelId filter is provided, the messages sent from all connected channels will be included.
groupByIntervalstring (schemas)
Enum: "MINUTE" "HOUR" "DAY" "MONTH" "YEAR" "HOUR_BY_DAY". An interval to group results by. No more than 60 intervals can be requested per request. For example, when selecting minute, the requested time range cannot be longer than 1 hour. Choices: minute hour day.

Request samples​

Request sample

Content type: application/json

{
"from": "string",
"to": "string",
"timezone": "string",
"mediumIds": [
"fb"
],
"channelIds": [
"string"
],
"groupByInterval": "MINUTE"
}

Responses​

200 Success

RESPONSE SCHEMA: application/json

One of: NumberMetricResponse (value, integer), TimeSeriesMetricResponse (value, Array of objects)

Array [
property name* object (TimeSeriesDataPoint)
]

Samples​

200 Success

Example: Single value

6

Example: GroupByInterval

[
{
"timestamp": "2022-03-25T00:00:00.000Z",
"value": 2
},
{
"timestamp": "2022-03-26T00:00:00.000Z",
"value": 4
}
]

401 Unauthorized

Unauthorized: when using an invalid or expired access token.

Inbound Message Volume​

DEPRECATED: Please use the POST version of this endpoint.

A count of inbound messages based on applied filters.

Example URI:

GET /reporting-metrics/inbound-message-volume

URI parameters​

fromstring (required)
An ISO-8601 date time marking the inclusive start of the result. Must be URL encoded. The from filter can be a maximum of 14 days in the past.
tostring (optional)
An ISO-8601 date time marking the exclusive end of the result. Must be URL encoded. If no to filter is provided, the messages that were sent up until now will be included.
mediumIdstring (optional)
Filter by medium identifier. If no mediumId filter is provided, the messages sent from all connected mediums will be included. Choices: fb twit instagram messagebird rtm whatsapp twilio wechat mailgun telegram viber
channelIdstring(optional)
Filter by channel identifier (use Channel API, and GET /channel/ to get a list of your channels). If no channelId filter is provided, the messages sent from all connected channels will be included.
groupByIntervalstring (optional)
An interval to group results by. If no groupByInterval is provided, the total count for messages matching given filters will be returned. No more than 60 intervals can be requested per request. For example, when selecting minute, the requested time range cannot be longer than 1 hour. Choices: minute hour day
timezonestring (optional)
The timezone name to be used in conjunction with groupByInterval, e.g. America/Los_Angeles. Must be URL encoded. If no timezone is provided, the default ‘UTC’ timezone is used.

Request

curl -X GET -G https://public-api.sparkcentral.com/reporting-metrics/inbound-message-volume \
--header 'Authorization: Bearer <token>' \
--data 'from=2017-06-22T14%3A00%3A00'

or

curl -X GET -G https://public-api-eu.sparkcentral.com/reporting-metrics/inbound-message-volume \
--header 'Authorization: Bearer <token>' \
--data 'from=2017-06-22T14%3A00%3A00'

Response 200

Headers

Content-Type: application/json

Body

{
"dataPoint": {
"value": 2127
}
}

Request

curl -X GET -G https://public-api.sparkcentral.com/reporting-metrics/inbound-message-volume \
--header 'Authorization: Bearer <token>' \
--data 'from=2017-06-22T14%3A00%3A00&timezone=a'

or

curl -X GET -G https://public-api-eu.sparkcentral.com/reporting-metrics/inbound-message-volume \
--header 'Authorization: Bearer <token>' \
--data 'from=2017-06-22T14%3A00%3A00&timezone=a'

Response 400

Headers

Content-Type: application/json

Body

{
"errors": [
"Bad request parameters. java.lang.IllegalArgumentException: The datetime zone id 'a' is not recognized"
],
"errorType": null
}

Request

curl -X GET -G https://public-api.sparkcentral.com/reporting-metrics/inbound-message-volume \
--header 'Authorization: Bearer <token>' \
--data 'from='

or

curl -X GET -G https://public-api-eu.sparkcentral.com/reporting-metrics/inbound-message-volume \
--header 'Authorization: Bearer <token>' \
--data 'from='

Response 400

Headers

Content-Type: application/json

Body

{
"errors": [
"Bad request parameters. java.lang.IllegalArgumentException: Invalid format: \"\""
],
"errorType": null
}

Request

curl -X GET -G https://public-api.sparkcentral.com/reporting-metrics/inbound-message-volume \
--header 'Authorization: Bearer <token>' \
--data 'groupByInterval=tree'

or

curl -X GET -G https://public-api-eu.sparkcentral.com/reporting-metrics/inbound-message-volume \
--header 'Authorization: Bearer <token>' \
--data 'groupByInterval=tree'

Response 400

Headers

Content-Type: application/json

Body

{
"errors": [
"Bad request parameters. java.lang.IllegalArgumentException: No enum constant com.sparkcentral.models.http.GroupByInterval.TREE"
],
"errorType": null
}

Request

Body

curl -X GET -G https://public-api.sparkcentral.com/reporting-metrics/inbound-message-volume \
--header 'Authorization: Bearer <token>' \
--data 'mediumId='

or

curl -X GET -G https://public-api-eu.sparkcentral.com/reporting-metrics/inbound-message-volume \
--header 'Authorization: Bearer <token>' \
--data 'mediumId='

Response 400

Headers

Content-Type: application/json

Body

{
"errors": [
"Bad request parameters. java.lang.IllegalArgumentException: Not a valid mediumId."
],
"errorType": null
}

Outbound Message Volume​

A count of outbound messages based on applied filters.

Authorization

Bearer token

URI

POST /reporting-metrics/outbound-message-volume

Request Body Schema: application/json​

fromstring (schemas) (required)
An ISO-8601 date time marking the inclusive start of the result. Must be URL encoded. The from filter can be a maximum of 14 days in the past.
tostring (schemas)
An ISO-8601 date time marking the exclusive end of the result. Must be URL encoded. If no to filter is provided, the messages that were sent up until now will be included.
timezonestring (schemas)
The timezone name to be used in conjunction with groupByInterval; e.g. America/Los_Angeles. Must be URL encoded. If no timezone is provided, the default ‘UTC’ timezone is used.
mediumIdsArray of strings (mediumId)
Filter by medium identifier. If no mediumId filter is provided, the messages sent to all connected mediums will be included. Choices: fb twit instagram messagebird rtm whatsapp twilio wechat mailgun telegram viber
channelIdArray of strings (channelId)
Filter by channel identifier (use Channel API, and GET /channel/ to get a list of your channels). If no channelId filter is provided, the messages sent from all connected channels will be included.
groupByIntervalstring (schemas)
Enum: "MINUTE" "HOUR" "DAY" "MONTH" "YEAR" "HOUR_BY_DAY"
An interval to group results by. If no groupByInterval is provided, the total count for messages matching given filters will be returned. No more than 60 intervals can be requested per request. For example, when selecting minute, the requested time range cannot be longer than 1 hour. Choices: minute hour day

Request samples​

Request sample

Content type: application/json

{
"from": "string",
"to": "string",
"timezone": "string",
"mediumIds": [
"fb"
],
"channelIds": [
"string"
],
"groupByInterval": "MINUTE"
}

Responses​

200 Success

RESPONSE SCHEMA: application/json
NumberMetricResponseTime
value
integer

SeriesMetricResponse
value
Array of objects

Array [
property name*object (TimeSeriesDataPoint)
]

Samples​

200 Success

Content type: application/json

Example: SingleValue

6

Content type: application/json

Example: GroupByInterval

[
{
"timestamp": "2022-03-25T00:00:00.000Z",
"value": 2
},
{
"timestamp": "2022-03-26T00:00:00.000Z",
"value": 4
}
]

401 Unauthorized

Unauthorized: when using an invalid or expired access token.

Outbound Message Volume​

DEPRECATED: Please use the POST version of this endpoint.

A count of outbound messages based on applied filters.

Example URI:

GET /reporting-metrics/outbound-message-volume

URI parameters​

fromstring (required)
An ISO-8601 date time marking the inclusive start of the result. Must be URL encoded. The from filter can be a maximum of 14 days in the past.
tostring (optional)
An ISO-8601 date time marking the exclusive end of the result. If no to filter is provided, the messages that were sent up until now will be included.
mediumIdstring (optional)
Filter by medium identifier. If no mediumId filter is provided, the messages sent to all connected mediums will be included. Choices: fb twit instagram messagebird rtm whatsapp twilio wechat mailgun telegram viber
channelIdstring (optional)
Filter by channel identifier (use Channel API, and GET /channel/ to get a list of your channels). If no channelId filter is provided, the messages sent from all connected channels will be included.
groupByIntervalstring (optional)
An interval to group results by. If no groupByInterval is provided, the total count for messages matching given filters will be returned. No more than 60 intervals can be requested per request. For example, when selecting minute, the requested time range cannot be longer than 1 hour. Choices: minute hour day
timezonestring (optional)
The timezone name to be used in conjunction with groupByInterval. Must be URL encoded. If no timezone is provided, the default ‘UTC’ timezone is used.

Request

curl -X GET -G https://public-api.sparkcentral.com/reporting-metrics/outbound-message-volume \
--header 'Authorization: Bearer <token>' \
--data 'from=2017-06-22T14%3A00%3A00'

or

curl -X GET -G https://public-api-eu.sparkcentral.com/reporting-metrics/outbound-message-volume \
--header 'Authorization: Bearer <token>' \
--data 'from=2017-06-22T14%3A00%3A00'

Response 200

Headers

Content-Type: application/json

Body

{
"dataPoint": {
"value": 2127
}
}

Request

curl -X GET -G https://public-api.sparkcentral.com/reporting-metrics/outbound-message-volume \
--header 'Authorization: Bearer <token>' \
--data 'from=2017-06-22T14%3A00%3A00&timezone=a'

or

curl -X GET -G https://public-api-eu.sparkcentral.com/reporting-metrics/outbound-message-volume \
--header 'Authorization: Bearer <token>' \
--data 'from=2017-06-22T14%3A00%3A00&timezone=a'

Response 400

Headers

Content-Type: application/json

Body

{
"errors": [
"Bad request parameters. java.lang.IllegalArgumentException: The datetime zone id 'a' is not recognized"
],
"errorType": null
}

Request

curl -X GET -G https://public-api.sparkcentral.com/reporting-metrics/outbound-message-volume \
--header 'Authorization: Bearer a1b2c3d4e5f6' \
--data 'from='

or

curl -X GET -G https://public-api-eu.sparkcentral.com/reporting-metrics/outbound-message-volume \
--header 'Authorization: Bearer a1b2c3d4e5f6' \
--data 'from='

Response 400

Headers

Content-Type: application/json

Body

{
"errors": [
"Bad request parameters. java.lang.IllegalArgumentException: Invalid format: \"\""
],
"errorType": null
}

Request

curl -X GET -G https://public-api.sparkcentral.com/reporting-metrics/outbound-message-volume \
--header 'Authorization: Bearer a1b2c3d4e5f6' \
--data 'groupByInterval=tree'

or

curl -X GET -G https://public-api-eu.sparkcentral.com/reporting-metrics/outbound-message-volume \
--header 'Authorization: Bearer a1b2c3d4e5f6' \
--data 'groupByInterval=tree'

Response 400

Headers

Content-Type: application/json

Body

{
"errors": [
"Bad request parameters. java.lang.IllegalArgumentException: No enum constant com.sparkcentral.models.http.GroupByInterval.TREE"
],
"errorType": null
}

Request

curl -X GET -G https://public-api.sparkcentral.com/reporting-metrics/outbound-message-volume \
--header 'Authorization: Bearer a1b2c3d4e5f6' \
--data 'mediumId='

or

curl -X GET -G https://public-api-eu.sparkcentral.com/reporting-metrics/outbound-message-volume \
--header 'Authorization: Bearer a1b2c3d4e5f6' \
--data 'mediumId='

Response 400

Headers

Content-Type: application/json

Body

{
"errors": [
"Bad request parameters. java.lang.IllegalArgumentException: Not a valid mediumId."
],
"errorType": null
}

Average First Response Time​

The average time in seconds to the first response to an inbound message.

Authorization

Bearer token

URI

POST /reporting-metrics/first-response-time

Request Body Schema: application/json​

fromstring (schemas) (required)
An ISO-8601 date time marking the inclusive start of the result. Must be URL encoded. The from filter can be a maximum of 14 days in the past.
tostring (schemas)
An ISO-8601 date time marking the end of the result. Must be URL encoded.
Only inbound messages and responses sent before to date time are included in average first response time calculation. If no to filter is provided, the messages that were sent up until now are included.
timezonestring (schemas)
The timezone name to be used in conjunction with groupByInterval; e.g. America/Los_Angeles. Must be URL encoded. If no timezone is provided, the default ‘UTC’ timezone is used.
mediumIdsArray of strings (mediumId)
Filter by medium identifier. If no mediumId filter is provided, the messages sent in any connected mediums will be included. Choices: fb twit instagram messagebird rtm whatsapp twilio wechat mailgun telegram viber
channelIdsArray of strings (channelId)
Filter by channel identifier (use Channel API, and GET /channel/ to get a list of your channels). If no channelId filter is provided, the messages sent from all connected channels will be included.
teamIdsArray of strings (TeamId)
Use Organization API, and GET /organization/team to get a list of your teams.
groupByIntervalstring (schemas)
Enum: "MINUTE" "HOUR" "DAY" "MONTH" "YEAR" "HOUR_BY_DAY". An interval to group results by. No more than 60 intervals can be requested per request. For example, when selecting minute, the requested time range cannot be longer than 1 hour. Choices: minute hour day
groupBystring Value: TEAM

Request samples​

Request sample

Content type: application/json

{
"from": "string",
"to": "string",
"timezone": "string",
"mediumIds": [
"fb"
],
"channelIds": [
"string"
],
"teamIds": [
"string"
],
"groupByInterval": "MINUTE",
"groupBy": "TEAM"
}

Responses​

200 Success

RESPONSE SCHEMA: application/json

NumberMetricResponse
value
integer

GroupedMetricResponse
value object
property name* object (NumberMetricResponse)

TimeSeriesMetricResponse
value
Array of objects

Array [
property name* object (TimeSeriesDataPoint)
]

Samples​

200 Success

Content type: application/json

Example: SingleValue

6

Example: groupByTeam

{
"c3144df7-8a04-4b20-b60a-ccfe97723780": {
"value": 4
},
"3b48a76e-4289-44b8-ac15-c8b60d21f158": {
"value": 2
}
}

Example: groupByDay

[
{
"timestamp": "2022-03-25T00:00:00.000Z",
"value": 2
},
{
"timestamp": "2022-03-26T00:00:00.000Z",
"value": 4
}
]

Example: groupByDayAndTeam

[
{
"timestamp": "2022-03-25T00:00:00.000Z",
"value": {}
},
{
"timestamp": "2022-03-26T00:00:00.000Z",
"value": null
}
]

401 Unauthorized

Unauthorized: when using an invalid or expired access token.

Average First Response Time​

DEPRECATED: Please use the POST version of this endpoint.

The average time in seconds to the first response to an inbound message.

Example URI:

GET /reporting-metrics/first-response-time

URI parameters​

fromstring (required)
An ISO-8601 date time marking the inclusive start of the result. Must be URL encoded. The from filter can be a maximum of 14 days in the past.
tostring (optional)
An ISO-8601 date time marking the end of the result. Must be URL encoded. Only inbound messages and responses sent before to date time will be included in average first response time calculation. If no to filter is provided, the messages that were sent up until now will be included.
mediumIdstring (optional)
Filter by medium identifier. If no mediumId filter is provided, the messages sent in any connected mediums will be included. Choices: fb twit instagram messagebird rtm whatsapp twilio wechat mailgun telegram viber
channelIdstring (optional)
Filter by channel identifier (use Channel API, and GET /channel/ to get a list of your channels). If no channelId filter is provided, the messages sent from all connected channels will be included.

Request

curl -X GET -G https://public-api.sparkcentral.com/reporting-metrics/first-response-time \
--header 'Authorization: Bearer <token>' \
--data 'from=2017-06-22T14%3A00%3A00'

or

curl -X GET -G https://public-api-eu.sparkcentral.com/reporting-metrics/first-response-time \
--header 'Authorization: Bearer <token>' \
--data 'from=2017-06-22T14%3A00%3A00'

Response 200

Headers

Content-Type: application/json

Body

{
"dataPoint": {
"value": 2127
}
}

Request

curl -X GET -G https://public-api.sparkcentral.com/reporting-metrics/first-response-time \
--header 'Authorization: Bearer <token>' \
--data 'mediumId='

or

curl -X GET -G https://public-api-eu.sparkcentral.com/reporting-metrics/first-response-time \
--header 'Authorization: Bearer <token>' \
--data 'mediumId='

Response 400

Headers

Content-Type: application/json

Body

{
"errors": [
"Bad request parameters. java.lang.IllegalArgumentException: Not a valid mediumId."
],
"errorType": null
}

Request

curl -X GET -G https://public-api.sparkcentral.com/reporting-metrics/first-response-time \
--header 'Authorization: Bearer <token>' \
--data 'from='

or

curl -X GET -G https://public-api-eu.sparkcentral.com/reporting-metrics/first-response-time \
--header 'Authorization: Bearer <token>' \
--data 'from='

Response 400

Headers

Content-Type: application/json

Body

{
"errors": [
"Bad request parameters. java.lang.IllegalArgumentException: Invalid format: \"\""
],
"errorType": null
}

Average Conversation Response Time​

The average time in seconds for a response to an inbound message except the first response.

Authorization

Bearer token

URI

POST /reporting-metrics/conversation-reponse-time

Request Body Schema: application/json​

fromstring (schemas) (required)
An ISO-8601 date time marking the inclusive start of the result. Must be URL encoded. The from filter can be a maximum of 14 days in the past.
tostring (schemas)
An ISO-8601 date time marking the exclusive end of the result. Must be URL encoded.
timezonestring (schemas)
The timezone to be used in conjunction with groupByInterval, e.g. America/Los_Angeles. Must be URL encoded. If no timezone is provided, the default 'UTC' timezone is used.
mediumIdsArray of strings (mediumId)
Filter by medium identifier. If no mediumId filter is provided, the messages sent in any connected mediums will be included. Choices: fb twit instagram messagebird rtm whatsapp twilio wechat mailgun telegram viber
channelIdsArray of strings (channelId)
Filter by channel identifier (use Channel API, and GET /channel/ to get a list of your channels). If no channelId filter is provided, the messages sent from all connected channels will be included.
teamIdsArray of strings (teamId)
Use Organization API, and GET /organization/team to get a list of your teams.
groupByIntervalstring (schemas)
Enum: "MINUTE" "HOUR" "DAY" "MONTH" "YEAR" "HOUR_BY_DAY" An interval to group results by. No more than 60 intervals can be requested per request. For example, when selecting minute, the requested time range cannot be longer than 1 hour.
groupBystring
Value: "TEAM"

Request samples​

Request sample

Content type: application/json

{
"from": "string",
"to": "string",
"timezone": "string",
"mediumIds": [
"fb"
],
"channelIds": [
"string"
],
"teamIds": [
"string"
],
"groupByInterval": "MINUTE",
"groupBy": "TEAM"
}

Responses​

200 Success

RESPONSE SCHEMA: application/json
NumberMetricResponse
value integer

GroupedMetricResponse
value Object

TimeSeriesMetricResponse

Array [
property name* object(NumberMetricResponse)
]

Samples​

200 Success

Content type: application/json

Example: singleValue

6

Example: groupByTeam

{
"c3144df7-8a04-4b20-b60a-ccfe97723780": {
"value": 4
},
"3b48a76e-4289-44b8-ac15-c8b60d21f158": {
"value": 2
}
}

Example: groupByDay

[
{
"timestamp": "2022-03-25T00:00:00.000Z",
"value": 2
},
{
"timestamp": "2022-03-26T00:00:00.000Z",
"value": 4
}
]

Example: groupByDayAndTeam

[
{
"timestamp": "2022-03-25T00:00:00.000Z",
"value": {}
},
{
"timestamp": "2022-03-26T00:00:00.000Z",
"value": null
}
]

401 Unauthorized

Unauthorized: when using an invalid or expired access token.

Resolved With Reply​

The number of messages that have been resolved with at least one reply.

Authorization

Bearer token

URI

POST /reporting-metrics/resolved-with-one-reply

Request Body Schema: application/json​

fromstring (schemas) (required)
An ISO-8601 date time marking the inclusive start of the result. Must be URL encoded. Only inbound messages and responses sent after from date time will be included in Resolved with Reply calculation. The from filter can be a maximum of 14 days in the past.
tostring (schemas)
An ISO-8601 date time marking the exclusive end of the result. Must be URL encoded. Only inbound messages and responses sent before to date time will be included in Resolved with Reply calculation. If no to filter is provided, the messages that were sent up until now will be included.
mediumIdsArray of strings (MediumId) (optional)
Filter by medium identifier. If no mediumId filter is provided, the messages sent in any connected mediums will be included. Choices: fb twit instagram messagebird rtm whatsapp twilio wechat mailgun telegram viber
channelIdsArray of strings (channelId)
Filter by channel identifier (use Channel API, and GET /channel/ to get a list of your channels). If no channelId filter is provided, the messages sent from all connected channels will be included.
teamIdsArray of strings (teamId)
Use Organization API, and GET /organization/team to get a list of your teams.
groupBystring Value: TEAM

Request samples​

Request sample

Content type: application/json

{
"from": "string",
"to": "string",
"mediumIds": [
"fb"
],
"channelIds": [
"string"
],
"teamIds": [
"string"
],
"groupBy": "TEAM"
}

Responses​

200 Success

RESPONSE SCHEMA: application/json
NumberMetricResponse
value
integer

GroupedMetricResponse
value
Object

property name* object(NumberMetricResponse)

Samples​

200 Success

Content type: application/json

Example: SingleValue

6

Content type: application/json

Example: GroupByTeam

{
"c3144df7-8a04-4b20-b60a-ccfe97723780": {
"value": 4
},
"3b48a76e-4289-44b8-ac15-c8b60d21f158": {
"value": 2
}
}

401 Unauthorized

Unauthorized: when using an invalid or expired access token.

Resolved With Reply​

DEPRECATED: Please use the POST version of this endpoint.

The number of messages that have been resolved with at least one reply.

Example URI:

GET /reporting-metrics/resolved-with-one-reply

URI parameters​

fromstring (optional)
An ISO-8601 date time marking the inclusive start of the result. Must be URL encoded. Only inbound messages and responses sent after from date time will be included in Resolved with Reply calculation.
tostring (optional)
An ISO-8601 date time marking the exclusive end of the result. Must be URL encoded. Only inbound messages and responses sent before to date time will be included in Resolved with Reply calculation. If no to filter is provided, the messages that were sent up until now will be included.
mediumIdstring (optional)
Filter by medium identifier. If no mediumId filter is provided, the messages sent in any connected mediums will be included. Choices: fb twit instagram messagebird rtm whatsapp twilio wechat mailgun telegram viber
channelIdstring (optional)
Filter by channel identifier (use Channel API, and GET /channel/ to get a list of your channels). If no channelId filter is provided, the messages sent from all connected channels will be included.

Request

curl -X GET -G https://public-api.sparkcentral.com/reporting-metrics/resolved-with-one-reply \
--header 'Authorization: Bearer <token>' \
--data 'from=2017-06-22T14%3A00%3A00'

or

curl -X GET -G https://public-api-eu.sparkcentral.com/reporting-metrics/resolved-with-one-reply \
--header 'Authorization: Bearer <token>' \
--data 'from=2017-06-22T14%3A00%3A00'

Response 200

Headers

Content-Type: application/json

Body

{
"dataPoint": {
"value": 2127
}
}

Request

curl -X GET -G https://public-api.sparkcentral.com/reporting-metrics/resolved-with-one-reply \
--header 'Authorization: Bearer <token>' \
--data 'mediumId='

or

curl -X GET -G https://public-api-eu.sparkcentral.com/reporting-metrics/resolved-with-one-reply \
--header 'Authorization: Bearer <token>' \
--data 'mediumId='

Response 400

Headers

Content-Type: application/json

Body

{
"errors": [
"Bad request parameters. java.lang.IllegalArgumentException: Not a valid mediumId."
],
"errorType": null
}

Average Handle Time​

The average time in seconds that a conversation is handled by an agent, specifically the difference between timestamps of conversation open and conversation pend/resolve. For Average Handle Time to be calculated, there must be an outbound between open and pend/resolve event.

Authorization

Bearer token

URI

POST /reporting-metrics/handle-time

Request Body Schema: application/json​

fromstring (schemas) (required)
An ISO-8601 date time marking the inclusive start of the result. Must be URL encoded. The from filter can be a maximum of 14 days in the past.
tostring (schemas)
An ISO-8601 date time marking the exclusive end of the result. Must be URL encoded.
mediumIdsArray of strings (mediumId)
Filter by medium identifier. If no mediumId filter is provided, the messages sent in any connected mediums will be included. Choices: fb twit instagram messagebird rtm whatsapp twilio wechat mailgun telegram viber
channelIdsArray of strings (ChannelId)
Filter by channel identifier (use Channel API, and GET /channel/ to get a list of your channels). If no channelId filter is provided, the messages sent from all connected channels will be included.
handleTimeTypesArray of strings
Items Enum: "HANDLE_TIME" "NO_REPLY_TIME" "CHERRY_PICKING"
userIdsArray of strings (userId)
Use Organization API, and GET /organization/user to get a list of users.

Request samples​

Request sample

Content type: application/json

{
"from": "string",
"to": "string",
"mediumIds": [
"fb"
],
"channelIds": [
"string"
],
"teamIds": [
"string"
],
"handleTimeTypes": [
"HANDLE_TIME"
]
}

Responses​

200 Success

RESPONSE SCHEMA: application/json
value
integer

Samples​

200 Success

Content type: application/json

Example: SingleValue

6

401 Unauthorized

Unauthorized: when using an invalid or expired access token.

Average Handle Time​

DEPRECATED: Please use the POST version of this endpoint.

The average time in seconds that a conversation is handled by an agent, specifically the difference between timestamps of conversation open and conversation pend/resolve. For Average Handle Time to be calculated, there must be an outbound between open and pend/resolve event.

Example URI:

GET /reporting-metrics/handle-time

URI parameters​

fromstring (required)
An ISO-8601 date time marking the inclusive start of the result. Must be URL encoded. The from filter can be a maximum of 14 days in the past.
tostring (optional)
An ISO-8601 date time marking the exclusive end of the result
mediumIdstring (optional)
Filter by medium identifier. If no mediumId filter is provided, the messages sent in any connected mediums will be included. Choices: fb twit instagram messagebird rtm whatsapp twilio wechat mailgun telegram viber
channelIdstring (optional)
Filter by channel identifier (use Channel API, and GET /channel/ to get a list of your channels). If no channelId filter is provided, the messages sent from all connected channels will be included.

Request

curl -X GET -G https://public-api.sparkcentral.com/reporting-metrics/handle-time \
--header 'Authorization: Bearer <token>' \
--data 'from=2017-06-22T14%3A00%3A00'

or

curl -X GET -G https://public-api-eu.sparkcentral.com/reporting-metrics/handle-time \
--header 'Authorization: Bearer <token>' \
--data 'from=2017-06-22T14%3A00%3A00'

Response 200

Headers

Content-Type: application/json

Body

{
"dataPoint": {
"value": 2127
}
}

Request

curl -X GET -G https://public-api.sparkcentral.com/reporting-metrics/handle-time \
--header 'Authorization: Bearer <token>' \
--data 'mediumId='

or

curl -X GET -G https://public-api-eu.sparkcentral.com/reporting-metrics/handle-time \
--header 'Authorization: Bearer <token>' \
--data 'mediumId='

Response 400

Headers

Content-Type: application/json

Body

{
"errors": [
"Bad request parameters. java.lang.IllegalArgumentException: Not a valid mediumId."
],
"errorType": null
}

Agent Availability​

The number of agents available or away. You can filter by teams.

Authorization

Bearer token

URI

POST /user-presence/metrics/agent-availability

Request Body Schema: application/json​

userPresenceStatusstring (optional)
Agent status to filter on. It is recommended to always provide userPresenceStatus; the result will always be 0 otherwise. Choices: away available
teamIdsArray of strings
Use Organization API, and GET /organization/team to get a list of your teams.

Request samples​

Request sample

Content type: application/json

{
"channelIds": [
"string"
],
"teamIds": [
"string"
],
"userPresenceStatus": "AWAY"
}

Responses​

200 Success

RESPONSE SCHEMA: application/json
value
integer

Samples​

200 Success

Content type: application/json

{
"value": 30
}

401 Unauthorized

Unauthorized: when using an invalid or expired access token.

Agent Availability​

DEPRECATED: Please use the POST version of this endpoint.

The number of agents available or away.

Example URI:

GET /reporting-metrics/agent-availability

URI parameters​

userPresenceStatusstring (optional)
Agent status to filter on. It is recommended to always provide userPresenceStatus; the result will always be 0 otherwise. Choices: away available
channelIdstring (optional)
Filter by channel identifier (use Channel API, and GET /channel/ to get a list of your channels). If no channelId filter is provided, the messages sent from all connected channels will be included.

Request

curl -X GET -G https://public-api.sparkcentral.com/reporting-metrics/agent-availability \
--header 'Authorization: Bearer <token>' \
--data 'userPresenceStatus=away'

or

curl -X GET -G https://public-api-eu.sparkcentral.com/reporting-metrics/agent-availability \
--header 'Authorization: Bearer <token>' \
--data 'userPresenceStatus=away'

Response 200

Headers

Content-Type: application/json

Body

{
"dataPoint": {
"value": 2127
}
}

Contacts Waiting in Queue​

The number of contacts waiting in the queue for a response.

Authorization

Bearer token

URI

POST /queue-metrics/contacts-waiting

Request Body Schema: application/json​

statusstring (required)
Queue status to filter on. Choices: NEW PENDING
mediumIdstring (schemas)
Filter by medium identifier. Choices: fb twit instagram messagebird rtm whatsapp twilio wechat mailgun telegram viber
channelIdsArray of strings
Filter by channel identifier (use Channel API, and GET /channel/ to get a list of your channels). If no channelIds filter is provided, the messages sent from all connected channels will be included.
teamIdsArray of strings
Use Organization API, and GET /organization/team to get a list of your teams.
groupBystring
Enum: "CHANNEL" "OWNER" "TOPIC" "TEAM"

Request samples​

Request sample

Content type: application/json

{
"channelIds": [
"string"
],
"mediumId": "fb",
"groupBy": "CHANNEL",
"status": "NEW"
}

Responses​

200 Success

RESPONSE SCHEMA: application/json
NumberMetricResponse
value
integer

GroupedMetricResponse
value object
property name* object (NumberMetricResponse)

Samples​

200 Success

Content type: application/json

SingleValue
6

groupByChannel

{
"c3144df7-8a04-4b20-b60a-ccfe97723780": {
"value": 4
},
"3b48a76e-4289-44b8-ac15-c8b60d21f158": {
"value": 2
}
}

401 Unauthorized

Unauthorized: when using an invalid or expired access token.

Contacts Waiting in Queue​

DEPRECATED: Please use the POST version of this endpoint.

The number of contacts waiting in the queue for a response.

Example URI:

GET /queue-metrics/contacts-waiting

URI parameters​

statusstring (required)
Queue status to filter on. Choices: new pending
mediumIdstring (optional)
Filter by medium identifier. If no mediumId filter is provided, the messages sent in any connected mediums will be included. Choices: fb twit instagram messagebird rtm whatsapp twilio wechat mailgun telegram viber
channelIdstring (optional)
Filter by channel identifier (use Channel API, and GET /channel/ to get a list of your channels). If no channelId filter is provided, the messages sent from all connected channels will be included.

Request

curl -X GET -G https://public-api.sparkcentral.com/queue-metrics/contacts-waiting \
--header 'Authorization: Bearer <token>' \
--data 'status=new'

or

curl -X GET -G https://public-api-eu.sparkcentral.com/queue-metrics/contacts-waiting \
--header 'Authorization: Bearer <token>' \
--data 'status=new'

Response 201

Headers

Content-Type: application/json

Body

{
"dataPoint": {
"value": 2127
}
}

Request

curl -X GET -G https://public-api.sparkcentral.com/queue-metrics/contacts-waiting \
--header 'Authorization: Bearer <token>' \
--data 'mediumId='

or

curl -X GET -G https://public-api-eu.sparkcentral.com/queue-metrics/contacts-waiting \
--header 'Authorization: Bearer <token>' \
--data 'mediumId='

Response 200

Headers

Content-Type: application/json

Body

{
"dataPoint": {
"value": null
}
}

Request

curl -X GET -G https://public-api.sparkcentral.com/queue-metrics/contacts-waiting \
--header 'Authorization: Bearer <token>' \
--data 'mediumId=facebook'

or

curl -X GET -G https://public-api-eu.sparkcentral.com/queue-metrics/contacts-waiting \
--header 'Authorization: Bearer <token>' \
--data 'mediumId=facebook'

Response 400

Headers

Content-Type: application/json

Body

{
"timestamp": 1505325885724,
"status": 400,
"error": "Bad Request",
"exception": "org.springframework.web.bind.MissingServletRequestParameterException",
"message": "Required String parameter 'status' is not present",
"path": "/contacts-waiting"
}

Longest Wait Time in Queue​

The current longest time in seconds that a contact is waiting for a response. If no mediumId filter is provided, the messages sent in any connected mediums will be included.

Authorization

Bearer token

URI

POST /queue-metrics/longest-wait-time

Request Body Schema: application/json​

statusstring (required)
Queue status to filter on Choices: NEW PENDING
mediumIdsstring (optional)
Filter by medium identifier Choices: fb twit instagram messagebird rtm whatsapp twilio wechat mailgun telegram viber.
channelIdsstring (optional)
Filter by channel identifier (use Channel API, and GET /channel/ to get a list of your channels). If no channelId filter is provided, the messages sent from all connected channels will be included.
teamIdsstring (optional)
Filter by team identifiers.
groupBystring (optional)
Enum: "CHANNEL" "OWNER" "TOPIC" "TEAM"

Request samples​

Request sample

Content type: application/json

{
"channelIds": [
"string"
],
"mediumId": "fb",
"groupBy": "CHANNEL",
"status": "NEW"
}

Responses​

200 Success

RESPONSE SCHEMA: application/json
NumberMetricResponse
value
integer

GroupedMetricResponse
value object
property name* object (NumberMetricResponse)

Samples​

200 Success

Content type: application/json

SingleValue
6

groupByChannel

{
"c3144df7-8a04-4b20-b60a-ccfe97723780": {
"value": 131
},
"3b48a76e-4289-44b8-ac15-c8b60d21f158": {
"value": 155
}
}

401 Unauthorized

Unauthorized: when using an invalid or expired access token.

Longest Wait Time in Queue​

DEPRECATED: Please use the POST version of this endpoint.

The current longest time in seconds that a contact is waiting for a response. If no mediumId filter is provided, the messages sent in any connected mediums will be included.

Example URI:

GET /queue-metrics/longest-wait-time

URI parameters​

statusstring (required)
Queue status to filter on Choices: new pending
mediumIdstring (optional)
Filter by medium identifier Choices: f b twit instagram messagebird rtm whatsapp twilio wechat mailgun telegram viber
channelIdstring (optional)
Filter by channel identifier (use Channel API, and GET /channel/ to get a list of your channels). If no channelId filter is provided, the messages sent from all connected channels will be included.

Request

curl -X GET -G https://public-api.sparkcentral.com/queue-metrics/longest-wait-time \
--header 'Authorization: Bearer <token>' \
--data 'status=new'

or

curl -X GET -G https://public-api-eu.sparkcentral.com/queue-metrics/longest-wait-time \
--header 'Authorization: Bearer <token>' \
--data 'status=new'

Response 200

Headers

Content-Type: application/json

Body

{
"dataPoint": {
"value": 2127
}
}

Organization API​

URI​

GET /organization/user

Example response​

{
"users": [
{
"id": "b4770659-a342-4171-bbd9-efd9429a955a",
"firstName": "John",
"lastName": "Doe"
}
]
}

URI​

GET /organization/team

Example response​

{
"teams": [
{
"id": "b4770659-a342-4171-bbd9-efd9429a955a",
"name": "Team Name"
}
]
}

Channel API​

URI​

GET /channel

Response​

{
"channels": [
{
"id": "b4770659-a342-4171-bbd9-efd9429a955a",
"name": "Channel Name"
}
]
}

User Presence API​

Online Agents​

List of all currently online agents.

GET /user-presence/online-agents

Example response​

{
"agents": [
{
"id": "e7553889-d775-11ec-9dc9-4e81c846c8b4",
"userPresence": "AVAILABLE",
"statusChangedAt": "2022-05-19T13:16:33.413Z"
},
{
"id": "f7553884-d876-11ec-3dc5-4e81684ac8bb",
"userPresence": "AWAY",
"awayStateId": "e75893ea-d775-11ec-9dc9-4e81c846c8b4",
"statusChangedAt": "2022-05-19T13:17:34.414Z"
}
]
}