Skip to content

Delete contact method#5

Open
kbairak wants to merge 1 commit intomasterfrom
delete_contact
Open

Delete contact method#5
kbairak wants to merge 1 commit intomasterfrom
delete_contact

Conversation

@kbairak
Copy link
Copy Markdown

@kbairak kbairak commented Apr 27, 2021

This adds a method for deleting a contact on hubspot.

Unfortunately, there's no easy way to test this. I had to try this out on our production environment by copy pasting commands into a python shell and having someone with access to hubspot verify that it worked. The snippet I used was:

from django.conf import settings

from transifex.libs.analytics import get_hubspot_contact_proxy

h = get_hubspot_contact_proxy()

# The arguments of the new delete method
email = "..."
api_key = settings.HUBSPOT_SETTINGS['api_key']

# The body of the new delete method
contact = h.get_contact_by_email(email, api_key)
vid = contact['vid']
subpath = '/contacts/v1/contact/vid/{}?hapikey={}'.format(vid, api_key)
h._call(subpath=None, url=subpath, method="DELETE")

Copy link
Copy Markdown

@kostasgeo kostasgeo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants