APIs & Integrations

akeller84
Member

Using webhooks, how can I get the email address of a contact that was deleted

SOLVE

I am using webhooks to post data back to our application whenever a contact is deleted. We are trying to store the email addresses of deleted contacts in our database so we can create a report of deleted contacts. I was assuming that the webhook would send the email address of the contact that was deleted. Unfortunately it looks like it just sends the vid of the deleted contact.

 

Querying for the vid using the Contacts API returns an error saying "contact does not exist" so we can't get the email address that way.

 

How can we get the email address (along with the name) of the deleted contact?


I did notice that an eventId was returned but querying for the eventId using the Events API returns a 404. The other identifiers returned (subscriptionId, portalId, appId) don't seem to be helpful.

 

Thank you.

0 Upvotes
1 Accepted solution
hot_z
Solution
Contributor

Using webhooks, how can I get the email address of a contact that was deleted

SOLVE

Hi there,

This is a tough problem because it doesn't seem like it is possible for us to pass the email of a contact when it is deleted via a subscription of the Webhook API. https://developers.hubspot.com/docs/methods/webhooks/webhooks-overview

 

A possible workaround I could think of is to:

  1. Create a custom property such as "To be deleted"
  2. Have users in the portal set a value such as 'True' for this property when they are about to have a contact deleted
  3. Once they have this value set, they can then go ahead to delete this contact
  4. On the side, when we the property is being set to 'True' we can set up a workflow to take an action of POST-ing to a set webhook
  5. This will allow you to receive information about the deleted contact externally

 

All said, this workaround requires modification in a user's workflow processes - which can sometimes be really hard. However, it might be one of the few ways whereby we can get this information collected without too much backend jobs running.

 

The alternative is to find a way to regularly grab all the contact's information into an external DB, and do a match back of the VID when we receive notification of deletion. However, as you may have already figured, that ain't the most elegant implementation either. And that's really just because we have to workaround the limitations of the current workflow API. I hope that helps. 

View solution in original post

2 Replies 2
Mike_Eastwood
Key Advisor | Gold Partner
Key Advisor | Gold Partner

Using webhooks, how can I get the email address of a contact that was deleted

SOLVE

Hi @akeller84 

 

We had a similar scenario for one of our clients - they wanted to know which Contacts were being deleted and why.

 

We added an Action to a CRM Extension (we had previously built for them). The Action moved the Contact to a "Archive or Delete List" and the person performing the Action chose Delete or Archive and a filled in a reason why.

 

Then, once a month, the administrator deletes everyone on the list (because you can't Delete from a Workflow) or Archives (opt out) so they remain in the CRM for archival reasons but don't count against the Contact Count. 

 

Hope this helps.

Mike

 

 

 

 

hot_z
Solution
Contributor

Using webhooks, how can I get the email address of a contact that was deleted

SOLVE

Hi there,

This is a tough problem because it doesn't seem like it is possible for us to pass the email of a contact when it is deleted via a subscription of the Webhook API. https://developers.hubspot.com/docs/methods/webhooks/webhooks-overview

 

A possible workaround I could think of is to:

  1. Create a custom property such as "To be deleted"
  2. Have users in the portal set a value such as 'True' for this property when they are about to have a contact deleted
  3. Once they have this value set, they can then go ahead to delete this contact
  4. On the side, when we the property is being set to 'True' we can set up a workflow to take an action of POST-ing to a set webhook
  5. This will allow you to receive information about the deleted contact externally

 

All said, this workaround requires modification in a user's workflow processes - which can sometimes be really hard. However, it might be one of the few ways whereby we can get this information collected without too much backend jobs running.

 

The alternative is to find a way to regularly grab all the contact's information into an external DB, and do a match back of the VID when we receive notification of deletion. However, as you may have already figured, that ain't the most elegant implementation either. And that's really just because we have to workaround the limitations of the current workflow API. I hope that helps.