Currently it is not possible to create webhooks for events happening directly on Engagement objects (Emails, Notes, Tasks, Meetings and Calls).
However an alternative solution to consider is to create a webhook that is triggered anytime the "Last Activity Date" property is updated on the Company. This records the last time a call, chat conversation, LinkedIn message, postal mail, meeting, note, sales email, SMS, or WhatsApp message was logged for a company.
See an example of my webhook in my app:
Anytime I log a note (or any type of engagement for that matter) the webhook is fired and my endpoint receives the payload below:
What you then need to do in order to get the specific engagement information is use the objectId (this is the Company Id) in the payload to retrieve associated engagements. So using the CRM Companies API with the associations parameter we can make a request like this:
Notice the associations object returned in the response. This contains the ID of all engagements (Notes) on the Company. To get specific information we can use the CRM Engagements endpoint like so:
GET https://api.hubapi.com/crm/v3/objects/notes/19456202967?properties=hs_note_body
RESPONSE
"id": "19456202967",
"properties": {
"hs_createdate": "2023-08-11T14:24:14.789Z",
"hs_lastmodifieddate": "2023-08-11T14:24:14.789Z",
"hs_note_body": "<div style=\"\" dir=\"auto\" data-top-level=\"true\"><p style=\"margin:0;\">This is a note</p></div>",
"hs_object_id": "19456202967"
},
"createdAt": "2023-08-11T14:24:14.789Z",
"updatedAt": "2023-08-11T14:24:14.789Z",
"archived": false
}
It's not perfect but it's the only way to achieve what you are trying to do. At least until a point in time where HubSpot supports creating webhooks directly for Engagements.
Hey, @mharis7@JPrajapati3👋 I tested this in my portal and was able to create the webhook. You may need to manually paste the value into the webhook editor.
Additionally, you can search for this property using the Properties API. Example:
HTTP 200
{
"updatedAt": "2023-06-26T20:53:54.382Z",
"createdAt": "2020-06-30T15:57:37.548Z",
"name": "notes_last_updated",
"label": "Last Activity Date",
"type": "datetime",
"fieldType": "date",
"description": "The last time a call, chat conversation, LinkedIn message, postal mail, meeting, note, sales email, SMS, or WhatsApp message was logged for a company. This is set automatically by HubSpot based on user actions in the company record.",
"groupName": "company_activity",
"options": [],
"displayOrder": 6,
"calculated": false,
"externalOptions": false,
"hasUniqueValue": false,
"hidden": false,
"hubspotDefined": true,
"modificationMetadata": {
"archivable": true,
"readOnlyDefinition": true,
"readOnlyValue": true
},
"formField": false,
"dataSensitivity": "non_sensitive"
}
Have fun building! — Jaycee
Did you know that the Community is available in other languages? Join regional conversations by changing your language settings !
Many thanks for this. But it seems that the "Last Activity Date" property is NOT updated on the Company where we MODIFY a Note attached to the Company (ONLY updated when first created). Or is there another way ? Many thanks
The original use was to support triggering a webhook when a note was created, whilst we can't directly subscribe to those events on the engagement object itself we can use the "Last Activity Date" as mentioned. It's a company property that represents the time a note was last logged (added) to the record.
There isn't a company property that stores the last time an update was made to a given note. I've also tested to see if at the very least "hs_lastmodifieddate" would update but from my testing it does not.
The only option at present (that I can see) is to poll for changes periodically using the Engagments API. The ideal of course would be to configure a webhook to detect updates on the engagement itself but it's not supported by HubSpot at the moment and I'm not sure if and when HubSpot plans to support it either.
Currently it is not possible to create webhooks for events happening directly on Engagement objects (Emails, Notes, Tasks, Meetings and Calls).
However an alternative solution to consider is to create a webhook that is triggered anytime the "Last Activity Date" property is updated on the Company. This records the last time a call, chat conversation, LinkedIn message, postal mail, meeting, note, sales email, SMS, or WhatsApp message was logged for a company.
See an example of my webhook in my app:
Anytime I log a note (or any type of engagement for that matter) the webhook is fired and my endpoint receives the payload below:
What you then need to do in order to get the specific engagement information is use the objectId (this is the Company Id) in the payload to retrieve associated engagements. So using the CRM Companies API with the associations parameter we can make a request like this:
Notice the associations object returned in the response. This contains the ID of all engagements (Notes) on the Company. To get specific information we can use the CRM Engagements endpoint like so:
GET https://api.hubapi.com/crm/v3/objects/notes/19456202967?properties=hs_note_body
RESPONSE
"id": "19456202967",
"properties": {
"hs_createdate": "2023-08-11T14:24:14.789Z",
"hs_lastmodifieddate": "2023-08-11T14:24:14.789Z",
"hs_note_body": "<div style=\"\" dir=\"auto\" data-top-level=\"true\"><p style=\"margin:0;\">This is a note</p></div>",
"hs_object_id": "19456202967"
},
"createdAt": "2023-08-11T14:24:14.789Z",
"updatedAt": "2023-08-11T14:24:14.789Z",
"archived": false
}
It's not perfect but it's the only way to achieve what you are trying to do. At least until a point in time where HubSpot supports creating webhooks directly for Engagements.
Hey, @mharis7@JPrajapati3👋 I tested this in my portal and was able to create the webhook. You may need to manually paste the value into the webhook editor.
Additionally, you can search for this property using the Properties API. Example:
HTTP 200
{
"updatedAt": "2023-06-26T20:53:54.382Z",
"createdAt": "2020-06-30T15:57:37.548Z",
"name": "notes_last_updated",
"label": "Last Activity Date",
"type": "datetime",
"fieldType": "date",
"description": "The last time a call, chat conversation, LinkedIn message, postal mail, meeting, note, sales email, SMS, or WhatsApp message was logged for a company. This is set automatically by HubSpot based on user actions in the company record.",
"groupName": "company_activity",
"options": [],
"displayOrder": 6,
"calculated": false,
"externalOptions": false,
"hasUniqueValue": false,
"hidden": false,
"hubspotDefined": true,
"modificationMetadata": {
"archivable": true,
"readOnlyDefinition": true,
"readOnlyValue": true
},
"formField": false,
"dataSensitivity": "non_sensitive"
}
Have fun building! — Jaycee
Did you know that the Community is available in other languages? Join regional conversations by changing your language settings !
It's a UNIX timestamp (1691763854789) and represents the date (Fri Aug 11 2023) the note was last updated. You'd need to convert that in your code to get a readable date.
Thank you, was able to figure that out actually. That's kind of odd though, wouldn't the NoteId (or EngagementId) what was changed be more useful? Then you could get the last updated date/time from the Note/Engagement. Not having a webhook for Note changes is a huge issue. How do you suggest handling bi-directional Notes updates between Hubspot and another system?
Absolutely, I agree that lack of webhook support for Engagements is an issue. I don't work at HubSpot so unfortunatley have no visibility as to if and when they plan to support this.
Until they do the only real workarounds are similar to the one in this thread, whereby we use the "Last Activity Date" to detect when an Engagement was updated on a company or any CRM record and then retrieve the associated Engagements for that object.
Thank you, I understand it's difficult to project what Hubspot will do since you are no longer working there. The workaround would be fine, except I tested as follows and it doesn't look like "updates" to Engagements (changing a Note for example) change anything in the Company object:
1. Called the get company by Id API endpoint with all properties and saved the response JSON. 2. Changed a Note that is associated with the company. 3. Called the get company by Id API endpoint again with all properties and saved the response JSON 4. The JSON saved in Steps 1 and 3 was identical. It appears that only adding new Engagements updates the company Last Activity Date.
But in fact the "Last Activity Date" property is NOT updated on the Company when we MODIFY a Note attached to the Company (ONLY updated when first created).
Yes, apologies, there is quite a lot of back and forth in the thread but I recall that we spoke about this so I would defer back to my original answer on that here. In short:
If you are simply hoping to trigger a webhook when a note is added the approach of using "Last Activity Date" will work.
If you are hoping to trigger a webhook when a note is updated the approach of using "Last Activity Date" will not work. Instead you need to poll the Engagements API.
No worries @brusky07 and @VBossio. I hope that it was in some way helpful and wish you best of luck with the project moving forward. Hopefully we will see support for Engagment Webhooks in the not to distant future!!! 🤞
The "since" value has to be provided in UNIX timestamp format but it appears to work. My only concern is that this specific endpoint is only available with API v1 and that it may be deprecated at some point.