Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete contact method #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Delete contact method #5

wants to merge 1 commit into from

Conversation

kbairak
Copy link
Member

@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

@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