Something wrong with create webhook, please help

If you can post a typical JSON response you’re getting back, we can probably explain it to you.

Hi,
Sorry for delay, from Ukraine (hard situation here)
Maybe we have main list of ‘action’

I mean what main things/actions i should to check and then call API. Because for some actions as example “Action=Added” can be repated twice or more times (i think call API not good call few times).

{
“events”: [
{
“user”: {
“gid”: “1201513736066267”,
“resource_type”: “user”
},
“created_at”: “2022-03-01T18:10:23.331Z”,
“action”: “changed”,
“parent”: null,
“change”: {
“field”: “due_on”,
“action”: “changed”
},
“resource”: {
“gid”: “1201902299487849”,
“resource_type”: “task”,
“resource_subtype”: “default_task”
}
},
{
“user”: {
“gid”: “1201513736066267”,
“resource_type”: “user”
},
“created_at”: “2022-03-01T18:10:23.331Z”,
“action”: “changed”,
“resource”: {
“gid”: “1201902299487849”,
“resource_type”: “task”,
“resource_subtype”: “default_task”
},
“parent”: null,
“change”: {
“field”: “due_at”,
“action”: “changed”
}
},
{
“user”: {
“gid”: “1201513736066267”,
“resource_type”: “user”
},
“created_at”: “2022-03-01T18:10:25.158Z”,
“action”: “changed”,
“resource”: {
“gid”: “1201902299487849”,
“resource_type”: “task”,
“resource_subtype”: “default_task”
},
“parent”: null,
“change”: {
“field”: “due_on”,
“action”: “changed”
}
},
{
“user”: {
“gid”: “1201513736066267”,
“resource_type”: “user”
},
“created_at”: “2022-03-01T18:10:25.158Z”,
“action”: “changed”,
“resource”: {
“gid”: “1201902299487849”,
“resource_type”: “task”,
“resource_subtype”: “default_task”
},
“parent”: null,
“change”: {
“field”: “due_at”,
“action”: “changed”
}
},
{
“user”: {
“gid”: “1201513736066267”,
“resource_type”: “user”
},
“created_at”: “2022-03-01T18:10:23.338Z”,
“action”: “added”,
“resource”: {
“gid”: “1201902473863055”,
“resource_type”: “story”,
“resource_subtype”: “due_date_changed”
},
“parent”: {
“gid”: “1201902299487849”,
“resource_type”: “task”,
“resource_subtype”: “default_task”
}
},
{
“user”: {
“gid”: “1201513736066267”,
“resource_type”: “user”
},
“created_at”: “2022-03-01T18:10:25.109Z”,
“action”: “removed”,
“resource”: {
“gid”: “1201902473863055”,
“resource_type”: “story”,
“resource_subtype”: “due_date_changed”
},
“parent”: {
“gid”: “1201902299487849”,
“resource_type”: “task”,
“resource_subtype”: “default_task”
}
},
{
“user”: {
“gid”: “1201513736066267”,
“resource_type”: “user”
},
“created_at”: “2022-03-01T18:10:25.164Z”,
“action”: “added”,
“resource”: {
“gid”: “1201902474641158”,
“resource_type”: “story”,
“resource_subtype”: “due_date_changed”
},
“parent”: {
“gid”: “1201902299487849”,
“resource_type”: “task”,
“resource_subtype”: “default_task”
}
},
{
“user”: {
“gid”: “1201513736066267”,
“resource_type”: “user”
},
“created_at”: “2022-03-01T18:10:44.457Z”,
“action”: “added”,
“resource”: {
“gid”: “1201902299487849”,
“resource_type”: “task”,
“resource_subtype”: “default_task”
},
“parent”: {
“gid”: “1201513888551782”,
“resource_type”: “project”
}
},
{
“user”: {
“gid”: “1201513736066267”,
“resource_type”: “user”
},
“created_at”: “2022-03-01T18:10:44.684Z”,
“action”: “changed”,
“resource”: {
“gid”: “1201902299487849”,
“resource_type”: “task”,
“resource_subtype”: “default_task”
},
“parent”: null,
“change”: {
“field”: “followers”,
“action”: “added”,
“added_value”: {
“gid”: “1201513888530716”,
“resource_type”: “user”
}
}
},
{
“user”: {
“gid”: “1201513736066267”,
“resource_type”: “user”
},
“created_at”: “2022-03-01T18:10:44.684Z”,
“action”: “changed”,
“resource”: {
“gid”: “1201902299487849”,
“resource_type”: “task”,
“resource_subtype”: “default_task”
},
“parent”: null,
“change”: {
“field”: “assignee”,
“action”: “changed”,
“new_value”: {
“gid”: “1201513888530716”,
“resource_type”: “user”
}
}
},
{
“user”: {
“gid”: “1201513736066267”,
“resource_type”: “user”
},
“created_at”: “2022-03-01T18:10:44.708Z”,
“action”: “added”,
“resource”: {
“gid”: “1201902475196422”,
“resource_type”: “story”,
“resource_subtype”: “assigned”
},
“parent”: {
“gid”: “1201902299487849”,
“resource_type”: “task”,
“resource_subtype”: “default_task”
}
},
{
“user”: {
“gid”: “1201513736066267”,
“resource_type”: “user”
},
“created_at”: “2022-03-01T18:12:25.508Z”,
“action”: “added”,
“resource”: {
“gid”: “1201902299487849”,
“resource_type”: “task”,
“resource_subtype”: “default_task”
},
“parent”: {
“gid”: “1201513888486676”,
“resource_type”: “project”
}
},
{
“user”: {
“gid”: “1201513736066267”,
“resource_type”: “user”
},
“created_at”: “2022-03-01T18:12:25.893Z”,
“action”: “changed”,
“resource”: {
“gid”: “1201902299487849”,
“resource_type”: “task”,
“resource_subtype”: “default_task”
},
“parent”: null,
“change”: {
“field”: “followers”,
“action”: “added”,
“added_value”: {
“gid”: “1201513888467580”,
“resource_type”: “user”
}
}
},
{
“user”: {
“gid”: “1201513736066267”,
“resource_type”: “user”
},
“created_at”: “2022-03-01T18:12:25.893Z”,
“action”: “changed”,
“resource”: {
“gid”: “1201902299487849”,
“resource_type”: “task”,
“resource_subtype”: “default_task”
},
“parent”: null,
“change”: {
“field”: “assignee”,
“action”: “changed”,
“new_value”: {
“gid”: “1201513888467580”,
“resource_type”: “user”
}
}
},
{
“user”: {
“gid”: “1201513736066267”,
“resource_type”: “user”
},
“created_at”: “2022-03-01T18:12:25.927Z”,
“action”: “added”,
“resource”: {
“gid”: “1201902477961178”,
“resource_type”: “story”,
“resource_subtype”: “assigned”
},
“parent”: {
“gid”: “1201902299487849”,
“resource_type”: “task”,
“resource_subtype”: “default_task”
}
},
{
“user”: {
“gid”: “1201513736066267”,
“resource_type”: “user”
},
“created_at”: “2022-03-01T18:12:45.866Z”,
“action”: “changed”,
“resource”: {
“gid”: “1201902299487849”,
“resource_type”: “task”,
“resource_subtype”: “default_task”
},
“parent”: null,
“change”: {
“field”: “notes”,
“action”: “changed”
}
},
{
“user”: {
“gid”: “1201513736066267”,
“resource_type”: “user”
},
“created_at”: “2022-03-01T18:12:45.866Z”,
“action”: “changed”,
“resource”: {
“gid”: “1201902299487849”,
“resource_type”: “task”,
“resource_subtype”: “default_task”
},
“parent”: null,
“change”: {
“field”: “html_notes”,
“action”: “changed”
}
},
{
“user”: {
“gid”: “1201513736066267”,
“resource_type”: “user”
},
“created_at”: “2022-03-01T18:12:47.867Z”,
“action”: “changed”,
“resource”: {
“gid”: “1201902299487849”,
“resource_type”: “task”,
“resource_subtype”: “default_task”
},
“parent”: null,
“change”: {
“field”: “notes”,
“action”: “changed”
}
},
{
“user”: {
“gid”: “1201513736066267”,
“resource_type”: “user”
},
“created_at”: “2022-03-01T18:12:47.867Z”,
“action”: “changed”,
“resource”: {
“gid”: “1201902299487849”,
“resource_type”: “task”,
“resource_subtype”: “default_task”
},
“parent”: null,
“change”: {
“field”: “html_notes”,
“action”: “changed”
}
},
{
“user”: {
“gid”: “1201513736066267”,
“resource_type”: “user”
},
“created_at”: “2022-03-01T18:12:49.816Z”,
“action”: “changed”,
“resource”: {
“gid”: “1201902299487849”,
“resource_type”: “task”,
“resource_subtype”: “default_task”
},
“parent”: null,
“change”: {
“field”: “notes”,
“action”: “changed”
}
},
{
“user”: {
“gid”: “1201513736066267”,
“resource_type”: “user”
},
“created_at”: “2022-03-01T18:12:49.816Z”,
“action”: “changed”,
“resource”: {
“gid”: “1201902299487849”,
“resource_type”: “task”,
“resource_subtype”: “default_task”
},
“parent”: null,
“change”: {
“field”: “html_notes”,
“action”: “changed”
}
},
{
“user”: {
“gid”: “1201513736066267”,
“resource_type”: “user”
},
“created_at”: “2022-03-01T18:13:36.719Z”,
“action”: “added”,
“resource”: {
“gid”: “1201902299487849”,
“resource_type”: “task”,
“resource_subtype”: “default_task”
},
“parent”: {
“gid”: “1201513888551782”,
“resource_type”: “project”
}
},
{
“user”: {
“gid”: “1201513736066267”,
“resource_type”: “user”
},
“created_at”: “2022-03-01T18:13:37.028Z”,
“action”: “changed”,
“resource”: {
“gid”: “1201902299487849”,
“resource_type”: “task”,
“resource_subtype”: “default_task”
},
“parent”: null,
“change”: {
“field”: “assignee”,
“action”: “changed”,
“new_value”: {
“gid”: “1201513888530716”,
“resource_type”: “user”
}
}
},
{
“user”: {
“gid”: “1201513736066267”,
“resource_type”: “user”
},
“created_at”: “2022-03-01T18:13:37.062Z”,
“action”: “added”,
“resource”: {
“gid”: “1201902401848360”,
“resource_type”: “story”,
“resource_subtype”: “assigned”
},
“parent”: {
“gid”: “1201902299487849”,
“resource_type”: “task”,
“resource_subtype”: “default_task”
}
}
]
}

Hi @Taras_M,

Wow, my heart goes out to you; please stay safe!

I’m afraid that JSON data is too long for me to annotate what everything is. One thing I recommend, if you haven’t done it yet, is to put it into a JSON formatter like this one which makes it much easier to collapse and expand the objects and see what goes with what.

Let’s back up and maybe take a different approach: can you describe for us what your end goal is? For example, “I want to get the events when task due dates change in a set of projects” or “I want to know when someone assigns a task”, like that.

1 Like

Thank you very much for support, its needs now, thank you.

About tasks sorry for boring, i know it, but need finish this :slight_smile:

What needs for me on this moment (Generally any changes with project) but main is:

  • Check users on project (added new or removed)
  • All changes for tasks (created/removed, assign user/remove user from task, changed date, added some note, comment etc. So any changes with task)

About JSON i did it but here it reconvert in string(maybe you can copy and paste it for checking)
{
“events”:[
{
“user”:{
“gid”:“1201513736066267”,
“resource_type”:“user”
},
“created_at”:“2022-03-01T17:42:59.865Z”,
“action”:“added”,
“parent”:{
“gid”:“1201513736219962”,
“resource_type”:“project”
},
“resource”:{
“gid”:“1201902299487851”,
“resource_type”:“task”,
“resource_subtype”:“default_task”
}
},
{
“user”:{
“gid”:“1201513736066267”,
“resource_type”:“user”
},
“created_at”:“2022-03-01T17:42:59.975Z”,
“action”:“added”,
“resource”:{
“gid”:“1201902299487851”,
“resource_type”:“task”,
“resource_subtype”:“default_task”
},
“parent”:{
“gid”:“1201513736219963”,
“resource_type”:“section”
}
},
{
“user”:{
“gid”:“1201513736066267”,
“resource_type”:“user”
},
“created_at”:“2022-03-01T17:42:59.985Z”,
“action”:“added”,
“resource”:{
“gid”:“1201902304916391”,
“resource_type”:“story”,
“resource_subtype”:“added_to_project”
},
“parent”:{
“gid”:“1201902299487851”,
“resource_type”:“task”,
“resource_subtype”:“default_task”
}
}
]
}

Thank you,
Taras

Hi @Taras_M,

Let me interpret the last JSON you posted and then discuss your overall needs.

The last JSON you posted has 3 events in it. Here’s the first one:

      {
         "user":{
            "gid":“1201513736066267”,
            "resource_type":"user"
         },
         "created_at":"“2022-03-01T17":"42":59.865Z”,
         "action":"added",
         "parent":{
            "gid":“1201513736219962”,
            "resource_type":"project"
         },
         "resource":{
            "gid":“1201902299487851”,
            "resource_type":"task",
            "resource_subtype":"default_task"
         }
      },

This says:

  • The object this event is pertaining to is found in the resource object; here it’s a task (and a default task, as opposed to say a milestone)
  • The task’s gid is 1201902299487851
  • The action that occurred on that object is found in the action parameter; here we see the task was added
  • The parent object tells us where the action occurred; here we see the task was added to project gid 1201513736219962
      {
         "user":{
            "gid":“1201513736066267”,
            "resource_type":"user"
         },
         "created_at":"“2022-03-01T17":"42":59.975Z”,
         "action":"added",
         "resource":{
            "gid":“1201902299487851”,
            "resource_type":"task",
            "resource_subtype":"default_task"
         },
         "parent":{
            "gid":“1201513736219963”,
            "resource_type":"section"
         }
      },

This event says:

  • The resource is identical to the previous event, so like the last event, this one pertains to the same task with gid 1201902299487851
  • The action is again added
  • The parent is a section, so this event tells us that task 1201902299487851 was added into a section whose gid is 1201513736219963
{
         "user":{
            "gid":“1201513736066267”,
            "resource_type":"user"
         },
         "created_at":"“2022-03-01T17":"42":59.985Z”,
         "action":"added",
         "resource":{
            "gid":“1201902304916391”,
            "resource_type":"story",
            "resource_subtype":"added_to_project"
         },
         "parent":{
            "gid":“1201902299487851”,
            "resource_type":"task",
            "resource_subtype":"default_task"
         }
      }

This event says:

  • The resource is a story, and the subtype tells us more about what the story was; here it’s an “added to project” story. (If you’re not sure what a story is, see here in the API docs
  • Stories are attached to tasks, and the parent object tells us what task it was attached to; here not surprisingly its the same new task that we just saw was added in the first two events
  • The action tells us that this story was added

Hopefully the above helps you interpret the events better. Overall note that you will often get multiple events for one “thing that happened in Asana”; in the above example, you added a new task and it generated 3 events.

In terms of your overall needs…

You’ll get that info for a project from the webhook you currently have set on the project, so you’re all set to receive this info (you just have to interpret it, as above).

You’re not going to receive that type of info from the regular webhook you have set for a project. I believe to get this info you’ll need to set a project_membership webhook, but unfortunately I’ve not worked with those so I can’t tell you specifically how to set those up. @AndrewWong can you help out here with how to set up a webhook to get this info? @Frederic_Malenfant have you done anything in this area and could help?

1 Like

Hi @Phil_Seeman

Thank you very much, will try to deal with it.

Thx :wink:

Hi again :slight_smile: @Phil_Seeman one more question
Sorry for boring :slight_smile:

When i tried create new task in section as example in my case it “DOING”
I got this webhook request/answer.
Task ID is 1201965313451426 (we can see it in first event as added to project wit resource type ‘story’)

But also i got few events with Task ID = 1201965313451428 (what is it?) I don’t create new tasks, i created only task which ID = 1201965313451426
And webhook returned it everything in one request, can’t understand where takes new task with id 1201965313451428 .
Btw when i tried paste this task in in browser url Asana said that task was deleted, but in webhook it as ‘Added’

{
   "events":[
      {
         "user":{
            "gid":"1201513736066267",
            "resource_type":"user"
         },
         "created_at":"2022-03-14T16:09:40.966Z",
         "action":"added",
         "resource":{
            "gid":"1201965626400478",
            "resource_type":"story",
            "resource_subtype":"added_to_project"
         },
         "parent":{
            "gid":"1201965313451426",
            "resource_type":"task",
            "resource_subtype":"default_task"
         }
      },
      {
         "user":{
            "gid":"1201513736066267",
            "resource_type":"user"
         },
         "created_at":"2022-03-14T16:09:47.632Z",
         "action":"added",
         "parent":{
            "gid":"1201513736219962",
            "resource_type":"project"
         },
         "resource":{
            "gid":"1201965313451428",
            "resource_type":"task",
            "resource_subtype":"default_task"
         }
      },
      {
         "user":{
            "gid":"1201513736066267",
            "resource_type":"user"
         },
         "created_at":"2022-03-14T16:09:47.711Z",
         "action":"added",
         "resource":{
            "gid":"1201965313451428",
            "resource_type":"task",
            "resource_subtype":"default_task"
         },
         "parent":{
            "gid":"1201513736219965",
            "resource_type":"section"
         }
      },
      {
         "user":{
            "gid":"1201513736066267",
            "resource_type":"user"
         },
         "created_at":"2022-03-14T16:09:47.716Z",
         "action":"added",
         "resource":{
            "gid":"1201965545334930",
            "resource_type":"story",
            "resource_subtype":"added_to_project"
         },
         "parent":{
            "gid":"1201965313451428",
            "resource_type":"task",
            "resource_subtype":"default_task"
         }
      }
   ]
}

Thank you very much for help and sorry for annoying

Looks like a task got created and then pretty quickly deleted. Is it possible you pressed <Enter> in the list view of the project, opening up a blank line, and then removed that blank line? I’m not 100% sure but I think that probably would have created a new empty task and then deleted it.

Oh yes, can be, when i typed Task name and then press Enter it was automatic jumped to new add one more task(i not type any character and press Esc) so i think it was considered as a new task.

Thank you very much, will continue test and handle it

1 Like