User Segment
ChatBot automatically collects all users that chat with the bot and stores their data in the Users section. You can browse this section to find a particular person or a group that meets specified criteria.
Create segment
Creates new segment.
POST
https://api.chatbot.com/segments
Properties
parameter | type | required | default |
---|---|---|---|
name |
String(1, 256) | required |
Request URL
curl --request POST \
--url https://api.chatbot.com/segments \
--header 'authorization: Bearer ${DEVELOPER_ACCESS_TOKEN}' \
--header 'content-type: application/json'
Response Example
{
"id": "\<ID\>",
"timestamp": "2018-01-19T11:55:07.552Z",
"status": {
"code": 200,
"type": "success"
}
}
List segments
Returns list of Segments.
GET
https://api.chatbot.com/segments
Request URL
curl --request GET \
--url https://api.chatbot.com/segments \
--header 'authorization: Bearer ${DEVELOPER_ACCESS_TOKEN}'
Response Example
[
{
"id": "5b7ff8476f7g3fb33c9249a8",
"name": "Foo",
"users": 0,
"createdAt": "2019-01-23 13:32:30.163Z"
}
]
Segment object
parameter | type |
---|---|
id |
String |
name |
String |
users |
Number |
createdAt |
String |
Update segment
Update segment name.
PUT
https://api.chatbot.com/segments/:id
URL Params
Required:
id=[alphanumeric]
Properties
parameter | type | required | default |
---|---|---|---|
name |
String(1, 256) | required |
Request URL
curl --request PUT \
--url https://api.chatbot.com/segments/:id \
--header 'authorization: Bearer ${DEVELOPER_ACCESS_TOKEN}' \
--header 'content-type: application/json'
Response Example
{
"timestamp": "2018-01-19T11:55:07.552Z",
"status": {
"code": 200,
"type": "success"
}
}
Remove segment
Remove segment.
DELETE
https://api.chatbot.com/segments/:id
URL Params
Required:
id=[alphanumeric]
Request URL
curl --request DELETE \
--url https://api.chatbot.com/segments/:id \
--header 'authorization: Bearer ${DEVELOPER_ACCESS_TOKEN}' \
--header 'content-type: application/json'
Response Example
{
"timestamp": "2018-01-19T11:55:07.552Z",
"status": {
"code": 200,
"type": "success"
}
}
Add members
Adds one or more Users to on or more Segments.
POST
https://api.chatbot.com/segments/members
Properties
parameter | type | required |
---|---|---|
segments |
String[1,100] | required |
users |
String[1,1000] | required |
Request URL
curl --request POST \
--url https://api.chatbot.com/segments/members \
--header 'authorization: Bearer ${DEVELOPER_ACCESS_TOKEN}' \
--header 'content-type: application/json'
Response Example
{
"timestamp": "2018-01-19T11:55:07.552Z",
"status": {
"code": 200,
"type": "success"
}
}