Recent searches
No recent searches
What is wrong about my trigger creation request?
Posted Feb 01, 2023
I am following this instruction to create a trigger by calling this endpoint:
POST https://wunderkindtest.zendesk.com/api/v2/triggers
The request body:
{"title":"Test trigger","active":true,"conditions":{"all":[{"field":"comment_is_public","value":true},{"field":"update_type","value":"Change"}]},"actions":[{"field":"notification_webhook","value":["abc","123"]}]}
I got the response:
{"error": "RecordInvalid","description": "Record validation errors","details": {"base": [{"description": "Invalid conditions. You must select at least one condition."}]}}May I know what's wrong on my request body? How should I correct it? Thanks,Junsheng
0
6
6 comments
Jack
You need to also specify any conditions, you correctly have “all” conditions, I think maybe an empty array for “any” would fix this.
0
Junsheng Wu
It doesn't work even if I added `any`:
0
Jack
My mistake, I think maybe it’s because your conditions do not have any operators? Please see this docs page for examples on creating or updating triggers https://developer.zendesk.com/documentation/ticketing/reference-guides/conditions-reference/
0
Junsheng Wu
Thank you for reply, but I don't think that's the reason since I tested by following json with operator in the condition, it did not work:
operator
propertyoperator
propertyoperator
property0
Jack
Ah ok!
I believe the problem is that you are not including the "trigger" parameter that the request requires, try this:
1
Junsheng Wu
Thank you Jack. Yes, you are right. It works after wrapping with "trigger" node. In the meanwhile, I found a issue when creating a trigger with this condition:
{
"field":"current_via_id",
"operator":"is",
"value":0
}
After creation, the UI shows:
It suppose to be:
But anyway, this condition works as expected just a UI issue I guess.
Junsheng
0