Links

Associate contact to deal

Tags: #hubspot #crm #sales #deal #contact #naas_drivers #snippet
Author: Florent Ravenel​
Last update: 2023-04-12 (Created: 2022-02-21)
Description: This notebook associates a contact to a deal in HubSpot.

Input

Import libraries

from naas_drivers import hubspot
import naas

Setup HubSpot

👉 Starting November 30, 2022, HubSpot API keys no longer enable access to HubSpot APIs, so in Naas version 2.8.3 and above, you need create a private app and use the access token.
Enter Your Access Token
HS_ACCESS_TOKEN = naas.secret.get("HS_ACCESS_TOKEN") or "YOUR_HS_ACCESS_TOKEN"
Enter association parameters
deal_id = "3452242690"
contact_id = "245201"

Model

Create association

hubspot.connect(HS_ACCESS_TOKEN).associations.create(
"deal", deal_id, "contact", contact_id
)

Output

Display result

print("🙌 Association successfully created !")