Listening (webhook) for new comments on a project status update

I try to create a webhook for a project status update,
but listening on the project itself, does not trigger any webhook event when adding a comment to a status update. I also cannot subscribe the status update directly.

Is this a bug or a missing feature? Or do I do something wrong?

Tried almost all combinations:
await asanaClient.webhooks
.createWebhook({
target: ‘https://9306c88cc67e.ngrok.io/asana-webhook’,
resource: ‘447128078615618’,
filters: [ // with or without filters,…etc
{
resource_type: ‘story’,
resource_subtype: ‘comment_added’,
action: ‘added’
}
]
})

I tried resources:
1.) team level: this would be the best, therefore I would only need to subscribe to one webhook to get status updates of all assoicated projects… but I didn’t get it to work at all, it always returned with {“errors”:[{“error”:“invalid_filters_for_larger_scoped_webhooks”,“message”:“Webhooks for larger scoped resources must have at least one filter and all filters must be in our whitelist.”,“user_message”:“Webhooks for larger scoped resources must have at least one filter and all filters must be in our whitelist.”,“help”:“For more information on API status codes and how to handle them, read the docs on errors: https://developers.asana.com/docs/errors”}]}

2.) on project level, I could subscirbe to the webhook, but there were no updates triggered if I added a new comment

3.) tried to create it on status update’s gid directly, but then the api returned: {“errors”:[{“message”:“resource: Not the correct type”,“help”:“For more information on API status codes and how to handle them, read the docs on errors: https://developers.asana.com/docs/errors”}]}

I also do not get any “new status updates”… it seems I’m missing something reagridng project status webhooks…?

Alright, there is a new discovery :slight_smile:

I managed to get a status update notificaiton, but it is camouflaged as new comment:
{
gid: ‘1198739731444968’,
created_at: ‘2020-11-26T17:05:23.449Z’,
created_by: {
gid: ‘60604372481597’,
name: ‘Simon Tretter’,
resource_type: ‘user’
},
hearted: false,
hearts: ,
is_edited: false,
is_pinned: false,
liked: false,
likes: ,
num_hearts: 0,
num_likes: 0,
previews: ,
resource_subtype: ‘comment_added’,
resource_type: ‘story’,
source: ‘web’,
target: {
gid: ‘1171144249301681’,
name: ‘Automated Ads’,
resource_type: ‘project’
},
text: ‘koische sache\n’,
type: ‘comment’
}

But I still couldn’t watch for new “comments” on “project comments/status update”. Any idea about this?

The webhook event for this was: {
“events”: [
{
“user”: {
“gid”: “60604372481597”,
“resource_type”: “user”
},
“created_at”: “2020-11-26T17:05:24.051Z”,
“action”: “added”,
“resource”: {
“gid”: “1198739731444968”,
“resource_type”: “story”,
“resource_subtype”: “comment_added”
},
“parent”: {
“gid”: “1171144249301681”,
“resource_type”: “project”
}
}
]
}

one last update for today,
I tried now to find a workaround, by retrieving project updates after a webhook like this, didn’t change any webhook events after that… but suddenly, there are no “comment_added” or any other kinf of webhooks triggered for a status udpate any more… it did work 10 minutes ago though?

Webhook is still up and active:
{
gid: ‘1198849012772510’,
active: true,
resource: {
gid: ‘1171144249301681’,
name: ‘Automated Ads’,
resource_type: ‘project’
},
resource_type: ‘webhook’,
target: ‘https://9306c88cc67e.ngrok.io/asana-webhook
},

Not so funny side fact: Mysteriously things started working again.

So current state: I get a comment_added event when a new status update is triggerd, with a little workaround I get the new status update. So far so good, but I’m still unable to watch for new comments on this status update.

@Simon_Tretter,

There’s no webhook I’ve seen to get new comments on project statuses.

Actually I’ve not seen one to get new project status entries, either, but it seems you have that working (at least some of the time…) - what properties did you set on your webhook creation to get new status updates?

Hi Phil, thanks for your response.

I subscribe to a each project without a filter right now.
await asanaClient.webhooks
.createWebhook({
target: ‘https://9306c88cc67e.ngrok.io/asana-webhook’,
resource: a.gid <-- which is for example 1171144249301681 (a project gid)
})

after that I receive via webhook:

{
“events”: [
{
“user”: {
“gid”: “60604372481597”,
“resource_type”: “user”
},
“created_at”: “2020-11-26T20:14:38.692Z”,
“action”: “added”,
“resource”: {
“gid”: “1198849159775633”,
“resource_type”: “story”,
“resource_subtype”: “comment_added”
},
“parent”: {
“gid”: “1171144249301681”,
“resource_type”: “project”
}
}
]
}

I check for

event.action === ‘added’ &&
event.parent?.gid &&
event.resource?.resource_type === ‘story’ &&
event.resource?.resource_subtype === ‘comment_added’

before getting the story (event.resource.gid), if the story.target?.resource_type === ‘project’ holds true, I’m fetching the last project update:

const statusUpdates = await asanaClient.projectStatuses.getProjectStatusesForProject(
										story.target.gid,
										{ limit: 1 }
									);

which then gives me the gid I need to receive the latest status update:

const statusUpdate = await asanaClient.projectStatuses.getProjectStatus(
statusUpdates.data[0].gid
);

feels like a super hacky workaround though :stuck_out_tongue:

Too bad that there is no option to watch for comments, is this somehow planned? It would be a super cool use case to make a bot that does some action on specific comments.

2 Likes