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

developertools
timeline
contacts

#1

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.


Contacts not being instantly created
#2

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


#3

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


#4

@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.


#5

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