Triggers
4 min
The triggers endpoint
POST https://www.regpack.com/reg/api2/triggers/The triggers endpoint is used to configure the triggers (conditional logic) for existing products.
Basic structure
Each call to the API requires action and a group_id.
Name | Type | Required | Description |
|---|---|---|---|
action | string | true | For triggers, the only action is create. |
group_id | integer | true | This designates which project the change should be applied to. API-id in the header must be part of the organization that owns the group. |
doc | JSON | true | This contains the parameters you would like to include in the request, formatted as JSON. |
Example call
Each call to the API requires action and group_id.
curl -X POST "https://www.regpack.com/reg/api2/triggers/" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Api-Id: 15263" \
-H "Api-user: [email protected]" \
-H "Api-Token: cd2e514f-7gab-3cde-62fg-51abcd4e7362" \
-d '{
"action": "create",
"group_id": 1625251,
"doc": {
"reverse_trigger": true,
"action": {
"product_id": "2767021",
"action_type": "add_product_no_show"
},
"conditions": {
"andor": "and",
"condition_list": [
{
"field_id": "f_349514_4451053",
"field_value": "guitar"
},
{
"product_id": "2594110",
"action": "product_added"
},
{
"status_id": "90809",
"action": "set_status"
}
]
}
}
}'
Example response
{
"undo_trigger": true,
"action": {
"action_vars": {
"product_id": "1654403"
},
"action_type": "add_product_no_show"
},
"log_conds": {
"andor": "and",
"conditions": [
{
"log_ex_id": "field_set_to",
"vars": {
"field_id": "f_349514_4451053",
"field_value": "guitar"
}
},
{
"log_ex_id": "product_added",
"vars": {
"product_id": "745947"
},
"multi_id": "multi_product_added_745947"
},
{
"log_ex_id": "set_status",
"vars": {
"status_id": "70418"
},
"multi_id": "multi_set_status_70418"
}
]
},
"text_qv": " <span class=\"fs_wrap\"> <span class=\"filter_name\">Rate Type</span> <em>is</em> <span class=\"answer\"><span class=\"val\">Bucket Rate </span></span> <a href=\"javascript;\" class=\"fs_delete\" rel=\"f231\"></a> </span> <span class=\"fs_wrap\"> <span class=\"filter_name\">Administrator License - 12 month - Legacy Price - Business Package</span> <em>is</em> <span class=\"answer\"><span class=\"val\">added to user cart</span></span> <a href=\"javascript;\" class=\"fs_delete\" rel=\"multi_product_added_745947\"></a> </span> <span class=\"fs_wrap\"> <span class=\"filter_name\">Status is: Active</span> <a href=\"javascript;\" class=\"fs_delete\" rel=\"multi_set_status_70418\"></a> </span>",
"ui_obj": [
{
"trigger_id": "mongo_text_search",
"vars": [
{
"rate_type": "guitar"
}
]
},
{
"trigger_id": "product_logs",
"multi_id": "multi_product_added_745947",
"vars": [
{
"log_ex_id": "product_added"
},
{
"trigger_vars": "{\"product_id\":\"745947\"}"
}
]
},
{
"trigger_id": "set_status_log",
"vars": [
{
"log_ex_id": "set_status"
},
{
"trigger_vars": "{\"status_id\":\"70418\"}"
}
]
}
],
"group_id": "1625251",
"_id": "100906231_1656649",
"creation_date": {
"sec": 1729011822,
"usec": 42000
},
"trig_action_cond_level": "parent_condition_child_condition_child_action",
"success": true
}