Webhooks, duplicate events

Question for Asana team:

I am syncing a google sheet with Asana tasks using webhooks. Problem is that I often get duplicate events, flooding the server script leading to timeouts, in addition to the unnecessary performance hit. Why would I get multiple events with identical created_at value, on the same resource? It’s not practical/efficient to filter them this end.

An example if useful:

here’s an array of events received by the webhook…

[{“resource”:651952250824431,“user”:285624458033225,“type”:“task”,“action”:“changed”,“created_at”:“2018-04-28T10:52:35.947Z”,“parent”:null},{“resource”:651952250824432,“user”:285624458033225,“type”:“task”,“action”:“changed”,“created_at”:“2018-04-28T10:52:36.171Z”,“parent”:null},{“resource”:651952250824433,“user”:285624458033225,“type”:“task”,“action”:“changed”,“created_at”:“2018-04-28T10:52:36.381Z”,“parent”:null}]

and here it is again a few seconds later:

[{“resource”:651952250824431,“user”:285624458033225,“type”:“task”,“action”:“changed”,“created_at”:“2018-04-28T10:52:35.947Z”,“parent”:null},{“resource”:651952250824432,“user”:285624458033225,“type”:“task”,“action”:“changed”,“created_at”:“2018-04-28T10:52:36.171Z”,“parent”:null},{“resource”:651952250824433,“user”:285624458033225,“type”:“task”,“action”:“changed”,“created_at”:“2018-04-28T10:52:36.381Z”,“parent”:null}]

I should add this should not be retrying due to failure/timeout, that works as expected.

Hi @Ed_Daly,

Sorry to hear that you’re having issues with webhooks. While our webhooks are a bit noisy, you should not get duplicates with the exact same timestamp. If this is happening, my guess is that you’ve created multiple webhooks on the same resource. Webhooks are not idempotent so you need to be mindful of creating duplicates.

Best,
Jeff

I don’t have duplicates, I’ve logged them all to make sure.

Getting this problem right now, getting the same batch of events, with the same timestamp, many, many times today, status code is 200, not timing out. Would really appreciate some help on this as it’s causing chaos.

Sorry to hear you’re still having issues here. Another possible idea – if your server doesn’t respond in time with a 200, we assume it’s not sent and then send it again, however, it wouldn’t be after a few seconds unless you sent us an error code.

Another possibility, if you have the same tasks multi-homed across projects and have a webhook on those projects you would get multiple events.

If it’s neither of those, you can DM me your app id and I can investigate further.

Hi @Jeff_Schneider Here I am facing same issue that I am getting multiple events for creating just one task. I have to syn with it Kanban Tool but I am getting multiple json response for one task that I have created. Here I have shared my code as well. Can you please check and let me know if I have missed something ?

<?php

ini_set('precision', 20);
require_once 'vendor/autoload.php';

$headers = apache_request_headers();
// if headers contain X-Hook-Secret, we need to answer with 200
if (array_key_exists('X-Hook-Secret', $headers)) {
    $xHookSecret = $headers['X-Hook-Secret'];
    header('X-Hook-Secret: ' . $xHookSecret);
    header("HTTP/1.1 200 OK");
    exit;
}
$entries = json_decode(file_get_contents('php://input'), true);
file_put_contents('test' . time() . '.txt', json_encode($entries));
$events = $entries['events'];

Response :
{"events":[{"resource":667562232925578,"user":201442967069152,"type":"project","action":"changed","created_at":"2018-05-10T08:01:20.664Z","parent":null},{"resource":667562232925578,"user":201442967069152,"type":"project","action":"changed","created_at":"2018-05-10T08:01:20.779Z","parent":null},{"resource":667562232925586,"user":201442967069152,"type":"task","action":"added","created_at":"2018-05-10T08:01:20.654Z","parent":667562232925578},{"resource":667562232925586,"user":201442967069152,"type":"task","action":"changed","created_at":"2018-05-10T08:01:21.660Z","parent":null},{"resource":667600398940089,"user":201442967069152,"type":"story","action":"added","created_at":"2018-05-10T08:01:20.657Z","parent":667562232925586},{"resource":667600398940089,"user":201442967069152,"type":"story","action":"removed","created_at":"2018-05-10T08:01:21.593Z","parent":667562232925586},{"resource":667600398940090,"user":201442967069152,"type":"story","action":"added","created_at":"2018-05-10T08:01:21.661Z","parent":667562232925586}]}

Thanks in advance.

Hi @Hardik, I believe what you are seeing is expected behavior as each event has a different timestamp. Our webhooks are a bit noisy, meaning that a seemingly small change in Asana can actually create a few stories and affect different resources, resulting in several events being sent.

As you can see in the code you provided, the events have a different “type” and different “actions”. For example, completing a task affects the project, task, and story. We know that this can be confusing and hope to improve our webhooks in the future.

OK will DM. For benefit of others, yes I’ve would suspect timeouts but I’m watching the prompt 200 response and then repeated message, and I’ve been sure not to fall for >1 project on same task.

here I had the same issue, there have 3 duplicated events (type=task, action=add) while add a task to that project (moving a task from a project to this project). i’m sure i just make 1 webhook on the project. please find the response as below:
“u’events’”: [
{
“u’resource’”: 746659735849377,
“u’parent’”: 421142628303183,
“u’created_at’”: “u’2018-07-17T13:36:58.053Z’”,
“u’user’”: 135848080166729,
“u’action’”: “u’added’”,
“u’type’”: “u’task’”
},
{
“u’resource’”: 746659735849377,
“u’parent’”: 428785575442795,
“u’created_at’”: “u’2018-07-17T13:37:06.562Z’”,
“u’user’”: 135848080166729,
“u’action’”: “u’added’”,
“u’type’”: “u’task’”
},

here I had the same issue, there have 3 duplicated events (type=task, action=add) while add a task to that project (moving a task from a project to this project). i’m sure i just make 1 webhook on the project. please find the response as below:
“u’events’”: [
{
“u’resource’”: 746659735849377,
“u’parent’”: 421142628303183,
“u’created_at’”: “u’2018-07-17T13:36:58.053Z’”,
“u’user’”: 135848080166729,
“u’action’”: “u’added’”,
“u’type’”: “u’task’”
},
{
“u’resource’”: 746659735849377,
“u’parent’”: 428785575442795,
“u’created_at’”: “u’2018-07-17T13:37:06.562Z’”,
“u’user’”: 135848080166729,
“u’action’”: “u’added’”,
“u’type’”: “u’task’”
},

The parent field is different :thinking: did you look at what these IDs refer to?

Already answered in your other thread, I suggest you remove this duplicate post :wink:

yes, what i provided is only 1 webhook response, but there are 3 same responses in the coming 1 or 2 seconds (only the time is different).
.

And what are the two parents?

the above is total duplicated hooks. coming with 1 second delay

@johnnygoodnow any idea why there are duplicate webhook callbacks?

Hello everybody,

I am trying to set up webhooks to give notifications. I am created a webhook and am listening to stories coming in. However, I will often get the same story multiple times and this causes my app to send multiple of the same notifications to my users. Is there a way around this? Thanks!

Asana’s webhooks are known to be “noisy” in that they do often generate multiple webhooks for the same event. You’re going to have to deal with that on your end, I’m afraid.

1 Like

I am facing the same issue.
Duplication in receiving response for create task.
I have created a task and getting 3 response for the same task.
can anyone give me a solution for resolving this.
And i am 200% confirm that there is no duplication webhooks