APIs & Integrations

Kapil
Participant

How to associate a deal with a newly created contact using timeline events?

How to associate a deal with contact created by timeline events API? Adding the event actually creates a new contact which is not in hubspot & I want to associate a deal with it at the same time while creating timeline events.

0 Upvotes
4 Replies 4
3PETE
HubSpot Employee
HubSpot Employee

How to associate a deal with a newly created contact using timeline events?

@Subhash The only way to associate the contact and the deal over the API is to use this endpoint here.

Kapil
Participant

How to associate a deal with a newly created contact using timeline events?

but how would I know the objectId for this endpoint as contact will be created by timeline events at hubspot end?

Actually I was looking for something like this while creating timeline events but this does not associate any deal with contact:-

curl -X POST -H “Content-Type: application/json” -d ‘
{
“name” : “deal-id”,
“label” : “Deal Id”,
“propertyType”: “String”,
“contactProperty”: “deal-id”
}’
https://api.hubapi.com/integrations/v1/<>/timeline/event-types/<>/properties?hapikey=<>&userId=<>

and

curl -X PUT -H “Content-Type: application/json”
-H “Authorization: Bearer CJSP5qf1KhICAQEYs-gDIIGOBii1hQIyGQAf3xBKmlwHjX7OIpuIFEavB2-qYAGQsF4”
-d ‘
{
“id”: “001-001002”,
“eventTypeId”: <>,
“webinarName”: “A Test Webinar With Deal”,
“webinarId”: “001001”,
“deal-id”: “42344234”,
“email”: "a.test.contact@email.com"
}’
https://api.hubapi.com/integrations/v1/<>/timeline/event

0 Upvotes
3PETE
HubSpot Employee
HubSpot Employee

How to associate a deal with a newly created contact using timeline events?

@Subhash you would have to search for the contact record to get the vid. You can search by email if you have that from your timeline event. You could also poll the recently created contact endpoints to grab the last handful and cross reference from there to get the vid.

Kapil
Participant

How to associate a deal with a newly created contact using timeline events?

You’re right. Its working as the way you suggested, Thanks man.

0 Upvotes