We are attempting to create a webhook that triggers automation. The webhook should send the project GID as soon as its status is set/updated to ‘Complete’. We have over 300 projects in the workspace, and we want to create only one webhook to handle them.
We have a payload structured like this:
payload = {“data”: {
“filters”: [
{
“resource_type”: “project_status”,
“action”: “changed”
}
],
“target”: “https:www.target_url.com”,
“resource”: “workspace_gid” # workspace_gid used as resource
}}
However, we are encountering an error message:
{
“errors”: [
{
“error”: “invalid_filters_for_larger_scoped_webhooks”,
“message”: “Webhooks for larger scoped resources must have at least one filter and all filters must be in our whitelist.”,
“user_message”: “Webhooks for larger scoped resources must have at least one filter and all filters must be in our whitelist.”,
“help”: “For more information on API status codes and how to handle them, read the docs on errors: Errors”
}
]
}
I didn’t find any resource on filters in the whitelist.
Please help us.
I’m afraid you can’t set a workspace-level filter on project_status.
This post shows what webhook filters are available at the workspace level:
Bottom line: you’ll have to filter for project added or changed, keep a record of the status for each project and then when you get an event, check the current status against what you have stored to see if it’s been changed.
@Phil_Seeman, Thanks for providing the information.
I have one more question regarding adding collaborator or mentioning a user in the story of the task. We found that we need to add user’s profile gid as link to achieve the same. but from where to find the profile gid of the user, which API call we need to use.
The API call looks for story creation on task is like this.
payload = {
“data”: {
“html_text”: f’<a href="Log in - Asana>@{project_owner_name} Hi ’
}
}
url_story_create = f"https://app.asana.com/api/1.0/tasks/{task_gid}/stories”
response_story_create = requests.post(url_story_create, json=payload, headers=headers)