Upcoming webhook improvements [Updated: Launched!]

Hi @Gijs,

You can’t ask for tasks at the workspace level (it’s potentially too big of a firehose of data).

Above the project level, you can only filter in one of the following ways:

  • "resource_type": "workspace_membership", "action": "added"
  • "resource_type": "workspace_membership", "action": "removed"
  • "resource_type": "team_membership", "action": "added"
  • "resource_type": "team_membership", "action": "removed"
  • "resource_type": "project", "action": "added"
  • "resource_type": "project", "action": "removed"
  • "resource_type": "project", "action": "deleted"
  • "resource_type": "project", "action": "undeleted"
  • "resource_type": "project", "action": "changed"
1 Like

Thank you @Phil_Seeman for the quick reply.
This was not completely clear as I continuously got the message “Webhooks for larger scoped resources must have at least one filter and all filters must be in our whitelist.”
This will work perfectly for our purpose though.

Even on the task level however, I still am not able to get the filter working. The webhook is created successfully, but there is no filter in the response. Also the webhook is called on other events except the completed_at field.
“filters”: [
{
“resource_type”: “task”,
“resource_subtype”: “deafult_task”,
“action”: “changed”,
“fields”: [
“completed_at”
]
}
]

1 Like

Can you post the exact request you’re sending?

Also, just to make sure, are you returning the X-Hook-Secret as discussed in the The webhook “handshake” part of the webhooks documentation?

Yes, sure. The webhook is created, and gets called on updates successfully. But it gets called on every event and so the filter is not applied:
I want to only get notified when the task gets completed.
When I try the following in postman:
{
“data”: {
“resource”: “12936891283649”, #task_id (not a real one)
“target”: “https://mydomain/asana-workspace-webhook/”,
“filters”: [
{
“resource_type”: “task”,
“resource_subtype”: “default_task”,
“action”: “changed”,
“fields”: [
“completed_at”
]
}
]
}
}

Actually, it seems to work now. It’s just not passing the filter in the response. Not either when getting the webhook by id at webhooks endpoint.
I was getting other updates from a different larger scope webhook.

1 Like

Ah, good news!

@Ross_Grambo or @Joe_Trollo, is that a bug that it’s not echoing back the filter? It does show in the documentation that the filter should be part of the returned data.

Yes, prior to 100% rollout (which only occurred last week) this field was only available by selecting it with opt_fields. In the next day or so it should be included by default in responses.

1 Like

Is there a way to create a webhook that is filtered by changes to a specific custom field instead of a change to any custom field? Also, is there a list of all the possible fields a webhook can filter various resources by? Thanks!

Hi @anon89270182 and welcome to the forum!

I don’t believe so. This is the only example I’ve seen of filtering on custom fields:

// Only custom field changes on tasks and comments being added
"filters": [
  {
    "resource_type": "task",
    "action": "changed",
    "fields": ["custom_fields"]
  },
  {
    "resource_type": "story",
    "resource_subtype": "comment_added",
    "action": "added"
  }
]

I’ve never seen one. @Ross_Grambo, is this something you guys could work toward adding? It would be great!

1 Like

Hmm I thought the end goal was to allow all top level fields to be valid, so we wouldn’t have to make a list. I’ll check with the API team.

If they’re allowing everything then I don’t think we need a list, if not then we definitely need a list.

Any news on this?

Hi @pedro_Botsaris,

All of the improvements mentioned in this thread (larger scopes, new events, filtering) have been released, are available, and are documented in the API documentation.

Ask here in the forum (probably best to start a new topic) if you have questions!
EDIT: Oh, I just saw you already did exactly that! :slight_smile:

1 Like

Hello, I am trying to create a Webhook that fires when the task “11-Projekt abgeschlossen” is completed in a project. Is this correct how I’m doing it? Because I got some issues, that it fires also when the task is not completed.

{
“data”: {
“resource”: “{{96653276__gid}}”,
“target”: “https://hooks.zapier.com/hooks/catch/7496423/ofatl5m/”,
“filters”: [
{
“action”:“changed”,
“resource_type”: “task”,
“name”: “11-Projekt abgeschlossen”,
“status”: “completed”,
“fields”: [
“completed_at”
]
}
]
}
}

Hi @Dany_Van_der_Meij1,

I don’t think the API provides for filtering down to the level you’re attempting. Two points specifically:

  1. To my knowledge, you can’t filter for one specific task; you’ll get events for every task in the project being activated and you’ll need to filter out for that one task on your end.
  2. You can’t filter for a specific value of a field, only for a field being changed. Meaning you’ll get events if tasks are marked incomplete as well as marked completed.

Also, I think I would use completed instead of completed_at for the field to monitor.

Would be great if we could have an option to get the data in the webhook. For eg. I need to watch the “change in name” of a project. For just this, I need to make another API call which harms the quota for the call in a bigger project