Story ID from webhook is not found when I try to get more details

I have a series of webhooks listening to section_changed stories in different projects.

When I receive the webhook, I look up the story to get the section details:[story_id]?opt_fields=old_section,new_section,text

Now, sometimes this request works. Other times, it gives me a 404 error and says the story doesn’t exist.

I’ve tried doing a GET request on the /task/[task_id]/stories endpoint, and I do find a section_changed story but it has a different ID. Also notable is that despite having changed the section on that particular task multiple times, it only has one section_changed story. Do they replace each other?

I’m completely baffled at this point, especially because it works for some tasks and doesn’t for others.

It’s hard to reproduce, but it seems to happen most often to tasks that have already been moved from one section to another before.

I’m not 100% sure but I think you’re actually hit upon the answer here.

Indeed they do, and I think that explains the behavior you’re seeing.

Asana has a behavior called “story consolidation”:

So I’m guessing what’s happening is the ID you’re getting in the webhook is for the story for the initial section change. But then when you change the section again, that story gets deleted and a new one (the one you’re finding with the different ID) gets created.

See if the above explanation helps to explain what you’re seeing.

I definitely only changed the section once on this particular test, but idk. A good workaround for now is to just get the task and get the section_changed story instead of using the story ID.

It doesn’t seem like a good practice to me to consolidate so that you can’t access the story with that ID at all. It’s always possible that someone will change a section twice in quick succession, therefore breaking any automations you have that rely on getting the story ID.

Two comments:

  1. You’re preaching to the choir here; I’ve objected to story consolidation, and especially the long 24-hour consolidation window, ever since I found out about it. So far I haven’t had any luck convincing anyone at Asana that it should be changed. :crazy_face:
  2. Just FYI, the consolidation has nothing to do with the API or object IDs per se; it was a behavior created for the web app to counteract their concern that there would be too many activities showing at the bottom of a task’s detail pane UI. The fact that it interferes with IDs and webhooks is, um, “collateral damage”.

Haha, well, thanks for listening anyway choir :slight_smile: