This workflow follows the HTTP Request → Supabase recipe pattern — see all workflows that pair these two integrations.
The workflow JSON
Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →
{
"name": "Queue Worker Template",
"active": false,
"nodes": [
{
"parameters": {
"rule": {
"interval": [
{
"field": "minutes",
"minutesInterval": 2
}
]
}
},
"id": "every-two-minutes",
"name": "Every 2 Minutes",
"type": "n8n-nodes-base.scheduleTrigger",
"typeVersion": 1.2,
"position": [
0,
0
]
},
{
"parameters": {
"operation": "getAll",
"tableId": "dm_queue",
"returnAll": true,
"filterType": "string",
"filterString": "={{ 'status=eq.sent&sent_at=gte.' + new Date(Date.now() - 3600000).toISOString() }}"
},
"id": "count-recent",
"name": "Count Recent Jobs",
"type": "n8n-nodes-base.supabase",
"typeVersion": 1,
"position": [
220,
0
],
"alwaysOutputData": true
},
{
"parameters": {
"jsCode": "const recent = $input.all().filter(i => i.json.status === 'sent').length;\nconst LIMIT = 180;\nconst remaining = Math.max(0, LIMIT - recent);\nconst batchSize = Math.min(6, remaining);\nreturn [{ json: { recent, remaining, batchSize, canSend: batchSize > 0 } }];"
},
"id": "calculate-batch",
"name": "Calculate Batch Size",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
440,
0
]
},
{
"parameters": {
"conditions": {
"boolean": [
{
"value1": "={{ $json.canSend }}",
"value2": true
}
]
}
},
"id": "can-send",
"name": "Can Send?",
"type": "n8n-nodes-base.if",
"typeVersion": 1,
"position": [
660,
0
]
},
{
"parameters": {
"operation": "getAll",
"tableId": "dm_queue",
"limit": "={{ $('Calculate Batch Size').first().json.batchSize }}",
"filterType": "string",
"filterString": "status=eq.pending&order=created_at.asc"
},
"id": "get-pending",
"name": "Get Pending Jobs",
"type": "n8n-nodes-base.supabase",
"typeVersion": 1,
"position": [
880,
-120
]
},
{
"parameters": {
"method": "POST",
"url": "={{ 'https://graph.instagram.com/v21.0/' + $json.ig_account_id + '/messages' }}",
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "Authorization",
"value": "={{ 'Bearer ' + $json.access_token }}"
},
{
"name": "Content-Type",
"value": "application/json"
}
]
},
"sendBody": true,
"specifyBody": "json",
"jsonBody": "={{ JSON.stringify({ recipient: { id: $json.sender_id }, message: { attachment: { type: 'template', payload: { template_type: 'button', text: $json.dm_text, buttons: [{ type: 'web_url', url: $json.output_value, title: $json.btn_title || 'Open' }] } } } }) }}",
"options": {}
},
"id": "send-message",
"name": "Send Message",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4,
"position": [
1100,
-120
]
},
{
"parameters": {
"operation": "update",
"tableId": "dm_queue",
"matchType": "allFilters",
"filters": {
"conditions": [
{
"keyName": "id",
"condition": "eq",
"keyValue": "={{ $('Get Pending Jobs').item.json.id }}"
}
]
},
"fieldsUi": {
"fieldValues": [
{
"fieldId": "status",
"fieldValue": "sent"
},
{
"fieldId": "sent_at",
"fieldValue": "={{ new Date().toISOString() }}"
}
]
}
},
"id": "mark-sent",
"name": "Mark as Sent",
"type": "n8n-nodes-base.supabase",
"typeVersion": 1,
"position": [
1320,
-120
]
}
],
"connections": {
"Every 2 Minutes": {
"main": [
[
{
"node": "Count Recent Jobs",
"type": "main",
"index": 0
}
]
]
},
"Count Recent Jobs": {
"main": [
[
{
"node": "Calculate Batch Size",
"type": "main",
"index": 0
}
]
]
},
"Calculate Batch Size": {
"main": [
[
{
"node": "Can Send?",
"type": "main",
"index": 0
}
]
]
},
"Can Send?": {
"main": [
[
{
"node": "Get Pending Jobs",
"type": "main",
"index": 0
}
]
]
},
"Get Pending Jobs": {
"main": [
[
{
"node": "Send Message",
"type": "main",
"index": 0
}
]
]
},
"Send Message": {
"main": [
[
{
"node": "Mark as Sent",
"type": "main",
"index": 0
}
]
]
}
},
"settings": {
"executionOrder": "v1"
},
"tags": []
}
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
Queue Worker Template. Uses supabase, httpRequest. Scheduled trigger; 7 nodes.
Source: https://github.com/SoloSole/n8n-instagram-dm-automation-kit/blob/235099e4b367dc76c09085b29526605c9fcb80ab/templates/queue-worker-template/workflow.json — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
This n8n workflow provides automated monitoring of YouTube channels and sends real-time notifications to RocketChat when new videos are published. It supports all YouTube URL formats, uses dual-source
📘 Multi-Photo Facebook Post (Windows Directory) – How to Use ✅ Requirements To run this automation, make sure you have the following:
This workflow runs hourly to collect campaign spend, clicks, and impressions from Meta (Facebook), Google Ads, TikTok Ads, and Taboola, then upserts the metrics into Airtable and creates a time-stampe
This enterprise-grade n8n workflow automates the Instagram complaint handling process — from detection to resolution — using Claude AI, dynamic ticket assignment, and SLA enforcement. It converts cust
Multi YT To TT. Uses googleSheets, httpRequest, youTube. Scheduled trigger; 30 nodes.