Create an Intelligent Trigger Rule
Description
You can use this API to create an intelligent trigger rule.
OAuth Scope:
triggerrules.CREATE
Requested Payload:
- app_id (Mandatory): ID of the website to which the rule is to be mapped.
- and_criteria (Mandatory): To add an additional condition and criteria to the trigger rule. You can specify a group of OR_criteria within the AND_criteria.
- or_criteria: Specifies a set of criteria containing the comparator, values, and field name ie., you can provide more than one criteria and the rule will execute if the visitor matches any of the given criteria.
- field_name: Fields that you set to filter the visitor who matches the rule.
- sub_fields: The sub field that you set to filter the visitor who matches the rule.
- comparator: The comparator strings for that specific rule you have set is used to match the values (eg: Contains, Equals to, etc.)
- values: The values that you have defined for each field that the visitor should obtain to match the rule.
- title: Name of the trigger rule
- event: Instant at which the trigger is to be set off
- type: Type of trigger to be used
- sender_name: On behalf of whom the chat invite is to be sent
- delay: Time frame after which the chat window is to be opened
- integ_name : The name of the integration.
You can use the Field name, Comparator, and values to populate the criteria of the intelligent trigger rule. You can also find the data type of these keys in the criteria of the fields section.
URL:
Copiedhttps://{zohosalesiq_server_uri}/api/v2/{screenname}/triggerrules
Example
Copiedhttps://salesiq.zoho.com/api/v2/zylkerinc/triggerrules
Payload
Copied{
"app_id": "44000000000047",
"title": "Chat invite",
"and_criteria": [
{
"or_criteria": [
{
"comparator": "is_equal_to",
"values": [
"Japan"
],
"field_name": "country"
},
{
"comparator": "is_equal_to",
"sub_field": "No of Open Deals",
"values": [
"12"
],
"field_name": "crm_deal",
"integ_name": "zohocrm"
}
]
}
],
"event": {
"type": "lands_on_website"
},
"action": {
"type": "send_chat_invite",
"params": {
"sender_name": "Patricia",
"value": "Hi there"
},
"delay": "120"
}
}
Success Response
Copied{
"url": "/api/v2/zylkerinc/triggerrules",
"object": "trigger_rule",
"data": {
"id": "44000000000201",
"app": {
"name": "restapi",
"id": "34139000000002043"
},
"stats":
{
"last_triggered_time": "-1",
"failed_count": "0",
"seen_count": "0",
"replied_count": "0",
"triggered_count": "0"
},
"title": "Chat invite",
"creator": {
"id": "44000000000104"
},
"enabled": true,
"created_time": "1550639281810",
"modified_time": "1550639282210",
"position": "1",
"and_criteria": [
{
"or_criteria": [
{
"comparator": "is_equal_to",
"values": [
"Japan"
],
"field_name": "country"
},
{
"comparator": "is_equal_to",
"sub_field": "No of Open Deals",
"values": [
"12"
],
"field_name": "crm_deal",
"integ_name": "zohocrm"
}
]
}
],
"event": {
"type": "lands_on_website"
},
"action": {
"type": "send_chat_invite",
"params": {
"sender_name": "Patrcia",
"value": "hi da"
},
"delay": "120"
}
}
}