Is it possible to track if a project is linked to a goal via webhooks?

Hi everyone,

I’d like to track events when a project is linked to a workspace level goal. I’ve tried using the following webhooks:

  • goal changed (with and without resource_type = project added, with resource = workspace / goal)

  • project changed

However, neither of these seems to trigger when a project is added to a goal.

Could you clarify:

  1. Is it currently possible to track this event reactively through webhooks?

  2. If not, are there any plans to support such an event in the future?

  3. Is there any recommended workaround (maybe through another type of webhook or a combination of events)?

Thanks in advance!

Hi @Dmitry_Nikonov , thanks for reaching out.

Unfortunately webhook filter’s for broader Asana data model entities like goals are more limited, so the working solution would be to subscribe to the broader events scope and then to filter out events which include creation of a goal relationship on the recipient side.

To subscribe to all goal events:

{
  "data": {
    "resource": "<GOAL_GID>",
    "target": "<TARGET_URL>"
  }
}

On the recipient side await for events looking like:

{
    "events": [
        {
...
            "action": "added",
            "resource": {
                "gid": "<GOAL_RELATIONSHIP_GID>",
                "resource_type": "goal_relationship",
                "resource_subtype": "supporting_work"
            }
        }
    ]
}

Using the goal relationship GID from here you can leverage the Get a goal relationship endpoint to retrieve the project.

Since goals may also hold tasks and portfolios, it will be also important to check that the added relationship actually is a project relationship by verifying the “resource_type” property:

{
    "data": {
        "supporting_resource": {
            "gid": "<ADDED_PROJECT_GID>",
            "name": "<ADDED_PROJECT_NAME>",
            "resource_type": "project"
        }
    }
}

Hope this is helpful.

3 Likes

@Mikhail_Melikhov Thank you for your answer! The method works, but is there any chance to track addition of goal relationships on workspace level? Cause I have >20 workspace level goals to track :sweat_smile:

Hi @Dmitry_Nikonov , I ran some experiments and, unfortunately, I wasn’t able to capture goal relationship events when subscribing at the workspace level webhooks.

That said, I’d suggest approaching this from the other direction. You can use the Get goals endpoint to retrieve the workspace’s goals (and filter out any that aren’t relevant to your use case). From there, you can poll those goals’ Events and watch for entries where "type": "goal_relationship" and "action": "added" are present.

I tested this approach and confirmed it’s working as expected. If your solution can accommodate a polling model, this should give you the functionality you need.

1 Like

@Mikhail_Melikhov Sadly a polling model is not the option for me, but anyway thank you for checking and answer!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.