slack messages extraction
......
Shared 2/25/2026
0 views
Visual Workflow
JSON Code
{
"meta": {
"instanceId": "ebdb06186ae0257824d1c41aaeef4b5936f7b71898534e2f831820073083c145",
"templateCredsSetupCompleted": true
},
"nodes": [
{
"id": "70ce903d-3891-4ecf-9139-ee6976d02445",
"name": "Fetch Slack Messages",
"type": "n8n-nodes-base.slack",
"onError": "continueRegularOutput",
"position": [
-528,
400
],
"webhookId": "72ab0e4e-494e-4139-abee-a5746794b2de",
"parameters": {
"filters": {
"latest": "={{ $json.new_latest }}",
"oldest": "={{ $json.new_oldest }}",
"inclusive": true
},
"resource": "channel",
"channelId": {
"__rl": true,
"mode": "id",
"value": "={{ $('Loop Over Listed Channels').item.json.slack_channel_id }}"
},
"operation": "history",
"returnAll": true
},
"credentials": {
"slackApi": {
"id": "yfuJ1avJQ1wO8NWd",
"name": "Almedia GPT"
}
},
"executeOnce": false,
"typeVersion": 2.4,
"alwaysOutputData": true
},
{
"id": "d27d7ac8-88cd-4732-81d9-0840d1230702",
"name": "Get Slack Messages",
"type": "n8n-nodes-base.slack",
"position": [
992,
800
],
"webhookId": "9f742e9e-0972-4be4-8026-43853c870e3e",
"parameters": {
"ts": "={{ $json.ts }}",
"filters": {},
"resource": "channel",
"channelId": {
"__rl": true,
"mode": "id",
"value": "={{ $json.channel_id }}"
},
"operation": "replies",
"returnAll": true
},
"credentials": {
"slackApi": {
"id": "yfuJ1avJQ1wO8NWd",
"name": "Almedia GPT"
}
},
"typeVersion": 2.4
},
{
"id": "99a9234d-2a6b-443d-83e5-0510cde62742",
"name": "If Not in Channel",
"type": "n8n-nodes-base.if",
"position": [
-816,
144
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 3,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "3529bbc1-029b-4adb-860b-94692409c0a7",
"operator": {
"type": "string",
"operation": "notExists",
"singleValue": true
},
"leftValue": "={{ $json.error }}",
"rightValue": ""
}
]
}
},
"typeVersion": 2.3
},
{
"id": "0b459326-9075-4447-af7b-ea22442cbd40",
"name": "Pause to Avoid Rate Limiting",
"type": "n8n-nodes-base.wait",
"position": [
560,
800
],
"webhookId": "644b08c9-2b5a-46ba-8330-88a961822082",
"parameters": {
"amount": 3
},
"typeVersion": 1.1
},
{
"id": "629ace7e-80da-4214-9158-81aa5a4a8867",
"name": "Check If Message Has Files",
"type": "n8n-nodes-base.if",
"position": [
1360,
800
],
"parameters": {
"options": {
"ignoreCase": true
},
"conditions": {
"options": {
"version": 3,
"leftValue": "",
"caseSensitive": false,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "142d799f-c509-4cd2-941f-48fdcc19d93f",
"operator": {
"type": "boolean",
"operation": "true",
"singleValue": true
},
"leftValue": "={{ $json?.files?.length > 0 === true || $json?.text?.match(/https?:\\/\\/[^\\s/$.?#].[^\\s]*/g)?.length > 0 }}",
"rightValue": false
}
]
}
},
"typeVersion": 2.3
},
{
"id": "cff54ba5-f0e2-493f-bcad-3c1bd6886e82",
"name": "Log Internal Slack Messages",
"type": "n8n-nodes-base.supabase",
"onError": "continueRegularOutput",
"position": [
800,
448
],
"parameters": {
"tableId": "internal_slack_messages",
"dataToSend": "autoMapInputData"
},
"credentials": {
"supabaseApi": {
"id": "Tf9xDjIo3K02TrWN",
"name": "Almedia Supabase"
}
},
"typeVersion": 1
},
{
"id": "0037ea23-6449-447f-a8cf-a08868dbabc3",
"name": "Set Message Details after Media Analysis",
"type": "n8n-nodes-base.set",
"position": [
2016,
704
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "1",
"name": "slack_ts",
"type": "string",
"value": "={{ $('Get Slack Messages').item.json.ts }}"
},
{
"id": "2",
"name": "channel_id",
"type": "string",
"value": "={{ $('Loop Over Messages').item.json.channel_id || \"C0A5D0ASS2G\" }}"
},
{
"id": "3",
"name": "user_id",
"type": "string",
"value": "={{ $('Get Slack Messages').item.json.user }}"
},
{
"id": "4",
"name": "content",
"type": "string",
"value": "={{ $('Get Slack Messages').item.json.text }}"
},
{
"id": "5",
"name": "thread_ts",
"type": "string",
"value": "={{ $('Get Slack Messages').item.json?.thread_ts || $json.ts }}"
},
{
"id": "6",
"name": "parent_message_id",
"type": "string",
"value": "={{ $('Get Slack Messages').item.json?.thread_ts || $json.ts }}"
},
{
"id": "7",
"name": "is_thread_parent",
"type": "boolean",
"value": "={{ $('Get Slack Messages').item.json.thread_ts === $('Get Slack Messages').item.json.ts }}"
},
{
"id": "8",
"name": "reply_count",
"type": "number",
"value": "={{ $('Get Slack Messages').item.json?.reply_count || 0 }}"
},
{
"id": "9",
"name": "message_type",
"type": "string",
"value": "={{ $('Get Slack Messages').item.json.type }}"
},
{
"id": "10",
"name": "subtype",
"type": "string",
"value": "={{ $('Get Slack Messages').item.json?.subtype || '' }}"
},
{
"id": "11",
"name": "attachments",
"type": "string",
"value": "={{ $('Get Slack Messages').item.json?.files ? $('Get Slack Messages').item.json?.files.map(i => i.url_private_download).join(',') : '' }}"
},
{
"id": "12",
"name": "is_edited",
"type": "boolean",
"value": "={{ $('Get Slack Messages').item.json?.edited?.ts ? true : false }}"
},
{
"id": "13",
"name": "edited_at",
"type": "string",
"value": "={{ $('Get Slack Messages').item.json?.edited?.ts ? DateTime.fromSeconds(parseFloat($('Get Slack Messages').item.json?.edited?.ts)).toISO() : null }}"
},
{
"id": "14",
"name": "is_deleted",
"type": "boolean",
"value": "={{ $('Get Slack Messages').item.json?.deleted?.ts ? true : false }}"
},
{
"id": "15",
"name": "sent_at",
"type": "string",
"value": "={{ DateTime.fromSeconds(parseFloat($('Get Slack Messages').item.json.ts)).toISO() }}"
},
{
"id": "16",
"name": "message_id",
"type": "string",
"value": "={{ $('Loop Over Messages').item.json.channel_id + '-' + $('Get Slack Messages').item.json.ts }}"
},
{
"id": "e6f4fb66-b984-4310-95cb-fa628220b7f3",
"name": "content_description",
"type": "string",
"value": "={{ $json.description || \"no description\" }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "3fc7db37-311f-42da-84b6-4a9d2e8eba1d",
"name": "Exclude Testing Channels",
"type": "n8n-nodes-base.if",
"position": [
-1248,
384
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 3,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "701ef676-f26b-4be1-a02b-7de0c2759275",
"operator": {
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.slack_channel_id }}",
"rightValue": "C0A5D0ASS2G"
}
]
}
},
"typeVersion": 2.3
},
{
"id": "955c82ae-b7bb-4507-9755-2962b9769ab4",
"name": "Include Channel Details in Output",
"type": "n8n-nodes-base.set",
"position": [
-240,
544
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "8019c9ff-ba7e-4e12-b304-23b1e6a30339",
"name": "channel_id",
"type": "string",
"value": "={{ $('Loop Over Listed Channels').item.json.slack_channel_id }}"
},
{
"id": "9cfdbb49-6d0a-4fb0-87e4-69c65ad6943a",
"name": "channel_name",
"type": "string",
"value": "={{ $('Loop Over Listed Channels').item.json.channel_name }}"
},
{
"id": "c23f0cc7-abbe-4b97-a9ba-8711e439330f",
"name": "new_latest",
"type": "string",
"value": "={{ $('Set Week to Index').item.json.new_latest }}"
},
{
"id": "694b6d00-2d21-4084-a6bd-bc9a9ac060e0",
"name": "latest",
"type": "string",
"value": "={{ $('Set Week to Index').item.json.latest }}"
},
{
"id": "98d4dadf-5e24-4be8-b411-8a3435c32452",
"name": "new_oldest",
"type": "string",
"value": "={{ $('Set Week to Index').item.json.new_oldest }}"
},
{
"id": "9f4563e3-29ff-4d86-809c-9deb485706d8",
"name": "oldest",
"type": "string",
"value": "={{ $('Set Week to Index').item.json.oldest }}"
}
]
},
"includeOtherFields": true
},
"typeVersion": 3.4
},
{
"id": "91bec29a-abc7-4074-8c80-e6086df8021e",
"name": "Filter Out Channel Joins and Bot Messages",
"type": "n8n-nodes-base.filter",
"position": [
160,
128
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 3,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "or",
"conditions": [
{
"id": "e5163007-29d6-4953-a2ac-aebbb5b6bd66",
"operator": {
"type": "boolean",
"operation": "false",
"singleValue": true
},
"leftValue": "={{ $json.slack_channel_id === \"C0A5D0ASS2G\" || ($json?.subtype != null && ['bot_message', 'channel_join' ].includes($json?.subtype)) }}",
"rightValue": "bot_message"
}
]
}
},
"typeVersion": 2.3
},
{
"id": "59e04539-e8e9-4c18-81d0-c8aefd47c920",
"name": "Get Image Description using Gemini",
"type": "n8n-nodes-base.executeWorkflow",
"position": [
1776,
704
],
"parameters": {
"mode": "each",
"options": {
"waitForSubWorkflow": true
},
"workflowId": {
"__rl": true,
"mode": "list",
"value": "HxiPvMMeplQGP82O",
"cachedResultUrl": "/workflow/HxiPvMMeplQGP82O",
"cachedResultName": "Almedia AI — Internal Channels - Initialization & Slack Trigger"
},
"workflowInputs": {
"value": {},
"schema": [],
"mappingMode": "defineBelow",
"matchingColumns": [],
"attemptToConvertTypes": false,
"convertFieldsToString": true
}
},
"typeVersion": 1.3
},
{
"id": "2ddd3440-b7c8-44ec-8df2-d20188410914",
"name": "Set Message Details",
"type": "n8n-nodes-base.set",
"position": [
1888,
912
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "1",
"name": "slack_ts",
"type": "string",
"value": "={{ $json.ts }}"
},
{
"id": "2",
"name": "channel_id",
"type": "string",
"value": "={{ $('Loop Over Messages').item.json.channel_id || \"C0A5D0ASS2G\" }}"
},
{
"id": "3",
"name": "user_id",
"type": "string",
"value": "={{ $json.user }}"
},
{
"id": "4",
"name": "content",
"type": "string",
"value": "={{ $json.text }}"
},
{
"id": "5",
"name": "thread_ts",
"type": "string",
"value": "={{ $json?.thread_ts || $json.ts }}"
},
{
"id": "6",
"name": "parent_message_id",
"type": "string",
"value": "={{ $json?.thread_ts || $json.ts }}"
},
{
"id": "7",
"name": "is_thread_parent",
"type": "boolean",
"value": "={{ $json?.thread_ts === $json?.ts }}"
},
{
"id": "8",
"name": "reply_count",
"type": "number",
"value": "={{ $json?.reply_count || 0 }}"
},
{
"id": "9",
"name": "message_type",
"type": "string",
"value": "={{ $json.type }}"
},
{
"id": "10",
"name": "subtype",
"type": "string",
"value": "={{ $json?.subtype || '' }}"
},
{
"id": "11",
"name": "attachments",
"type": "string",
"value": "={{ $json?.files ? $json?.files.map(i => i.url_private_download).join(',') : '' }}"
},
{
"id": "12",
"name": "is_edited",
"type": "boolean",
"value": "={{ $json?.edited?.ts ? true : false }}"
},
{
"id": "13",
"name": "edited_at",
"type": "string",
"value": "={{ $json?.edited?.ts ? DateTime.fromSeconds(parseFloat($json?.edited?.ts)).toISO() : null }}"
},
{
"id": "14",
"name": "is_deleted",
"type": "boolean",
"value": "={{ $json?.deleted?.ts ? true : false }}"
},
{
"id": "15",
"name": "sent_at",
"type": "string",
"value": "={{ DateTime.fromSeconds(parseFloat($json.ts)).toISO() }}"
},
{
"id": "16",
"name": "message_id",
"type": "string",
"value": "={{ $('Loop Over Messages').item.json.channel_id + '-' + $json.ts }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "31712c3b-f62b-4294-8867-de7ee0ed9084",
"name": "Set Channels as Initialized",
"type": "n8n-nodes-base.supabase",
"position": [
1632,
128
],
"parameters": {
"filters": {
"conditions": [
{
"keyName": "slack_channel_id",
"keyValue": "={{ $json.slack_channel_id }}",
"condition": "eq"
}
]
},
"tableId": "internal_slack_channels",
"fieldsUi": {
"fieldValues": [
{
"fieldId": "initialized",
"fieldValue": "true"
}
]
},
"matchType": "allFilters",
"operation": "update"
},
"credentials": {
"supabaseApi": {
"id": "Tf9xDjIo3K02TrWN",
"name": "Almedia Supabase"
}
},
"typeVersion": 1
},
{
"id": "0b08895b-77dd-421d-a9ed-5d5153293188",
"name": "Get row(s)",
"type": "n8n-nodes-base.dataTable",
"position": [
-976,
400
],
"parameters": {
"filters": {
"conditions": [
{
"keyName": "channel_id",
"keyValue": "={{ $json.slack_channel_id }}"
}
]
},
"matchType": "allConditions",
"operation": "get",
"dataTableId": {
"__rl": true,
"mode": "list",
"value": "i1vcFzCDSS5rN4sp",
"cachedResultUrl": "/projects/nH2Gbm5SufiTNEIk/datatables/i1vcFzCDSS5rN4sp",
"cachedResultName": "weekly_indexing"
}
},
"typeVersion": 1.1,
"alwaysOutputData": true
},
{
"id": "7335cee5-059e-4a3d-9ff2-8742dae2f70f",
"name": "Set Week to Index",
"type": "n8n-nodes-base.set",
"position": [
-752,
400
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "d996ab0b-6df2-4d97-9d68-e423c44b9e13",
"name": "new_latest",
"type": "string",
"value": "={{ Object.keys($('Get row(s)').item.json).length === 0 ? \"2025-01-08\".toDateTime().toLocal() : $('Get row(s)').item.json.latest.toDateTime().plus(7, \"days\").toLocal() }}"
},
{
"id": "d26c7416-c966-46d4-a205-ab033eadb598",
"name": "latest",
"type": "string",
"value": "={{ $json.latest }}"
},
{
"id": "e98237db-9cc5-4afc-aef2-68b72256b523",
"name": "new_oldest",
"type": "string",
"value": "={{ Object.keys($('Get row(s)').item.json).length === 0 ? \"2025-01-01\".toDateTime().toLocal() : $('Get row(s)').item.json.oldest.toDateTime().plus(7, \"days\").toLocal() }}"
},
{
"id": "7bae5847-09b9-46f8-98a6-a4036e9d886c",
"name": "oldest",
"type": "string",
"value": "={{ $json.oldest }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "2db160a4-8d59-47d3-8d3f-b127b94df6d1",
"name": "When Executed by Another Workflow",
"type": "n8n-nodes-base.executeWorkflowTrigger",
"position": [
-1600,
160
],
"parameters": {
"inputSource": "passthrough"
},
"typeVersion": 1.1
},
{
"id": "a3d9d0cf-c154-4888-b6f3-1d0d68891800",
"name": "Empty",
"type": "n8n-nodes-base.if",
"position": [
-160,
240
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 3,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "d3884a96-227c-42e3-8aa2-8136397adf17",
"operator": {
"type": "object",
"operation": "notEmpty",
"singleValue": true
},
"leftValue": "={{ $json }}",
"rightValue": ""
}
]
}
},
"typeVersion": 2.3
},
{
"id": "a42aa1e4-2230-46b2-8a95-a2783b00c1be",
"name": "Loop Over Messages",
"type": "n8n-nodes-base.splitInBatches",
"position": [
48,
784
],
"parameters": {
"options": {}
},
"typeVersion": 3
},
{
"id": "33013f08-177c-455c-8972-c72bb38e7fab",
"name": "Get information about a user",
"type": "n8n-nodes-base.slack",
"position": [
1344,
432
],
"webhookId": "22c541ba-4fe9-470b-846f-a80426af11c6",
"parameters": {
"user": {
"__rl": true,
"mode": "id",
"value": "={{ $('Loop Over All Messages').item.json.user_id }}"
},
"resource": "user"
},
"credentials": {
"slackApi": {
"id": "yfuJ1avJQ1wO8NWd",
"name": "Almedia GPT"
}
},
"typeVersion": 2.4
},
{
"id": "e4aabef3-7feb-42cd-b746-ce6636bf12b7",
"name": "No Operation, do nothing",
"type": "n8n-nodes-base.noOp",
"position": [
2192,
272
],
"parameters": {},
"typeVersion": 1
},
{
"id": "a366a497-3a84-4528-a96d-4dc0de4bb55f",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1312,
48
],
"parameters": {
"color": 5,
"width": 1296,
"height": 672,
"content": "### Get all Parent Level Messages\n- Get week to get messages for - based on data table entries\n- Use Slack node to get parent-level messages\n- If no Slack messages present - Return to parent workflow"
},
"typeVersion": 1
},
{
"id": "38dae3fc-7c89-4c0b-b572-866007e531d0",
"name": "Loop Over Listed Channels",
"type": "n8n-nodes-base.splitInBatches",
"position": [
-1264,
160
],
"parameters": {
"options": {}
},
"typeVersion": 3
},
{
"id": "cb46f136-911c-402a-a4d2-8e90829eb54e",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1696,
48
],
"parameters": {
"color": 6,
"width": 368,
"height": 272,
"content": "### Parent Workflow - Sends Channel Details (most importantly ID)"
},
"typeVersion": 1
},
{
"id": "d4cc4f0e-9190-4551-a010-0f03502b653b",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"position": [
368,
48
],
"parameters": {
"color": 6,
"width": 2128,
"height": 592,
"content": "### Log New Messages and Return\n- Update new messages into Supabase\n- Update data table to indicate the most recently processed week\n- If the "
},
"typeVersion": 1
},
{
"id": "3337c333-a7b9-406a-825d-160eeea88a1f",
"name": "Sticky Note3",
"type": "n8n-nodes-base.stickyNote",
"position": [
0,
656
],
"parameters": {
"color": 6,
"width": 2496,
"height": 416,
"content": "### Loop Through Each Parent Message and Get Replies\n- For each reply - analyze the media/links using the subworkflow in the Initialization flow\n- Merge all entries and return the full threads / media analysis in the Done output of the Loop node"
},
"typeVersion": 1
},
{
"id": "a144e75c-6925-464b-8f8f-4306d80d3c08",
"name": "Sticky Note4",
"type": "n8n-nodes-base.stickyNote",
"position": [
0,
48
],
"parameters": {
"color": 4,
"width": 352,
"height": 592,
"content": "### Filter out Bot Messages"
},
"typeVersion": 1
},
{
"id": "768b3ee6-251f-44b8-b468-c18bb952eef6",
"name": "Update Week Initialized in Data Table",
"type": "n8n-nodes-base.dataTable",
"position": [
624,
256
],
"parameters": {
"columns": {
"value": {
"latest": "={{ $('Set Week to Index').item.json.new_latest.toDateTime().toLocal() }}",
"oldest": "={{ $('Set Week to Index').item.json.new_oldest.toDateTime().toLocal() }}",
"channel_id": "={{ $('When Executed by Another Workflow').item.json.slack_channel_id }}",
"channel_name": "={{ $('When Executed by Another Workflow').item.json.channel_name }}"
},
"schema": [
{
"id": "latest",
"type": "dateTime",
"display": true,
"removed": false,
"readOnly": false,
"required": false,
"displayName": "latest",
"defaultMatch": false
},
{
"id": "oldest",
"type": "dateTime",
"display": true,
"removed": false,
"readOnly": false,
"required": false,
"displayName": "oldest",
"defaultMatch": false
},
{
"id": "channel_id",
"type": "string",
"display": true,
"removed": false,
"readOnly": false,
"required": false,
"displayName": "channel_id",
"defaultMatch": false
},
{
"id": "channel_name",
"type": "string",
"display": true,
"removed": false,
"readOnly": false,
"required": false,
"displayName": "channel_name",
"defaultMatch": false
}
],
"mappingMode": "defineBelow",
"matchingColumns": [],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"filters": {
"conditions": [
{
"keyName": "channel_id",
"keyValue": "={{ $('When Executed by Another Workflow').item.json.slack_channel_id }}"
}
]
},
"options": {},
"matchType": "allConditions",
"operation": "upsert",
"dataTableId": {
"__rl": true,
"mode": "list",
"value": "i1vcFzCDSS5rN4sp",
"cachedResultUrl": "/projects/nH2Gbm5SufiTNEIk/datatables/i1vcFzCDSS5rN4sp",
"cachedResultName": "weekly_indexing"
}
},
"executeOnce": true,
"typeVersion": 1.1,
"alwaysOutputData": true
},
{
"id": "cfc084f7-efe2-45f3-97b2-b3465aaa0660",
"name": "If it's this week",
"type": "n8n-nodes-base.if",
"position": [
928,
256
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 3,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "ea53cba7-e460-4664-b7d1-6cdfa4c286fd",
"operator": {
"type": "dateTime",
"operation": "after"
},
"leftValue": "={{ $('Set Week to Index').item.json.new_latest }}",
"rightValue": "={{ $now }}"
}
]
}
},
"typeVersion": 2.3
},
{
"id": "a6da080e-3fc9-44ac-a33a-d13ddb77d263",
"name": "Create new user row in users' table",
"type": "n8n-nodes-base.supabase",
"position": [
1648,
432
],
"parameters": {
"tableId": "internal_slack_users",
"fieldsUi": {
"fieldValues": [
{
"fieldId": "slack_user_id",
"fieldValue": "={{ $json.id }}"
},
{
"fieldId": "display_name",
"fieldValue": "={{ $json.profile.display_name }}"
},
{
"fieldId": "is_bot",
"fieldValue": "={{ $json.is_bot || $json.is_app_user }}"
},
{
"fieldId": "position",
"fieldValue": "={{ $json.profile.title }}"
},
{
"fieldId": "full_name",
"fieldValue": "={{ $json.profile.real_name }}"
},
{
"fieldId": "internal",
"fieldValue": "={{ $json.team_id === \"T028XN2NDPD\" }}"
}
]
}
},
"credentials": {
"supabaseApi": {
"id": "Tf9xDjIo3K02TrWN",
"name": "Almedia Supabase"
}
},
"typeVersion": 1
},
{
"id": "2f7a1798-a692-4407-9ff3-01210a993f89",
"name": "Set user details to update",
"type": "n8n-nodes-base.set",
"position": [
1952,
432
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "3b2d5574-2fbc-4c6f-9a90-55d66123aa3a",
"name": "slack_ts",
"type": "string",
"value": "={{ $('Loop Over All Messages').item.json.slack_ts }}"
},
{
"id": "192d32e1-cc97-445b-ba58-f93aa9060692",
"name": "channel_id",
"type": "string",
"value": "={{ $('Loop Over All Messages').item.json.channel_id }}"
},
{
"id": "83a4ba18-147a-487d-ae2b-b7af1c4630de",
"name": "user_id",
"type": "string",
"value": "={{ $('Loop Over All Messages').item.json.user_id }}"
},
{
"id": "cda89341-9ed5-444d-bd7f-9985980ca00d",
"name": "content",
"type": "string",
"value": "={{ $('Loop Over All Messages').item.json.content }}"
},
{
"id": "d7a45812-4d32-40d9-98d4-af7f03147258",
"name": "thread_ts",
"type": "string",
"value": "={{ $('Loop Over All Messages').item.json.thread_ts }}"
},
{
"id": "f04a5435-b292-4ed9-92d4-8474286adfea",
"name": "parent_message_id",
"type": "string",
"value": "={{ $('Loop Over All Messages').item.json.parent_message_id }}"
},
{
"id": "0dc6f677-0869-4c21-afaf-3ce8c7f47544",
"name": "is_thread_parent",
"type": "boolean",
"value": "={{ $('Loop Over All Messages').item.json.is_thread_parent }}"
},
{
"id": "719055e1-2632-4667-bf54-5f91bbe5c312",
"name": "reply_count",
"type": "number",
"value": "={{ $('Loop Over All Messages').item.json.reply_count }}"
},
{
"id": "f1846059-55de-4b28-bbee-0f780a744c6e",
"name": "message_type",
"type": "string",
"value": "={{ $('Loop Over All Messages').item.json.message_type }}"
},
{
"id": "3f6f2c92-e8fb-4949-acc5-fe764d951d87",
"name": "subtype",
"type": "string",
"value": "={{ $('Loop Over All Messages').item.json.subtype }}"
},
{
"id": "ad0d027b-a5ad-4c09-909a-a13efdf88d19",
"name": "attachments",
"type": "string",
"value": "={{ $('Loop Over All Messages').item.json.attachments }}"
},
{
"id": "1c611395-7ed2-4f3b-875b-1403db2b1600",
"name": "is_edited",
"type": "boolean",
"value": "={{ $('Loop Over All Messages').item.json.is_edited }}"
},
{
"id": "1468195e-4aa8-4c69-919b-0b293465a3ae",
"name": "is_deleted",
"type": "boolean",
"value": "={{ $('Loop Over All Messages').item.json.is_deleted }}"
},
{
"id": "52af6ae5-c393-4cdf-91a1-bba7c06d7304",
"name": "sent_at",
"type": "string",
"value": "={{ $('Loop Over All Messages').item.json.sent_at }}"
},
{
"id": "2770d855-f5d4-4e56-a1e6-81ff5b13bbba",
"name": "message_id",
"type": "string",
"value": "={{ $('Loop Over All Messages').item.json.message_id }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "2e31a353-a735-4cd6-b4df-dfcb0381ee41",
"name": "If sender does not exist (FK Constraint Error)",
"type": "n8n-nodes-base.if",
"position": [
1088,
448
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 3,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "22295f93-134f-46fb-826c-6dc65d53213d",
"operator": {
"type": "boolean",
"operation": "true",
"singleValue": true
},
"leftValue": "={{ $json?.error != null && $json?.error?.includes(\"foreign key constraint \\\"internal_slack_messages_user_id_fkey\") }}",
"rightValue": "\"internal_slack_messages\\\" violates foreign key constraint \\\"internal_slack_messages_user_id_fkey"
}
]
}
},
"typeVersion": 2.3
},
{
"id": "dc07b238-bc0e-4e7d-adc9-8d4a316d1540",
"name": "Loop Over All Messages",
"type": "n8n-nodes-base.splitInBatches",
"position": [
416,
432
],
"parameters": {
"options": {}
},
"typeVersion": 3
},
{
"id": "9cdb6497-b7a7-4b9b-a904-31893bc24968",
"name": "Retry logging messages",
"type": "n8n-nodes-base.supabase",
"onError": "continueRegularOutput",
"position": [
2224,
464
],
"parameters": {
"tableId": "internal_slack_messages",
"dataToSend": "autoMapInputData"
},
"credentials": {
"supabaseApi": {
"id": "Tf9xDjIo3K02TrWN",
"name": "Almedia Supabase"
}
},
"typeVersion": 1
},
{
"id": "19ed190a-1e63-4da3-beb5-e779f3cd3a0b",
"name": "Merge [Media/No Media]",
"type": "n8n-nodes-base.merge",
"position": [
2352,
896
],
"parameters": {},
"typeVersion": 3.2
}
],
"pinData": {
"When Executed by Another Workflow": [
{
"id": "659611b3-ed3c-4a6d-8fc9-cbf8540970d1",
"topic": "",
"purpose": "",
"is_member": true,
"created_at": "2026-02-23T23:02:19.56309+00:00",
"updated_at": "2026-02-25T12:10:21.322793+00:00",
"initialized": false,
"is_archived": false,
"channel_name": "product",
"sync_enabled": true,
"last_synced_ts": null,
"slack_channel_id": "C03122ZR80L"
}
]
},
"connections": {
"Empty": {
"main": [
[
{
"node": "Include Channel Details in Output",
"type": "main",
"index": 0
}
],
[
{
"node": "Update Week Initialized in Data Table",
"type": "main",
"index": 0
}
]
]
},
"Get row(s)": {
"main": [
[
{
"node": "Set Week to Index",
"type": "main",
"index": 0
}
]
]
},
"If Not in Channel": {
"main": [
[
{
"node": "Filter Out Channel Joins and Bot Messages",
"type": "main",
"index": 0
}
]
]
},
"If it's this week": {
"main": [
[
{
"node": "Set Channels as Initialized",
"type": "main",
"index": 0
}
],
[
{
"node": "No Operation, do nothing",
"type": "main",
"index": 0
}
]
]
},
"Set Week to Index": {
"main": [
[
{
"node": "Fetch Slack Messages",
"type": "main",
"index": 0
}
]
]
},
"Get Slack Messages": {
"main": [
[
{
"node": "Check If Message Has Files",
"type": "main",
"index": 0
}
]
]
},
"Loop Over Messages": {
"main": [
[
{
"node": "Loop Over All Messages",
"type": "main",
"index": 0
}
],
[
{
"node": "Pause to Avoid Rate Limiting",
"type": "main",
"index": 0
}
]
]
},
"Set Message Details": {
"main": [
[
{
"node": "Merge [Media/No Media]",
"type": "main",
"index": 1
}
]
]
},
"Fetch Slack Messages": {
"main": [
[
{
"node": "Empty",
"type": "main",
"index": 0
}
]
]
},
"Loop Over All Messages": {
"main": [
[
{
"node": "Update Week Initialized in Data Table",
"type": "main",
"index": 0
}
],
[
{
"node": "Log Internal Slack Messages",
"type": "main",
"index": 0
}
]
]
},
"Merge [Media/No Media]": {
"main": [
[
{
"node": "Loop Over Messages",
"type": "main",
"index": 0
}
]
]
},
"Retry logging messages": {
"main": [
[
{
"node": "Loop Over All Messages",
"type": "main",
"index": 0
}
]
]
},
"Exclude Testing Channels": {
"main": [
[],
[
{
"node": "Get row(s)",
"type": "main",
"index": 0
}
]
]
},
"Loop Over Listed Channels": {
"main": [
[
{
"node": "If Not in Channel",
"type": "main",
"index": 0
}
],
[
{
"node": "Exclude Testing Channels",
"type": "main",
"index": 0
}
]
]
},
"Check If Message Has Files": {
"main": [
[
{
"node": "Get Image Description using Gemini",
"type": "main",
"index": 0
}
],
[
{
"node": "Set Message Details",
"type": "main",
"index": 0
}
]
]
},
"Set user details to update": {
"main": [
[
{
"node": "Retry logging messages",
"type": "main",
"index": 0
}
]
]
},
"Log Internal Slack Messages": {
"main": [
[
{
"node": "If sender does not exist (FK Constraint Error)",
"type": "main",
"index": 0
}
]
]
},
"Get information about a user": {
"main": [
[
{
"node": "Create new user row in users' table",
"type": "main",
"index": 0
}
]
]
},
"Pause to Avoid Rate Limiting": {
"main": [
[
{
"node": "Get Slack Messages",
"type": "main",
"index": 0
}
]
]
},
"Include Channel Details in Output": {
"main": [
[
{
"node": "Loop Over Listed Channels",
"type": "main",
"index": 0
}
]
]
},
"When Executed by Another Workflow": {
"main": [
[
{
"node": "Loop Over Listed Channels",
"type": "main",
"index": 0
}
]
]
},
"Get Image Description using Gemini": {
"main": [
[
{
"node": "Set Message Details after Media Analysis",
"type": "main",
"index": 0
}
]
]
},
"Create new user row in users' table": {
"main": [
[
{
"node": "Set user details to update",
"type": "main",
"index": 0
}
]
]
},
"Update Week Initialized in Data Table": {
"main": [
[
{
"node": "If it's this week",
"type": "main",
"index": 0
}
]
]
},
"Set Message Details after Media Analysis": {
"main": [
[
{
"node": "Merge [Media/No Media]",
"type": "main",
"index": 0
}
]
]
},
"Filter Out Channel Joins and Bot Messages": {
"main": [
[
{
"node": "Loop Over Messages",
"type": "main",
"index": 0
}
]
]
},
"If sender does not exist (FK Constraint Error)": {
"main": [
[
{
"node": "Get information about a user",
"type": "main",
"index": 0
}
],
[
{
"node": "Loop Over All Messages",
"type": "main",
"index": 0
}
]
]
}
}
}