Task API appears to have no way to add a task to a specific queue

When creating a task through the task API, is there a way to designate a specific queue that the task should populate in? It is very difficult to utilize that API endpoint without beig able to assign those tasks, or use workflows to assign the tasks to queues once they have been created.

Hey, @ZRuben thank you for posting in our Community!

I want to invite our top experts to share their thoughts @LMeert @Syeda_Fatima @BMatthews any recommendation to @ZRuben matter?

Thank you,

Pam

Hey , Nice to see me in thread.

And yes, I have an idea on , it is possible to designate a specific queue for a task when creating it through the HubSpot task API. You can use the hs_task_queue_id property to assign a task to a specific queue.

I can share you an example so a similar method you can use, here is an example request body for creating a task with a designated queue:

sql

Copy code

{

“engagement”: {

“active”: true,

“type”: “TASK”,

“ownerId”: “<OWNER_ID>”,

“timestamp”: <TIMESTAMP>

},

“associations”: {

“contactIds”: [

“<CONTACT_ID>”

],

“companyIds”: [

“<COMPANY_ID>”

]

},

“metadata”: {

“subject”: “Follow up on sales call”,

“hs_task_priority”: “HIGH”,

“hs_task_queue_id”: “<QUEUE_ID>”

}

}

Replace <OWNER_ID>, <TIMESTAMP>, <CONTACT_ID>, <COMPANY_ID>, and <QUEUE_ID> with the appropriate values.

Keep one thing in mind, you need to have permission to add tasks to the specified queue. If you don’t have permission, the task will be created but it won’t appear in the designated queue.

Hope this helps! Cheers.

@ZRuben

@PamCotton

Thank you so much for the help @Syeda_Fatima ! How do I find the Queue Id value for the “hs_task_queue_id”? Is that accessed through the UI?

Hey @ZRuben, You can access this value through the HubSpot API or by querying the HubSpot database.

You can use like this API:
GET /automation/v3/queues/{queueId}/tasks/{taskId}

You will have to provide the “queueId” and “taskId” values in the URL to retrieve the task’s details, including its “hs_task_queue_id”.

Hope this helps!

Hi @Syeda_Fatima Following up on this. Which endpoint are you using to make this call? iI am using https://api.hubapi.com/crm/v3/objects/tasks? and the body looks like this:

{

"properties": {

            "hs\_timestamp": "1645699033012",

            "hs\_task\_body": "this message is for api task createion testing.",

            "hubspot\_owner\_id": null,

            "hs\_task\_subject": "Submit Offer",

            "hs\_task\_status": "WAITING",

            "hs\_task\_priority": "HIGH",

            "hs\_task\_type": "TODO",

            "hs\_task\_queue\_id": "API\_Test"

        },

        "associations": \[

            {

                "to": {

                    "id": 5851

                },

                "types": \[

                    {

                        "associationCategory": "HUBSPOT\_DEFINED",

                        "associationTypeId": 204

                    }]

            }

        ]

    }

This works without the hs_task_queue_id, but does not recognize task queue id as an accepted property. I see that your body is different, is it just adifferent api body or is it a different endpoint alltogether? Also, what is the task_queue_id? I can only seem to find the name of the task queue, and don’t seeanywhere where I can find the ID for it if it is different than the name . Thanks

Hi @ZRuben

replace “hs_task_queue_id” with “hs_queue_membership_ids”. This is what worked for me.

I found the task queue ID by:

  • Navigating to the GUI where you can select the task queue (Sales > Tasks > create tasks)
  • Under the “Queue” option select the queue you want the ID of
  • After selecting the Queue, right click the drop down box and click inspect. this brings up the developer tools
  • You’re then looking for the “data-option-value” within developer tools which will show the ID of the queue

I’m sure theres an easier way of finding this out… Its the way I found it.

I found this method to be ok if you’re looking to only assign tasks to a speific queue.

As of May 2024, this is the solution that worked for us!! THANK YOU!!

Amazing! Confirming still working July 2024. Would love to see HS put this into the docs so we know its stable (assuming it is).

Hi @ZRuben ,
Did you manage to add the queue when creating a task? The proposed solution is probably not using same endpoint and as you mentioned the task endpoint does not accept hs_task_queue_id parameter. The proposed solution is no solution because the Task API does not accept hs_task_queue_id.
Any advice @Syeda_Fatima @PamCotton ?