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.
Have users in the portal set a value such as 'True' for this property when they are about to have a contact deleted
Once they have this value set, they can then go ahead to delete this contact
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
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.
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.
Have users in the portal set a value such as 'True' for this property when they are about to have a contact deleted
Once they have this value set, they can then go ahead to delete this contact
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
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.