Segment

You need the Manage Settings permission to manage Segment.

Segments
- Segments Manage
GET livechat/segments
GET livechat/segments/{id}
POST livechat/segments
PUT livechat/segments/{id}
DELETE livechat/segments/{id}
Model
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.
name operator
{!Visitor.Number of visits} is/isNot/isMoreThan/isLessThan
{!Visitor.Number of chats} is/isNot/isMoreThan/isLessThan
{!Visitor.Current Page URL} is/isNot/contains/notContains/regularExpression
{!Visitor.Referrer URL} is/isNot/contains/notContains/regularExpression
{!Visitor.Landing Page URL} is/isNot/contains/notContains/regularExpression
{!Visitor.Search Engine} is/isNot/contains/notContains/regularExpression
{!Visitor.Search Keywords} is/isNot/contains/notContains/regularExpression
{!Visitor.Country/Region} is/isNot/contains/notContains/regularExpression
{!Visitor.State/Province} is/isNot/contains/notContains/regularExpression
{!Visitor.City} is/isNot/contains/notContains/regularExpression
{!Visitor.Operating System} is/isNot/contains/notContains/regularExpression
{!Visitor.Time Zone} isOneOf/isNotIn
{!Visitor.Language} is/isNot/contains/notContains/regularExpression
{!Visitor.Campaign} isOneOf/isNotIn
{!Chat.Request Page URL} is/isNot/contains/notContains/regularExpression
Other custom filters, allowed values are all fields of pre-chat,post-chat,offline message, e.g., {!Pre-Chat.Name}. Allowed values are "is", "contains", "notContains", "isMoreThan", "isLessThan", "isNot", "isNotLessThan", "isNotMoreThan", "regularExpression", "isOneOf", "isNotIn", e.g., contains.
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.
Endpoint
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://api15.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://api15.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://api15.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 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://api15.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://api15.comm100.io/v4/livechat/segments/b797848b-0e86-41ac-b048-d72bd0f075ed \
-X 'DELETE' \
-H 'Authorization: Bearer {access_token}' \

Response:

 HTTP/1.1 204 No Content