I am looking to use MS Flow to get a count of the open tickets from each pipeline every day. We already have Flow connected and running some tasks, but the query to get open tickets from a pipeline is more complex that I would have hoped. Does anyone have an example of how I would submit the request to get the open tickets by Flow?
Hey, @RyanClark
Thanks for reaching out. I do not have an MS Flow-specific example. I can provide an example of how to structure a similar request using the Search API.
We’ll also leave this open in case there are community members who have the app-specific steps you are looking for.
Best,
Jaycee
Hi, it doesn’t have to be Flow specific, but if someone can put an example together in cURL I can probably adapt that.
Hey, @RyanClark
Here’s my example using Postman:
I have a pipeline with open tickets
Request
POST https://api.hubapi.com/crm/v3/objects/tickets/search
Body
{
"filterGroups": [
{
"filters": [
{
"propertyName": "hs_pipeline",
"operator": "EQ",
"value": "19625033"
},
{
"propertyName": "hs_pipeline_stage",
"operator": "NEQ",
"value": "47925265"
}
]
}
]
}
Response
{
"total": 3,
"results": [
{
"id": "1500746054",
"properties": {
"content": null,
"createdate": "2023-03-16T15:48:45.014Z",
"hs_lastmodifieddate": "2023-03-16T15:48:46.290Z",
"hs_object_id": "1500746054",
"hs_pipeline": "19625033",
"hs_pipeline_stage": "47925262",
"hs_ticket_category": null,
"hs_ticket_priority": null,
"subject": "Testerr 1"
},
"createdAt": "2023-03-16T15:48:45.014Z",
"updatedAt": "2023-03-16T15:48:46.290Z",
"archived": false
},
{
"id": "1500746070",
"properties": {
"content": null,
"createdate": "2023-03-16T15:49:04.683Z",
"hs_lastmodifieddate": "2023-03-16T15:49:06.041Z",
"hs_object_id": "1500746070",
"hs_pipeline": "19625033",
"hs_pipeline_stage": "47925262",
"hs_ticket_category": null,
"hs_ticket_priority": null,
"subject": "Testerr 2"
},
"createdAt": "2023-03-16T15:49:04.683Z",
"updatedAt": "2023-03-16T15:49:06.041Z",
"archived": false
},
{
"id": "1503346867",
"properties": {
"content": null,
"createdate": "2023-03-17T22:27:14.029Z",
"hs_lastmodifieddate": "2023-03-17T22:27:14.967Z",
"hs_object_id": "1503346867",
"hs_pipeline": "19625033",
"hs_pipeline_stage": "47925262",
"hs_ticket_category": null,
"hs_ticket_priority": "HIGH",
"subject": "Cats and ninjas"
},
"createdAt": "2023-03-17T22:27:14.029Z",
"updatedAt": "2023-03-17T22:27:14.967Z",
"archived": false
}
]
}
My underlying thinking:
- we can do this per pipeline
- our request will look for all tickets that are not Closed
- you could also filter by thinking of it the other way around, i.e. use all stages except Closed. Whatever meets your needs.
Have fun building! — Jaycee
Hi, thanks very much for this. I have managed to get it into Flow and it is working. The only issue I have is that we have a pipeline with 3 closed states. If I try the query to search on that pipeline and exclude those 3 states. I get this error. Is there a way round that?
Invalid input JSON on line 1, column 299: too many filters per filterGroup (count: 4, max allowed: 3)
One last thing, can I also search on dates like ‘Today’ or ‘Yesterday’ as I can with ticket views?
