\n
Search for all tasks based on a certain set of criteria (here, all tasks created before the last 30 days).
\nIf you wish to search for another object (such as contacts or deals), you can take a look at the CRM Search API for all available search requests. You can also browse through the Properties API to get a comprehensive list of available properties.
\n/crm/v3/objects/tasks/search
POST
{\n "limit": "5",\n "properties": [\n "hs_task_subject",\n "hs_task_type",\n "hs_timestamp"\n ],\n "filterGroups": [\n {\n "filters": [\n {\n "propertyName": "hs_task_status",\n "operator": "EQ",\n "value": "NOT_STARTED"\n },\n {\n "propertyName": "hs_createdate",\n "operator": "LT",\n "value": "{{formatDate(addDays(now; -30); "x")}}"\n }\n ]\n }\n ]\n }\n
\n0
{{if(module1.body.total = null; 1; module1.body.total / 100)}}
(if total is less than 100, do not repeat){{ifempty(module1.body.paging.next.after; 100)}}
(automatically sets it to the first module’s after
value, otherwise to 100 if after
value is empty)You can find out more about properties and search limitations here and here. Basically, the repeater allows you to loop over all HubSpot pages.
\nSleep module to prevent RateLimitError
Same as Module 1, except that you must add an after
parameter to include the repeater’s value.
+ "after": "{{module2.i}}"\n
\nIterate over Module 4’s results array: {{module4.body.results}}
.
Delete tasks using the ID returned by the iterator.
\n{\n "inputs":[\n {\n "id":"{{module5.id}}"\n }\n ]\n}\n
\nVoilà !
\n","author":{"@type":"Person","name":"Gabriel Guérin"},"upvoteCount":0}}}Reputation: 468
I would like to automatically bulk delete all tasks older than a month in HubSpot (we have more than 10,000 tasks!), instead of doing it one by one. I tried looking on the internet but it doesn’t seem that HubSpot has any functionalities like it. Thus, I tried to implement such scenario using Make (formerly Integromat) unsuccessfully.
Upvotes: 0
Views: 628
Reputation: 468
Answering to my question for knowledge purposes.
I managed to create a scenario allowing me to automatically bulk delete tasks (or anything) based on a certain set of criteria using Make (formerly Integromat). I had to use HubSpot’s API and Flow Control tools to achieve such result.
The scenario looks like the following:
Search for all tasks based on a certain set of criteria (here, all tasks created before the last 30 days).
If you wish to search for another object (such as contacts or deals), you can take a look at the CRM Search API for all available search requests. You can also browse through the Properties API to get a comprehensive list of available properties.
/crm/v3/objects/tasks/search
POST
{
"limit": "5",
"properties": [
"hs_task_subject",
"hs_task_type",
"hs_timestamp"
],
"filterGroups": [
{
"filters": [
{
"propertyName": "hs_task_status",
"operator": "EQ",
"value": "NOT_STARTED"
},
{
"propertyName": "hs_createdate",
"operator": "LT",
"value": "{{formatDate(addDays(now; -30); "x")}}"
}
]
}
]
}
0
{{if(module1.body.total = null; 1; module1.body.total / 100)}}
(if total is less than 100, do not repeat){{ifempty(module1.body.paging.next.after; 100)}}
(automatically sets it to the first module’s after
value, otherwise to 100 if after
value is empty)You can find out more about properties and search limitations here and here. Basically, the repeater allows you to loop over all HubSpot pages.
Sleep module to prevent RateLimitError
Same as Module 1, except that you must add an after
parameter to include the repeater’s value.
+ "after": "{{module2.i}}"
Iterate over Module 4’s results array: {{module4.body.results}}
.
Delete tasks using the ID returned by the iterator.
{
"inputs":[
{
"id":"{{module5.id}}"
}
]
}
Voilà !
Upvotes: 0