Trying to create a webhook via API (POST Establish a webhook endpoint) for a Workspace based on added, changed, and removed actions. I’m met with a 400 error and am unsure what’s causing it.
{
"errors": [
{
"message": "Could not interpret {\"data\": {\"resource\": \"1174208460831550\", \"filters\": [{\"resource_type\": \"workspace\", \"action\": \"added\"}, {\"resource_type\": \"workspace\", \"action\": \"changed\"}, {\"resource_type\": \"workspace\", \"action\": \"removed\"}]}} as an identifier in {\"data\": {\"resource\": \"1174208460831550\", \"filters\": [{\"resource_type\": \"workspace\", \"action\": \"added\"}, {\"resource_type\": \"workspace\", \"action\": \"removed\"}]}}.",
"help": "For more information on API status codes and how to handle them, read the docs on errors: https://developers.asana.com/docs/errors"
}
]
}```
If you’re trying to create a webhook to capture when a workspace is added/changed/removed, that’s not supported by the Asana API.
If you’re trying to capture when a project is added/changed/removed within a workspace, then the resource_type in the filter needs to be project, not workspace.
Also, you’re missing the data wrapper around the request:
Perfect! Thank you so much @Phil_Seeman for the quick response! Do you happen to know if trying to capture when users and teams have been added/changed/removed within a workspace is possible?
Thank you so much for the help here @Phil_Seeman ! Currently trying to create a webhook for Teams in a workspace, but I seem to be getting the same error as before. Here’s the request body:
{"errors": [{"message": "Could not interpret {\"data\": {\"resource\": \"1203803514816598\", \"filters\": [{\"resource_type\": \"team\", \"action\": \"added\"}, {\"resource_type\": \"team\", \"action\": \"changed\"}, {\"resource_type\": \"team\", \"action\": \"removed\"}]}} as an identifier in {\"data\": {\"resource\": \"1203803514816598\", \"filters\": [{\"resource_type\": \"team\", \"action\": \"added\"}, {\"resource_type\": \"team\", \"action\": \"changed\"}, {\"resource_type\": \"team\", \"action\": \"removed\"}]}}.", "help": "For more information on API status codes and how to handle them, read the docs on errors: https://developers.asana.com/docs/errors"}]}
{"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: https://developers.asana.com/docs/errors"}]}
am I setting the resource incorrectly @Phil_Seeman ?