Webhook sends 2 (identical?) events for a single task deletion ?

I’m connecting Asana to another app and when a task is deleted in my Asana project I want that same task (which is previously created using integration) deleted from the other app too.

When I receive the POST from the webhook it looks like I get 2 events for the same Asana action.

I am confused by this and it causes my solution to stop because the 2nd event cannot successfully delete because the instance of the task in the other app is already deleted by processing the 1st event.

Am I missing something obvious here?

{
“method”: “post”,
“path”: “/”,
“body”: {
“events”: [
{
“user”: {
“gid”: “1201614593059438”,
“resource_type”: “user”
},
“created_at”: “2022-08-26T01:16:09.073Z”,
“action”: “deleted”,
“resource”: {
“gid”: “1202866666221266”,
“resource_type”: “task”
},
“parent”: null
},
{
“user”: {
“gid”: “1201614593059438”,
“resource_type”: “user”
},
“created_at”: “2022-08-26T01:16:12.887Z”,
“action”: “deleted”,
“resource”: {
“gid”: “1202866666221266”,
“resource_type”: “task”
},
“parent”: null
}
]
}

I will let @Phil_Seeman confirm, but my understanding of web hooks is that it is assumed that they will be noisy: you will have too many notifications, and you might have to keep track of what you received, clean up duplicated, ignore a bunch etc

Webhooks are noisy in that you can get multiple webhook events for the same Asana change. I don’t think that you would get EXACTLY the same event data multiple times, though, which looks like is the case in your example above; so I’m not sure exactly what’s going on. But regardless, you’ll probably need to code your app so as to be able to handle the failure case if it tries to delete an already-deleted task (I would advise that anyway just as good defensive programming).

Thanks Phil, yes I expected it to be chatty but was a little surprised to find it repetitive. Of course you are spot on about programming defensively. I am finding out just how big my full-back needs to be to run interference for me. thanks again :wink:

2 Likes

yes seems like a lot of work :frowning: