Status, Webhook, Webhook filters

Hi All,

I have a use case in which I need some clarification.

  1. Undeleted option - what’s the purpose?
    While creating a webhook for a project, this option will available only for few mins/sec when you after click delete.
    eg:
    url = “https://app.asana.com/api/1.0/webhooks
    headers = {
    “accept”: “application/json”,
    “content-type”: “application/json”,
    “authorization”: "Bearer "+access_token
    }
    portfolio_webhook_payload = { “data”: {
    “resource”: reporting_portfolio_gid,
    “filters”: [
    {
    “resource_type”: “project”,
    “action”: “added”
    },
    {
    “resource_type”: “project”,
    “action”: “removed”
    },
    {
    “resource_type”: “project”,
    “action”: “deleted”
    },
    {
    “resource_type”: “project”,
    “action”: “undeleted”
    }
    ],
    “target”:portfolio_webhook_target_url
    } }
    response = requests.post(url, json=portfolio_webhook_payload, headers=headers)

  2. Validity of a webhook - if a webhook was created, but never used or touched how long will the webhook exist.

  3. Restrict filter only to completed project ( project status)
    When a webhook is created for a project focused on project status change. Can we make it trigger only for a specific value “completed_at”. Currently webhook will trigger for any change in the status but we want it to trigger only when a project status changes to “completed_at”.
    eg:
    url = “https://app.asana.com/api/1.0/webhooks
    payload = { “data”: {
    “resource”: project_gid,
    “target”: project_webhook_target_url,
    “filters”: [
    {
    “resource_type”: “project”,
    “action”: “changed”,
    “fields”: [“completed_at”]
    }
    ]
    } }

Hi @Rajnish,

(FYI I moved your post to the Developers & API forum section; that’s where we cover all developer-related topics.)

  1. Undeleted option - what’s the purpose?

Undelete is an event that can occur on a task, so the “undeleted” webhook reports on that event happening.

Validity of a webhook - if a webhook was created, but never used or touched how long will the webhook exist.

Asana periodically sends out a heartbeat event on a webhook once it’s created. As long as your server responds properly to these heartbeat events, that webhook will stay alive.

Restrict filter only to completed project ( project status)

No, this is not possible. While you can filter on certain fields changing, you can’t filter on specific values of those fields.

1 Like

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