Example WebHook Task completed

Hi, actually I looking for an example for API Create Webhook that run when an task is completed (change) by an user.

I need then the Info with all data of the task.

Is anywhere an example for this?

Sorry: An SUB Task.

Hi @anon56056927 and welcome to the forum,

Please specify the programming language(s) you’re wanting a sample in.

1 Like

Hi @Phil_Seeman we use PHP

Note that you’ll need to set a webhook on each project that you want to monitor; there’s no way to set a webhook for tasks on anything higher than the project level.

Definitely recommend that you use the official Asana PHP library.

Here’s some code:

@Bastien_Siebman is one of the resident PHP gurus here and can probably help you with other questions.

1 Like

I am not a guru at all, or ever :laughing:

1 Like

:wink:
I think you are!

The Code example I found and its clear.
But I miss the way to watch the change of Subtasks (in Tasks of a specific Project)

I know that it work because Zapier and automate.io do it.

And ideas?

Big thanks.

@Phil_Seeman any idea? Subtasks are not part of projects, so I am not sure you can watch for them using webhoooks…

In the past I would have agreed. But recall that we were discussing this in another thread (Question on Event reply in webhook - #4 by Phil_Seeman) and it seems like fairly recently, webhooks started returning for subtasks of tasks in a monitored project. I never got an answer from Asana in that thread but in fairness to them, that was right around when Joe left. So I’m going to try it again here :slight_smile: …

What say you, @Ross_Grambo? Could you check and see if it’s true that webhooks now fire for subtasks of tasks in a project being monitored with a webhook? I’m pretty sure they didn’t used to when I started with Asana a few years ago, but they do now??

3 Likes

Hey y’all,

Yes. It appears webhooks are thrown for subtasks within the project, and yes I believe this was added as a part of the webhook updates we launched earlier in the year.

2 Likes

Cool - thanks for that info, @Ross_Grambo!

Hi,
I found a “solution”. The WebHook run also for changes in SubTasks. Then I look for details and when parent.id is not given, it is the MainTask. Otherwise it is an Subtask. That work.

3 Likes

Yes, exactly, @anon56056927, that’s the correct solution - now that Asana sends subtask changes via webhooks, you’re able to do what you describe.

1 Like