Register New Department

HTTP MethodURLRequires Auth

POST

/api/v1/livechat/department

Body Parameters

KeyExample ValueDescription

department*

{ "department":

{ ... } }

The object which takes the department details.

name*

testDept

The name of the department you are creating.

email*

abc@testdept.com

The email ID associated with the department.

enabled*

false

Whether you want to enable the department. The value can be boolean true or false.

showOnRegistration*

false

You can let visitors choose the department they want to talk to. The option will appear to your customer in the Live Chat widget.

The value can be boolean true or false.

showOnOfflineForm*

false

If you want your department to be displayed during off-business hours. The value can be boolean true or false.

description

Test department

A description of your department.

agents

{ "agents":

{ ... } }

The object with the agent details that you want to add to the department.

agentId

SQafHvoFPuB57NmBD

The agent ID that you want to assign to the department.

count

11

The number of chats served by the agent. Enter a value if you want to reset the stored value. Note: This field is used by the routing algorithm to determine the agents that have served the least number of chats and assign new chats to them.

order

1

The order in which the agents are assigned to chats.

Example Call

curl -H "X-Auth-Token: 9HqLlyZOugoStsXCUfD_0YdwnNnunAJF8V47U3QHXSq" \
     -H "X-User-Id: aobEdbYhXfu5hkeqG" \
     -X POST \
     -H "Content-type:application/json" \
     http://localhost:3000/api/v1/livechat/department \
    -d '{
         "department": 
            {"enabled": false, 
             "showOnRegistration": true, 
             "name": "new from api", 
             "email": "john@doe.com", 
             "showOnOfflineForm": true }, 
         "agents": [{ 
             "agentId": "SQafHvoFPuB57NmBD" }] }'

Example Response

{
  "department": {
    "enabled": false,
    "name": "new from api",
    "numAgents": 1,
    "showOnRegistration": true,
    "_updatedAt": "2016-12-13T17:22:19.109Z",
    "_id": "iTfLCX3qqwKgf5uqg"
  },
  "agents": [
    {
      "agentId": "SQafHvoFPuB57NmBD",
      "count": 0,
      "order": 0,
    }
  ],
  "success": true
}

Change Log

VersionDescription

1.0.0

New fields for department updated

0.42.0

Added

Last updated

Rocket.Chat versions receive support for six months after release.