Hey community, does anyone know of a way to watch for all incoming emails via API to get the email ID?
I have searched the API documentation and have not been able to find anything.
The end goal is:
- Watch for all incoming emails
- get the email ID
- check via API how many deals the email is associated to
- remove all email and deal associations
This is due to an issue we are having with emails that did not originate from HubSpot being automatically assigned to the 5 most recent deals the contact is associated to. This association activity does not listen to our configured association activity for these objects.
Hi @BVowles ,
Have you had a chance to check these HubSpot developer docs?
HubSpot doesn’t provide a webhook or dedicated endpoint to “listen” for all incoming emails in real time. But you can work around it by:
- Using the Engagements API to periodically fetch email records with type INCOMING_EMAIL and get their IDs.
- Using GET /crm/v3/objects/emails to pull email engagement details (each includes a unique ID, metadata, and associated deals).
- Using GET /crm/v4/objects/contacts/{contactId}/associations/deals to check associations.
- Removing unwanted associations with:
DELETE /crm/v4/objects/emails/{emailId}/associations/deals/{dealId}
For bulk association removals, see this HubSpot community post:
https://community.hubspot.com/t5/APIs-Integrations/Bulk-Deleting-Associations/m-p/950282
Note: HubSpot can automatically associate incoming emails with deals based on recent activity. This can’t be prevented via API, but you can remove the links afterward using the above steps.