Links

Update Department

Update the details of a specific department.
HTTP Method
URL
Requires Auth
PUT
/api/v1/livechat/department/:_id
yes
Permissions required:
  • manage-livechat-departments
  • add-livechat-department-agents

Path Variables

Key
Example Value
Description
_id*
iTfLCX3qqwKgf5uqg
The department ID that you want to update.

Body Parameters

Key
Example Value
Description
department*
{ "department":
{ ... } }
The object which takes the department details.
name*
testDept
The name of the department you are creating.
email*
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.

Example Call

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

Example Response

{
"department": {
"_id": "iTfLCX3qqwKgf5uqg",
"enabled": true,
"name": "new from api - live",
"description": null,
"numAgents": 1,
"showOnRegistration": true,
"_updatedAt": "2016-12-13T17:30:02.643Z"
},
"agents": [
{
"_id": "DDjZbhTF74n3NBuWK",
"agentId": "SQafHvoFPuB57NmBD",
"departmentId": "iTfLCX3qqwKgf5uqg",
"username": "john.doe",
"count": 0,
"order": 0,
"_updatedAt": "2016-12-13T17:30:02.656Z"
}
],
"success": true
}

Change Log

Version
Description
0.42.0
Added
Last modified 6d ago
Deprecation for cloud services and apps is now extended to November 20, 2023. Rocket.Chat versions receive support for six months after release.