Recently, I wrote a script to establish webhooks on the projects in Asana using Axios. There are 373 projects on which I need to establish webhooks. I iterated through each project and fired an API call to establish the webhook. After setting up webhooks on 75 projects, I started receiving a 400 response for some projects. After approximately 25 more projects, everything went fine again. Upon reaching the project indexed at 200, the same problem occurred.
I would like to confirm if there is any rate limit on establishing webhooks in Asana. I am using a business account on Asana.
There are definitely rate limits on all Asana API calls as documented here, so that would apply to the call to create a webhook.
(Technically it should be a 429 return; not sure if your 400 is somewhat generic but you might want to see if you can confirm that it’s specifically a 429.)
You’ll need to trap when a 400/429 error occurs and build in a wait/retry mechanism (unless you can use the official Asana client libraries which have rate-limit-handling built into them). The error returns a Retry-After header value (see the docs) to tell you how long to wait before retrying.