Webhook Error: No matching route for request

I am trying to create a Webhook that will notify my App when the memberships array changes for a Task. Here is the Request and Response:

REQUEST
Method: POST
URL/Path: https://app.asana.com/api/1.0/webhook
Headers: Accept: application/json Authorization: Bearer :censored:239:da5fb45d82: content-type: application/json; charset=utf-8
Params: N/A
Data:

{
  "data": {
    "filters": [
      {
        "action": "changed",
        "fields": [
          "gid",
          "name",
          "memberships"
        ],
        "resource_subtype": "membership",
        "resource_type": "task"
      }
    ],
    "resource": "8166522527322",
    "target": "https://hooks.myapp.com/hooks/catch/3055251/b313yur/"
  }
}

RESPONSE
Status Code: 404
date: Thu, 01 Jul 2021 21:10:54 GMT
Content:

{
    "errors": [
        {
            "message": "No matching route for request",
            "help": "For more information on API status codes and how to handle them, read the docs on errors: https://asana.com/developers/documentation/getting-started/errors"
        }
    ]
}

Any help is appreciated.

This should be webhooks, plural.

2 Likes

I corrected the endpoint as directed and now I receive the error:

{
    "errors": [
        {
            "error": "invalid_webhook_filter_resource_subtype_for_given_resource_type",
            "message": "The resource_subtype memberships is invalid for the given task resource_type."
            "user_message": "The resource_subtype memberships is invalid for the given task resource_type.",
            "help": "For more information on API status codes and how to handle them, read the docs on errors: https://developers.asana.com/docs/errors"
        }
    ]
}

Since memberships is not a valid resource subtype, can you make a recomendation on how to “Create a Webhook that will notify my App when a Task cahnges Section”?

Thanks in advance…

fields is what determines what elements you want to filter on, not resource_subtype. Remove the resource_subtype parameter completely, it’s not needed.

Also, remove gid and name from the fields parameter since you only want events when memberships changes, not when gid or name changes which is what you’re currently specifying.

Now, I’m not sure if memberships is a valid filter criteria, but you should find out if it is or not once you make the above changes.