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

Hubspot #192

Open
ngupta23 opened this issue Nov 4, 2024 · 0 comments
Open

Hubspot #192

ngupta23 opened this issue Nov 4, 2024 · 0 comments

Comments

@ngupta23
Copy link
Owner

ngupta23 commented Nov 4, 2024

Updating Contacts in a Batch: Reference

import hubspot
from pprint import pprint
from hubspot.crm.contacts import BatchInputSimplePublicObjectBatchInput, ApiException

client = hubspot.Client.create(access_token="YOUR_ACCESS_TOKEN")

batch_input_simple_public_object_batch_input = BatchInputSimplePublicObjectBatchInput(
    inputs=[
        {
            "idProperty": "my_unique_property_name",
            "objectWriteTraceId": "string",
            "id": "string",
            "properties": {
                "additionalProp1":"string",
                "additionalProp2":"string",
                "additionalProp3":"string"
            }
        }
    ]
)
try:
    api_response = client.crm.contacts.batch_api.update(
        batch_input_simple_public_object_batch_input=batch_input_simple_public_object_batch_input
    )
    pprint(api_response)
except ApiException as e:
    print("Exception when calling batch_api->update: %s\n" % e)

Searching for a user: Reference

Note: this is the older version (v1). There is a newer version also (v3)

url = f"https://api.hubapi.com/contacts/v1/search/query?q={email}"
headers = {
    "Authorization": f"Bearer {hubspot_api_key}",
    "Content-Type": "application/json",
}
try:
    response = requests.get(url, headers=headers)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant