How to get changed context in webhook events body

I created a webhook on Project level registered to Asana system under my account.
However, when I make some changes on Asana web page, for example update description on a task, I receive events body like
{ "events":[ { "action":"changed", "created_at":"2020-06-22T04:05:39.551Z", "parent":null, "resource":{ "gid":"1180044677847393", "name":null, "resource_type":"task", "resource_subtype":"default_task" }, "type":"", "user":{ "gid":"####", "name":null, "resource_type":"user", "resource_subtype":null } }, { "action":"changed", "created_at":"2020-06-22T04:05:39.551Z", "parent":null, "resource":{ "gid":"1180044677847393", "name":null, "resource_type":"task", "resource_subtype":"default_task" }, "type":"", "user":{ "gid":"####", "name":null, "resource_type":"user", "resource_subtype":null } }, { "action":"added", "created_at":"2020-06-22T04:05:39.554Z", "parent":{ "gid":"1180044677847393", "name":null, "resource_type":"task", "resource_subtype":"default_task" }, "resource":{ "gid":"1181327729004281", "name":null, "resource_type":"story", "resource_subtype":"notes_changed" }, "type":"", "user":{ "gid":"####", "name":null, "resource_type":"user", "resource_subtype":null } } ] }
I expect to see the changed context about description - what is before the change and what is after the change.
I read doc Event part, and its example has fields like “change”, “new_value”, “removed_value”, etc. But I don’t see them in my returned events body.

Did I miss something? How can I get those change context?

@Ross_Grambo @Joe_Trollo ?

If you expand “change” in the schema table https://developers.asana.com/docs/event and read the descriptions for these fields, they’re pretty conditional. It looks like new_value for changed events only shows if the new value is an Asana Resource. This means it only shows for fields like parent or assignee.

For non-resource fields like description, you currently still need to request the object after the change event to get the new description. It looks like the reasoning for not exposing primitive fields was security related.

1 Like

Hi @Ross_Grambo,

Thanks for your reply.
I just tried updating assignee, but it looks the returned body doesn’t have “change” field either.
Did I miss anything?

"events":[
  {
     "action":"added",
     "created_at":"2020-06-25T01:48:53.353Z",
     "parent":{
        "gid":"1144048623480913",
        "resource_type":"project"
     },
     "resource":{
        "gid":"1179652734831866",
        "resource_type":"task",
        "resource_subtype":"default_task"
     },
     "type":"",
     "user":{
        "gid":"1144047802364372",
        "resource_type":"user"
     }
  },
  {
     "action":"changed",
     "created_at":"2020-06-25T01:48:53.629Z",
     "parent":null,
     "resource":{
        "gid":"1179652734831866",
        "resource_type":"task",
        "resource_subtype":"default_task"
     },
     "type":"",
     "user":{
        "gid":"1144047802364372",
        "resource_type":"user"
     }
  },
  {
     "action":"added",
     "created_at":"2020-06-25T01:48:53.637Z",
     "parent":{
        "gid":"1179652734831866",
        "resource_type":"task",
        "resource_subtype":"default_task"
     },
     "resource":{
        "gid":"1181914690131755",
        "resource_type":"story",
        "resource_subtype":"assigned"
     },
     "type":"",
     "user":{
        "gid":"1144047802364372",
        "resource_type":"user"
     }
  }],

Hmm. Assignee works as expected for me from both the /events endpoint and webhook payloads. Just to confirm, you created the webhook on the project, and are setting the assignee on a task within the project?

It looks like your schema doesn’t even have a “change” field, which it should. Are you using a client library?

Just to confirm, you created the webhook on the project, and are setting the assignee on a task within the project?

Yes

It looks like your schema doesn’t even have a “change” field, which it should. Are you using a client library?

I just found the problem - “change” is not added in our legacy schema definition. Even though the webhook payload has “change” field, it cannot be translated accordingly. We are using Go, and I think pre-owner created the schema definition manually and missed “change” field.

Anyways, thank you so much for your help!

2 Likes