Create 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

2
firstname = "Test"
3
lastname ='CASHSTORY'
4
phone = "+33600000000"
5
jobtitle = "Consultant"
6
website = "www.cashstory.com"
7
company = 'CASHSTORY'
8
hubspot_owner_id = None
Copied!

Model

Create contact

Using send method
1
create_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": "test",
11
"hubspot_owner_id": hubspot_owner_id,
12
}
13
}
14
15
contact1 = hubspot.connect(HS_API_KEY).contacts.send(create_contact)
Copied!

Using create method

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

Output

Display results

1
contact1
Copied!
1
contact2
Copied!
Copy link
Edit on GitHub