Update contact
Tags: #hubspot #crm #sales #contact #naas_drivers
Author: Florent Ravenel

Input

Import library

1
from naas_drivers import hubspot
Copied!

Setup your HubSpot

👉 Access your HubSpot API key
1
HS_API_KEY = 'YOUR_HUBSPOT_API_KEY'
Copied!

Enter contact parameters to update

1
contact_id = "280751"
3
firstname = "Jean test"
4
lastname ='CASHSTOrY'
5
phone = "+336.00.00.00.00"
6
jobtitle = "Consultant"
7
website = "www.cashstory.com"
8
company = 'CASHSTORY'
9
hubspot_owner_id = None
Copied!

Model

Using patch method

1
update_contact = {"properties":
2
{
3
"email": email,
4
"firstname": firstname,
5
"lastname": lastname,
6
"phone": phone,
7
"jobtitle": jobtitle,
8
"website": website,
9
"company": company,
10
"url": "test3",
11
"hubspot_owner_id": hubspot_owner_id,
12
}
13
}
14
15
contact_id1 = hubspot.connect(HS_API_KEY).contacts.patch(contact_id,
16
update_contact)
Copied!

Using update method

1
contact_id2 = hubspot.connect(HS_API_KEY).contacts.update(
2
contact_id,
3
email,
4
firstname,
5
lastname,
6
phone,
7
jobtitle,
8
website,
9
company,
10
hubspot_owner_id
11
)
Copied!

Output

Display results

1
contact_id1
Copied!
1
contact_id2
Copied!
Copy link
Edit on GitHub