How to get Section via Webhook

Hi All,

We are able to create webhook by giving combination of task and section as resource_type and resource_subtype respectively. Where resource id is project ID.

But when adding/modifying section webhooks not responding. We tried to put resource type=project and subtype=section, but webhook was not created due to error like invalid type and subtype combination.

Hi @anon46001914 and welcome to the forum,

section is not a valid filter for a webhook; there actually is no section property on a task, rather it’s a part of the memberships property. Your only option is to initially get a list of all of the tasks in the project, and set a webhook on the tasks in the project; when you get an added event, add the task to your list, and when you get a changed event, compare the section to the one you have stored to see if it’s changed.

1 Like

Hi Phil, Thanks for your response. I need to how I can get section details one add/change/delete via webhook. Can you please help on that? Are you saying we have to set up webhooks for each task?

No. The webhook will be on a project, so it will send you adds/changes/deletes for all tasks in the project.

When you get a task add or change event, do an API call to read the task gid returned in the event. The property of the task you care about is the memberships property, which is a collection of projects that the task is assigned to and for each project, the section where it resides in that project. Take a look at the documentation for memberships and the example data on the right-hand side here:
https://developers.asana.com/docs/task