Hi all,
Scenario is as follows:-
Once a user registerd on our portal it’s contact gets created in Hubspot against which deal also get’s created. There are number of tasks which I want to assign to all the users onboarded on our platform. These tasks are under stages under a pipeline.
Can anyone please help me with some APIs to wrt this usecase?
I explored deals APIs, Tasks APIs. But in tasks API documentation
this API: https://api.hubapi.com/crm/v3/objects/tasks/{taskId} only gives me limited details in response as I am not able to track this task is associated to how many deals and most imporant, If I close this task will it get close for all the deals?
Hi, @RSingh9885
Thanks for your question.
I set up a quick test for this:
-
I created a Task
-
Associated it with 3 Deals
-
Made a request to the Associations endpoint – Batch Read Deals, which returned all the Deals this Task is associated with
Request
curl --request POST \
--url https://api.hubapi.com/crm/v4/associations/task/deal/batch/read \
--header 'authorization: Bearer YOUR_ACCESS_TOKEN' \
--header 'content-type: application/json' \
--data '{
"inputs": [
{
"id": "49219390494"
}
]
}'
Response
HTTP 200
{
"status": "COMPLETE",
"results": [
{
"from": {
"id": "49219390494"
},
"to": [
{
"toObjectId": 11145739040,
"associationTypes": [
{
"category": "HUBSPOT_DEFINED",
"typeId": 216,
"label": null
}
]
},
{
"toObjectId": 11145812122,
"associationTypes": [
{
"category": "HUBSPOT_DEFINED",
"typeId": 216,
"label": null
}
]
},
{
"toObjectId": 12038699168,
"associationTypes": [
{
"category": "HUBSPOT_DEFINED",
"typeId": 216,
"label": null
}
]
}
]
}
],
"startedAt": "2024-03-15T15:53:43.606Z",
"completedAt": "2024-03-15T15:53:43.618Z"
}
-
Completed the Task on the first deal, which closed the task for all the associated objects (Deals)
In conclusion, if you need to have the same task for multiple deals and have each one closed individually, you’ll need to create a task per deal and not one task for multiple deals.
I hope this helps get you moving forward! — Jaycee