Segment
- 28 Jul 2022
- 4 Minutes to read
- Print
- DarkLight
Segment
- Updated on 28 Jul 2022
- 4 Minutes to read
- Print
- DarkLight
Article summary
Did you find this summary helpful?
Thank you for your feedback
Segment
You need the Manage Settings permission to manage Segment.
Segments
- Segments ManageGET livechat/segments
- Get the list of SegmentsGET livechat/segments/{id}
- Get a single SegmentPOST livechat/segments
- Create a new SegmentPUT livechat/segments/{id}
- Update the SegmentDELETE livechat/segments/{id}
- Remove the Segment
Segment JSON Format
Segment is represented as simple flat JSON objects with the following keys:
Name | Type | Description |
---|---|---|
alertToType | string | Allowed values are "department", "agent", "none". |
conditionMetType | string | Allowed values are "all", "any", "logicalExpression". |
logicalExpression | string | The logical expression for conditions |
id | guid | Id of the segment. |
name | string | Name of the segment. |
isEnabled | bool | Whether this segment is enabled or not. |
description | string | Description of the segment. |
color | string | Color of the segment. |
order | integer | Order of the segment. |
segmentConditions | segmentConditions[] | Reference to Segment Condition. |
agentIds | array | The list of the segment identifiers, which the agent belongs to. |
departmentIds | array | The list of the segment identifiers, which the department belongs to. |
Segment Condition JSON Format:
Name | Type | Description | ||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
id | guid | Id of the segment condition. | ||||||||||||||||||||||||||||||||||
segmentId | guid | Id of the segment which the segment condition belongs to. | ||||||||||||||||||||||||||||||||||
fieldName | string | Name of the field.
| ||||||||||||||||||||||||||||||||||
operator | string | Allowed values are "is", "contains", "notContains", "isMoreThan", "isLessThan", "isNot", "isNotLessThan", "isNotMoreThan", "regularExpression", "isOneOf", "isNotIn", "dateNotEqualTo", "before", "after", "dateEqualTo". | ||||||||||||||||||||||||||||||||||
value | string | Value of the segment condition. | ||||||||||||||||||||||||||||||||||
order | integer | Order of the segment condition. | ||||||||||||||||||||||||||||||||||
description | string | Description of the segment condition. |
Get the list of Segments
GET livechat/segments
Parameters:
Name | Type | in | Required | Description |
---|---|---|---|---|
include | string | query | no | Allowed values are "segmentCondition", "agent", "department". |
Response:
An array of Segment
Example
Sample Request:
curl https://api11.comm100.io/v4/livechat/segments \
-X 'GET' \
-H 'Authorization: Bearer {access_token}' \
Response:
HTTP/1.1 200 OK
[
{
"alertToType": "none",
"conditionMetType": "all",
"logicalExpression": "",
"id": "b797848b-0e86-41ac-b048-d72bd0f075ed",
"name": "Segment One",
"isEnabled": false,
"description": "This is Segment One",
"color": "#339FD9",
"order": 2,
"segmentConditions": [
{
"id": "76ec9bdb-854a-4536-8d5b-451b75b908b9",
"segmentId": "51b60908-28db-427f-aebc-b3afa145f051",
"fieldName": "{!Visitor.Number of visits}",
"operator": "is",
"value": "3",
"order": 0,
"description": "Segment - Number of visits"
}
],
"agentIds": [
"4BA2EF45-7D46-EB11-8100-00155D081D0B"
],
"departmentIds": [
"6fd98c99-f183-4247-bdda-47491426e577"
]
}
]
Get a single Segment
GET livechat/segments/{id}
Parameters:
Name | Type | in | Required | Description |
---|---|---|---|---|
include | string | query | no | Allowed values are "segmentCondition", "agent", "department". |
Response:
Example
Sample Request:
curl https://api11.comm100.io/v4/livechat/segments/b797848b-0e86-41ac-b048-d72bd0f075ed \
-X 'GET' \
-H 'Authorization: Bearer {access_token}' \
Response:
HTTP/1.1 200 OK
{
"alertToType": "none",
"conditionMetType": "all",
"logicalExpression": "",
"id": "b797848b-0e86-41ac-b048-d72bd0f075ed",
"name": "Segment One",
"isEnabled": false,
"description": "This is Segment One",
"color": "#339FD9",
"order": 2,
"segmentConditions": [
{
"id": "76ec9bdb-854a-4536-8d5b-451b75b908b9",
"segmentId": "51b60908-28db-427f-aebc-b3afa145f051",
"fieldName": "{!Visitor.Number of visits}",
"operator": "is",
"value": "3",
"order": 0,
"description": "Segment - Number of visits"
}
],
"agentIds": [
"4BA2EF45-7D46-EB11-8100-00155D081D0B"
],
"departmentIds": [
"6fd98c99-f183-4247-bdda-47491426e577"
]
}
Create a new Segment
POST livechat/segments
Parameters:
Name | Type | in | Required | Description |
---|---|---|---|---|
alertToType | string | body | no | Allowed values are "department", "agent", "none". |
conditionMetType | string | body | no | Allowed values are "all", "any", "logicalExpression". |
logicalExpression | string | body | yes | The logical expression for conditions |
name | string | body | yes | Name of the segment. |
isEnabled | bool | body | no | Whether this segment is enabled or not. |
description | string | body | no | Description of the segment. |
color | string | body | no | Color of the segment. |
order | integer | body | no | Order of the segment. |
segmentConditions | segmentConditions[] | body | no | Reference to Segment Condition. |
agentIds | array | body | no | The list of the segment identifiers, which the agent belongs to. |
departmentIds | array | body | no | The list of the segment identifiers, which the department belongs to. |
Response:
Example
Sample Request:
curl https://api11.comm100.io/v4/livechat/segments \
-X 'POST' \
-H 'Authorization: Bearer {access_token}' \
-H 'Content-Type: application/json' \
-D '{"alertToType":"none","conditionMetType":"all","logicalExpression":"","name":"Segment One","isEnabled":false,"description":"This is Segment One","color":"#339FD9","order":2,"segmentConditions":[{"fieldName":"{!Visitor.Number of visits}","operator":"is","value":"3","order":0,"description":"Segment - Number of visits"}]}'
Response:
HTTP/1.1 201 Created
{
"alertToType": "none",
"conditionMetType": "all",
"logicalExpression": "",
"id": "b797848b-0e86-41ac-b048-d72bd0f075ed",
"name": "Segment One",
"isEnabled": false,
"description": "This is Segment One",
"color": "#339FD9",
"order": 2,
"segmentConditions": [
{
"id": "76ec9bdb-854a-4536-8d5b-451b75b908b9",
"segmentId": "51b60908-28db-427f-aebc-b3afa145f051",
"fieldName": "{!Visitor.Number of visits}",
"operator": "is",
"value": "3",
"order": 0,
"description": "Segment - Number of visits"
}
],
"agentIds": [
"4BA2EF45-7D46-EB11-8100-00155D081D0B"
],
"departmentIds": [
"6fd98c99-f183-4247-bdda-47491426e577"
]
}
Update the Segment
PUT livechat/segments/{id}
Parameters:
Name | Type | in | Required | Description |
---|---|---|---|---|
alertToType | string | body | no | Allowed values are "department", "agent", "none". |
conditionMetType | string | body | no | Allowed values are "all", "any", "logicalExpression". |
logicalExpression | string | body | no | The logical expression for conditions |
name | string | body | no | Name of the segment. |
isEnabled | bool | body | no | Whether this segment is enabled or not. |
description | string | body | no | Description of the segment. |
color | string | body | no | Color of the segment. |
order | integer | body | no | Order of the segment. |
segmentConditions | segmentConditions[] | body | no | Reference to Segment Condition. |
agentIds | array | body | no | The list of the segment identifiers, which the agent belongs to. |
departmentIds | array | body | no | The list of the segment identifiers, which the department belongs to. |
Response:
Example
Sample Request:
curl https://api11.comm100.io/v4/livechat/segments/b797848b-0e86-41ac-b048-d72bd0f075ed \
-X 'PUT' \
-H 'Authorization: Bearer {access_token}' \
-H 'Content-Type: application/json' \
-D '{"alertToType":"none","conditionMetType":"all","logicalExpression":"","name":"Segment One","isEnabled":false,"description":"This is Segment One","color":"#339FD9","order":2,"segmentConditions":[{"fieldName":"{!Visitor.Number of visits}","operator":"is","value":"3","order":0,"description":"Segment - Number of visits"}]}'
Response:
HTTP/1.1 200 OK
{
"alertToType": "none",
"conditionMetType": "all",
"logicalExpression": "",
"id": "b797848b-0e86-41ac-b048-d72bd0f075ed",
"name": "Segment One",
"isEnabled": false,
"description": "This is Segment One",
"color": "#339FD9",
"order": 2,
"segmentConditions": [
{
"id": "76ec9bdb-854a-4536-8d5b-451b75b908b9",
"segmentId": "51b60908-28db-427f-aebc-b3afa145f051",
"fieldName": "{!Visitor.Number of visits}",
"operator": "is",
"value": "3",
"order": 0,
"description": "Segment - Number of visits"
}
],
"agentIds": [
"4BA2EF45-7D46-EB11-8100-00155D081D0B"
],
"departmentIds": [
"6fd98c99-f183-4247-bdda-47491426e577"
]
}
Remove the Segment
DELETE livechat/segments/{id}
Parameters:
No Parameters
Response:
No Content
Example
Sample Request:
curl https://api11.comm100.io/v4/livechat/segments/b797848b-0e86-41ac-b048-d72bd0f075ed \
-X 'DELETE' \
-H 'Authorization: Bearer {access_token}' \
Response:
HTTP/1.1 204 No Content
Was this article helpful?