The Real Time Chat API provides REST endpoints if you want to pull data on demand. If you want to monitor or process metrics in real time, consider using the Streaming API instead.

The REST API uses the following path:

https://rtm.zopim.com/stream/{resource}

The path differs from the Chat API path, which is as follows:

https://www.zopim.com/api/v2/{resource}

Data Initialization

If data has not yet been computed for your account or after a long period of inactivity, the REST API will temporarily return Not Computed response message.

HTTP/1.1 200 OKContent-Type: application/json
{  "status_code": 200,  "message": "Not Computed!"}

Get All Chat Metrics

GET /stream/chats

Captures all the chat activity for your account.

Allowed For

  • Owner
  • Administrator
  • Agent

Using curl

curl https://rtm.zopim.com/stream/chats \  -H "Authorization: Bearer {access token}"
Example Response
HTTP/1.1 200 OKContent-Type: application/json
{  "content": {    "topic": "chats",    "data": {      "incoming_chats": 2,      "assigned_chats": 0,      "waiting_time_avg": 12,      "missed_chats": {        "30": 1,        "60": 1      },      "active_chats": 7,      ...    },    "type": "update",    "department_id": null  },  "status_code": 200}

Get Chat Metric

GET /stream/chats/{metric_key}

Returns a single chat metric for your account. See Chat Metrics for the metric key.

Allowed For

  • Owner
  • Administrator
  • Agent

Using curl

curl https://rtm.zopim.com/stream/chats/{metric_key} \  -H "Authorization: Bearer {access token}"

Parameters

Name Type In Required Description
metric_key string Path true Identifier for the metric
Example Response

GET /stream/chats/missed_chats

HTTP/1.1 200 OKContent-Type: application/json
{  "content": {    "topic": "chats",    "data": {      "missed_chats": {        "30": 1,        "60": 2      }    },    "type": "update",    "department_id": null  },  "status_code": 200}

Get Chat Metrics by Department

  • GET /stream/chats?department_id={department_id}
  • GET /stream/chats/{metric_key}?department_id={department_id}

Captures the chat activity for a specific department.

To list all the departments on your account or to fetch a department by name, use the Departments API.

To capture activity for the chats which do not belong to any department, use department_id=0.

Allowed For

  • Owner
  • Administrator
  • Agent

Parameters

Name Type In Required Description
metric_key string Path true Identifier for the metric
department_id integer Query true Identifier for a department

Using curl

curl https://rtm.zopim.com/stream/chats/{metric_key}?department_id={department_id} \  -H "Authorization: Bearer {access token}"

Example Response

GET /stream/chats?department_id=5

HTTP/1.1 200 OKContent-Type: application/json
{  "content": {    "topic": "chats",    "data": {      "incoming_chats": 0,      "waiting_time_avg": null,      "missed_chats": {        "30": 0,        "60": 0      },      ...    },    "type": "update",    "department_id": 5  },  "status_code": 200}

Get Chat Metrics for a Specific Time Window

  • GET /stream/chats?window={window_size_in_minutes}
  • GET /stream/chats/{metric_key}?window={window_size_in_minutes}

Filters the chat metrics for the given time window.

See Chat Metrics for the metrics associated to a time window. Other metrics remains unaffected.

Available time windows are 30 minutes and 60 minutes.

Allowed For

  • Owner
  • Administrator
  • Agent

Using curl

curl https://rtm.zopim.com/stream/chats/{metric_key}?window={window_size_in_minutes} \  -H "Authorization: Bearer {access token}"

Parameters

Name Type In Required Description
metric_key string Path true Identifier for the metric
window_size_in_minutes integer Query true Possible values are 30 and 60.

Example Response

GET /stream/chats/missed_chats?window=30

HTTP/1.1 200 OKContent-Type: application/json
{  "content": {    "topic": "chats",    "data": {      "missed_chats": {        "30": 1      }    },    "type": "update",    "department_id": null  },  "status_code": 200}

Get Agent Status Counts

GET /stream/agents

Returns the number of agents who are online, away, and invisible in your account.

Allowed For

  • Owner
  • Administrator
  • Agent

Using curl

curl https://rtm.zopim.com/stream/agents \  -H "Authorization: Bearer {access token}"

Example Response

HTTP/1.1 200 OKContent-Type: application/json
{  "content": {    "topic": "agents",    "data": {      "agents_online": 27,      "agents_away": 1,      "agents_invisible": 1    },    "type": "update",    "department_id": null  },  "status_code": 200}

Get Agent Status Count

GET /stream/agents/{metric_key}

Returns the number of agents who are either online, away, or invisible in your account. Specify the status with the metric key (agents_online, agents_away, agents_invisible). See Agent Metrics.

Allowed For

  • Owner
  • Administrator
  • Agent

Using curl

curl https://rtm.zopim.com/stream/agents/{metric_key} \  -H "Authorization: Bearer {access token}"

Parameters

Name Type In Required Description
metric_key string Path true Identifier for the metric

Example Response

GET /stream/agents/agents_online

HTTP/1.1 200 OKContent-Type: application/json
{  "content": {    "topic": "agents",    "data": {      "agents_online": 27    },    "type": "update",    "department_id": null  },  "status_code": 200}

Get Agent Status Counts by Department

  • GET /stream/agents?department_id={department_id}
  • GET /stream/agents/{metric_key}?department_id={department_id}

Returns the number of agents by status for a specific department.

To list all the departments on your account or to fetch a department by name, use the Departments API.

To count the agents who do not belong to any department, use department_id=0.

Allowed For

  • Owner
  • Administrator
  • Agent

Parameters

Name Type In Required Description
metric_key string Path true Identifier for the metric
department_id integer Query true Identifier for a department

Using curl

curl https://rtm.zopim.com/stream/agents/{metric_key}?department_id={department_id} \  -H "Authorization: Bearer {access token}"

Example Response

GET /stream/agents?department_id=5

HTTP/1.1 200 OKContent-Type: application/json
{  "content": {    "topic": "agents",    "data": {      "agents_online": 26,      "agents_away": 0,      "agents_invisible": 1    },    "type": "update",    "department_id": 5  },  "status_code": 200}