Invalid Asana Webhook events

I have problem with events coming from Asana to my web hook. At the same request I get information about creating and removing event. When I later try to get information about what was the story about I get response Not a recognized ID. This event was sent right after moving task from one section to another. After such event the notifications get broken cause every next event looks like this, which causes my processing to stop. I must do some random operations(manually) on this task like ticking and unticking subtasks, moving from one section to another until a valid events come. Can you explain me why this happens? I’m using Python with lib provided by you. Bellow I attach few logs

[DEBUG]	2018-11-22T11:58:33.493Z	ef9ee3ce-ee4d-11e8-b11a-53fb3e131b01	Body: b'
{
    "events": [
        {
            "resource": 920306355822303,
            "user": 739769490757909,
            "type": "story",
            "action": "removed",
            "created_at": "2018-11-22T11:58:24.325Z",
            "parent": 920248604975478
        },
        {
            "resource": 920306355822303,
            "user": 739769490757909,
            "type": "story",
            "action": "added",
            "created_at": "2018-11-22T11:58:24.413Z",
            "parent": 920248604975478
        }
    ]
}
'

[INFO]	2018-11-22T11:58:33.494Z	ef9ee3ce-ee4d-11e8-b11a-53fb3e131b01	Webhook verification passed!
[ERROR]	2018-11-22T11:58:33.648Z	ef9ee3ce-ee4d-11e8-b11a-53fb3e131b01	Exception: Not Found: story: Not a recognized ID: 920306355822303

And I want to mention that this error log was printed while checking the second event(addedd). I only check stories that are not removed

Your specific scenario isn’t entirely clear from your description and the info posted. However, I can say it’s definitely the case that quite often (probably “almost always” in my experience) in the process of a task-related action occurring in the Asana UI, that action produces multiple story events including quite often (or almost always) the creation and then almost-immediate deletion of stories.

My advice would be to assume you’ll get webhooks on stories which have been deleted and write your code to ignore a story webhook on a story which Asana reports to no longer be valid - just assume it’s been deleted.

Is there a problem with doing that? What’s the larger picture of what you’re trying to accomplish? I would not try to use story webhooks as any type of reliable indicator of events occurring as stories only get created/sent in certain cases, not always.

In my case the task’s subtasks ticking and moving task around sections events are quite important, I have simple state machine built using Asana. In my case when I get invalid event like for example moving task from one section to another(as presented in the topic), the action linked with moving this task can’t be triggered, and than this task stays in void. That’s why I opened this topic, cause this situation happens quite often. And for moving tasks between sections and ticking subtasks as done I use API only, so this isn’t related to Asana UI, in my case Asana UI is the ‘cure’, cause thanks to it given task get’s repaired(proper events are getting sent)

I would just make two points:

  • We know that in the process of making changes to Asana, it generates some stories, let’s call them temporary stories, which are then immediately deleted. So your code is going to have to deal with those occurrences.

  • We also know that when changes are made in the Asana UI, sometimes stories and thus story events are generated, and sometimes they are not. See this post for more info on when they are not. I’m not sure if the same thing holds true for changes made via the API but I would bet it does, and thus you should realize that you are likely not going to get story events for all changes that occur in Asana. For this reason, overall I consider stories as NOT a reliable data element to use in tracking Asana changes.

1 Like