Triggers
You can use the API to get or set the Trigger information.
JSON Format
Triggers are represented as JSON objects with the following attributes.
Name | Type | Read-only | Description |
---|---|---|---|
id | integer | yes | The ID of the trigger |
name | string | no | The name of the trigger |
enabled | integer | no | Whether the trigger is enabled or not |
description | string | no | The description of the trigger |
Get All Triggers
GET /api/v2/triggers
Lists all the triggers of an account.
Allowed for
- Owner
- Administrator
Using cURL
curl https://www.zopim.com/api/v2/triggers \
-v -u {email_address}:{password}
Example Response
HTTP/1.1 200 OK
Content-Type: application/json
[
{
"id" : 4,
"name" : "Good Trigger",
"enabled" : 1,
"description" : "Visitor entered page"
},
{
"id" : 5,
"name" : "Better Trigger",
"enabled" : 1,
"description" : "Visitor requested chat"
}
]
Get a Trigger
GET /api/v2/triggers/{trigger_name}
Allows an account owner/administrator to retrieve a trigger by name.
Allowed for
- Owner
- Administrator
Using cURL
curl https://www.zopim.com/api/v2/triggers/{trigger_name} \
-v -u {email_address}:{password}
Example Response
HTTP/1.1 200 OK
Content-Type: application/json
{
"id" : 4,
"name" : "Good Trigger",
"enabled" : 1,
"description" : "Visitor requested chat",
}
Create Trigger
POST /api/v2/triggers
Allows an account owner/administrator to add a trigger to an account.
Allowed for
- Owner
- Administrator
Using cURL
curl https://www.zopim.com/api/v2/triggers \
-d '{
"name" : "Good Trigger",
"enabled" : 1,
"description" : "Visitor requested chat"
}' \
-v -u {email_address}:{password} \
-X POST -H "Content-Type: application/json"
Example Response
HTTP/1.1 201 Created
Content-Type: application/json
{
"id" : 4,
"name" : "Good Trigger",
"enabled" : 1,
"description" : "Visitor requested chat",
}
Update Trigger
PUT /api/v2/triggers/{trigger_name}
Allows an account owner/administrator to update the data of a trigger.
Allowed for
- Owner
- Administrator
Using cURL
curl https://www.zopim.com/api/v2/triggers/{trigger_name} \
-d '{
"name" : "Best Trigger",
"description" : "Visitor requested new chat"
}' \
-v -u {email_address}:{password} \
-X PUT -H "Content-Type: application/json"
Example Response
HTTP/1.1 200 OK
Content-Type: application/json
{
"id" : 4,
"name" : "Best Trigger",
"enabled" : 1,
"description" : "Visitor requested new chat",
}
Delete Trigger
DELETE /api/v2/triggers/{trigger_name}
Allows an account owner/administrator to delete a trigger.
Allowed for
- Owner
- Administrator
Using cURL
curl https://www.zopim.com/api/v2/triggers/{trigger_name} \
-v -u {email_address}:{password} -X DELETE
Example Response
Status: 204 No Content