Webhooks filters

Hi!

I need some assitance to make work a webhook with two different filters.

  • Comments added in a specific task → IITS WORKING
  • Due date change in specific task (The same taks as before) → NOT WORKING

I receive added storys via webhooks, but not the event of that the due date change, how can achieve this?

{
“data”: {
“resource”: “1191784326921361” ------> TASK ID,
“filters”: [
{
“resource_type”: “story”,
“resource_subtype”: “comment_added”,
“action”: “added”
},
{
“resource_type”: “task”,
“resource_subtype”: “due_on”,
“action”: “changed”,
“fields”:[
“due_on”
]
}
],
“target”: TARGET
}
}

Thanks a lot for the help!

Another detail: if i create different webhooks with those filters, both work separated but not together

Right! You can’t combine two different resource_types in one filter. Why not? Because when you specify the first filter of “resource_type”: “story”, that filters out events from other resource types including task. That is, you’ve filtered out all task events by specifying the first filter.

Doing them as separate webhooks is the only way to get both types of events.

Thanks Phil, but the problem that i found is that i cant create both webhooks simunstaniously. I mean, what i did was:

Create a webhook for comments, tested and it work
Delete the webhook
Create a webhook for due date, tested and it work

If i try to stablish both webhooks i receive a error that says that for that resource (the task) there is a already stablish a webhook. I cant make it work both webhooks at the same time.

If you can give me any help with this it would be great.

Thanks a lot.

I get to solve this.

I create the 2 webhooks separatly and use an especifi URL with diferent path.

Thanks.

Are you sure it works this way or this is intended functionality?

The description of filters says

An array of WebhookFilter objects to specify a whitelist of filters to apply to events from this webhook. If a webhook event passes any of the filters the event will be delivered; otherwise no event will be sent to the receiving server.

Shouldn’t any event that matches a filter pass? It doesn’t mention that all filters needed to be matched for an event to pass.

I’m not 100% sure of ANYTHING regarding webhook filters! I haven’t had much change to use or experiment with them yet.

@Ross_Grambo maybe you can weigh in here? Thanks!

Haha. Honestly, that’s how I feel too :cold_sweat:. My understanding is that the whitelist works as @Integromat_Dev quoted. Meaning multiple filters should provide data that fits either. I’m going to file this as a bug and I’ll give an update here if it’s not suppose to work that way.

1 Like

From my personal testing:

Combining filters seems to work (I was able to copy the opening post and it worked just perfectly fine for me).

Filtering purely on a resource_subtype does not do anything. In the above example (opening post), the filtering on task due_on merely works because the user added fields: [“due_on”]. Once you remove the fields variable and keep resource_subtype = “due_on” the webhook triggers on any task event.

From my personal testing:

Combining filters seems to work (I was able to copy the opening post and it worked just perfectly fine for me).

Filtering purely on a resource_subtype does not do anything. In the above example (opening post), the filtering on task due_on merely works because the user added fields: [“due_on”]. Once you remove the fields variable and keep resource_subtype = “due_on” the webhook triggers on any task event.

Additionally: I checked all the resources below and not all of them work as a resource for webhook:

  • Attachment → doesn’t work (not a valid object error)
  • Portfolio
  • Project
  • Project Membership → doesn’t work (not a valid object error)
  • Section → doesn’t work (not a valid object error)
  • Story
  • Tag
  • Task
  • Team
  • Team Membership → doesn’t work (not a valid object error)
  • Workspace
  • Workspace Memberships → doesn’t work (not a valid object error)

Louis

2 Likes

Great info, thanks Louis aka @Integromat_Dev!

2 Likes

where can I find a list of the available parameters to filter?
I tried the API Documentation, but no luck

Like, available resource types and sub_types

@Eden,

Alas there is no comprehensive list. I’ve been trying to get them to produce one for a while now, but so far no luck.

Sub_types are not supported in webhook filters; don’t bother putting them in, they won’t do anything.

1 Like

oh darn. Thank you for the info!

Sections are still not working. It gives a “Not a valid object” error although we checked that the section exists from API Explorer. Could you help me?

Do you mean as a resource or as a filter?