This workflow follows the Error Trigger → HTTP Request 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 →
{
"nodes": [
{
"parameters": {
"rule": {
"interval": [
{
"field": "cronExpression",
"expression": "0 9 * * *"
}
]
}
},
"id": "7b48a8b6-0981-410d-9071-b294048adcb7",
"name": "\u23f0 \u0415\u0436\u0435\u0434\u043d\u0435\u0432\u043d\u043e 09:00",
"type": "n8n-nodes-base.scheduleTrigger",
"typeVersion": 1.1,
"position": [
1424,
-320
]
},
{
"parameters": {
"jsCode": "// \u0420\u0430\u0441\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u043c \u043f\u0435\u0440\u0438\u043e\u0434. \u041a\u0430\u0436\u0434\u044b\u0439 \u0434\u0435\u043d\u044c \u0432 9:00 \u2014 \u0434\u0430\u043d\u043d\u044b\u0435 \u0437\u0430 \u0412\u0427\u0415\u0420\u0410.\nconst today = new Date();\nconst yesterday = new Date(today);\nyesterday.setDate(yesterday.getDate() - 1);\n\nconst yesterdayStr = yesterday.toISOString().split('T')[0];\nconst periodStart = new Date('2026-01-01');\nconst periodEnd = yesterday;\nconst periodStartTimestamp = Math.floor(periodStart.getTime() / 1000);\nconst periodEndTimestamp = Math.floor(periodEnd.getTime() / 1000) + 86399;\n\nconsole.log(`\ud83d\udcc5 \u0410\u0433\u0440\u0435\u0433\u0430\u0446\u0438\u044f \u0437\u0430 \u0432\u0447\u0435\u0440\u0430 ${yesterdayStr} (\u0435\u0436\u0435\u0434\u043d\u0435\u0432\u043d\u043e 09:00)`);\n\nreturn {\n json: {\n period_start: periodStart.toISOString().split('T')[0],\n period_end: periodEnd.toISOString().split('T')[0],\n period_start_timestamp: periodStartTimestamp,\n period_end_timestamp: periodEndTimestamp,\n yesterday_date: yesterdayStr,\n today_date: today.toISOString().split('T')[0],\n yesterday_only_start: yesterdayStr,\n yesterday_only_end: yesterdayStr\n }\n};"
},
"id": "d37889cc-e079-4c91-8f31-bcd3c49a7005",
"name": "\ud83d\udcc5 \u0420\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u0442\u044c \u043f\u0435\u0440\u0438\u043e\u0434",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
1648,
-320
]
},
{
"parameters": {
"url": "https://graph.facebook.com/v21.0/17841464802410425",
"sendQuery": true,
"queryParameters": {
"parameters": [
{
"name": "access_token",
"value": "EAAa3xKWvHHYBQqKLp1WfZA6ZBLeddlHCwrkFkLsLyZAJUR5ugf5jbGAW0dwS9AUDsI6Q0oYCPXucAkQHZA0E5d2ah2HsGI0FEUNfwwRnkY4C9BwXzZA4ZCK3jT7NKfYWnle3JUYSf7vyuVNw0bz5Td0xxIYhEWn2ZC7mrKK8K6ZBKohcOmIMVRVmNOlsk7Hp"
},
{
"name": "fields",
"value": "followers_count"
}
]
},
"options": {
"timeout": 30000
}
},
"id": "9dc31b69-0ad5-4786-8225-ed71459c50c6",
"name": "\ud83d\udc65 \u041f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u043e\u0432 (\u0441\u0435\u0433\u043e\u0434\u043d\u044f)",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
1856,
-320
]
},
{
"parameters": {
"jsCode": "// \u041f\u043e\u043b\u0443\u0447\u0438\u0442\u044c followers_today \u0437\u0430 \u0432\u0447\u0435\u0440\u0430 (\u0442\u043e\u0442\u0430\u043b \u043d\u0430 \u043a\u043e\u043d\u0435\u0446 \u0434\u043d\u044f). \u041f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 1 \u0438\u043b\u0438 N \u0434\u043d\u0435\u0439 (\u0431\u044d\u043a\u0444\u0438\u043b\u043b).\nconst items = $input.all();\nconst out = items.map(item => {\n const periodData = item.json;\n const yesterday = periodData.yesterday_date;\n const url = `https://pyscczcuersdjvpmkiec.supabase.co/rest/v1/daily_data?project_id=eq.64c94e87-630c-470e-8ab1-8f7c8c835efa&date=eq.${yesterday}&select=followers_today,followers`;\n return { json: { url, yesterday, ...periodData } };\n});\nconsole.log(`\ud83d\udd17 \u041f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u043e\u0432 \u0437\u0430 ${items.length} \u0434\u043d.`);\nreturn out;"
},
"id": "get-yesterday-followers",
"name": "\ud83d\udd17 \u041f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u043e\u0432 (\u0432\u0447\u0435\u0440\u0430)",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
1856,
-512
]
},
{
"parameters": {
"url": "={{ $json.url }}",
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "apikey",
"value": "<redacted-credential>"
},
{
"name": "Authorization",
"value": "<redacted-credential>"
}
]
},
"options": {
"timeout": 30000
}
},
"id": "query-yesterday-followers",
"name": "\ud83d\udcca \u0417\u0430\u043f\u0440\u043e\u0441 \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u043e\u0432 (\u0432\u0447\u0435\u0440\u0430)",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
2080,
-512
]
},
{
"parameters": {
"jsCode": "// \u0410\u0433\u0440\u0435\u0433\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u043e\u0432 \u0438\u0437 \u0432\u0441\u0435\u0445 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u0432\nconst allInputs = $input.all();\n\nlet todayFollowers = 0;\nlet yesterdayFollowers = 0;\nlet periodData = null;\n\n// \u0420\u0430\u0437\u0431\u0438\u0440\u0430\u0435\u043c \u0432\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u043e \u0442\u0438\u043f\u0430\u043c\nfor (const input of allInputs) {\n const data = input.json;\n\n // \u0414\u0430\u043d\u043d\u044b\u0435 \u043f\u0435\u0440\u0438\u043e\u0434\u0430\n if (data.period_start && data.period_end) {\n periodData = data;\n }\n\n // \u0414\u0430\u043d\u043d\u044b\u0435 \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u043e\u0432 \u0441\u0435\u0433\u043e\u0434\u043d\u044f\n if (data.followers_count !== undefined) {\n todayFollowers = data.followers_count;\n }\n\n // \u0414\u0430\u043d\u043d\u044b\u0435 \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u043e\u0432 \u0432\u0447\u0435\u0440\u0430 (\u0438\u0437 \u0431\u0430\u0437\u044b): followers_today = \u0442\u043e\u0442\u0430\u043b \u043d\u0430 \u043a\u043e\u043d\u0435\u0446 \u0434\u043d\u044f\n if (Array.isArray(data) && data.length > 0) {\n const row = data[0];\n yesterdayFollowers = (row.followers_today ?? row.followers) ?? 0;\n }\n}\n\n// \u0413\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u0443\u0435\u043c \u043d\u0430\u043b\u0438\u0447\u0438\u0435 periodData\nif (!periodData) {\n const today = new Date();\n const yesterdayDate = new Date(today);\n yesterdayDate.setDate(yesterdayDate.getDate() - 1);\n periodData = {\n yesterday_date: yesterdayDate.toISOString().split('T')[0],\n today_date: today.toISOString().split('T')[0],\n period_start: '2026-01-01',\n period_end: yesterdayDate.toISOString().split('T')[0]\n };\n}\n\n// \u0412\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c \u043d\u043e\u0432\u044b\u0445 \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u043e\u0432\nconst newFollowers = Math.max(0, todayFollowers - yesterdayFollowers);\n\n// \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u0434\u0430\u0442\u0443 \u0434\u043b\u044f \u0437\u0430\u043f\u0438\u0441\u0438 (\u0432\u0447\u0435\u0440\u0430\u0448\u043d\u0438\u0439 \u0434\u0435\u043d\u044c)\nlet yesterday;\nif (periodData && periodData.yesterday_date) {\n yesterday = periodData.yesterday_date;\n} else {\n // \u0415\u0441\u043b\u0438 periodData \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0432\u0447\u0435\u0440\u0430\u0448\u043d\u044e\u044e \u0434\u0430\u0442\u0443\n const today = new Date();\n const yesterdayDate = new Date(today);\n yesterdayDate.setDate(yesterdayDate.getDate() - 1);\n yesterday = yesterdayDate.toISOString().split('T')[0];\n}\n\nconsole.log(`\\n=== \u041f\u041e\u0414\u0421\u0427\u0415\u0422 \u041d\u041e\u0412\u042b\u0425 \u041f\u041e\u0414\u041f\u0418\u0421\u0427\u0418\u041a\u041e\u0412 ===`);\nconsole.log(`\ud83d\udcc5 \u0414\u0430\u0442\u0430: ${yesterday}`);\nconsole.log(`\ud83d\udc65 \u0421\u0435\u0433\u043e\u0434\u043d\u044f: ${todayFollowers.toLocaleString('ru-RU')}`);\nconsole.log(`\ud83d\udc65 \u0412\u0447\u0435\u0440\u0430: ${yesterdayFollowers.toLocaleString('ru-RU')}`);\nconsole.log(`\u2795 \u041d\u043e\u0432\u044b\u0445: ${newFollowers.toLocaleString('ru-RU')}`);\n\nreturn {\n json: {\n project_id: '64c94e87-630c-470e-8ab1-8f7c8c835efa',\n date: yesterday,\n followers: newFollowers,\n followers_today: todayFollowers,\n followers_yesterday: yesterdayFollowers,\n new_followers: newFollowers\n }\n};"
},
"id": "calculate-new-followers",
"name": "\ud83e\uddee \u0410\u0433\u0440\u0435\u0433\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u043e\u0432",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
2528,
-512
]
},
{
"parameters": {
"jsCode": "// daily_data: followers = \u043f\u0440\u0438\u0440\u043e\u0441\u0442 (\u043a\u043e\u043b\u043e\u043d\u043a\u0430 \u041f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u0438), followers_today = \u0442\u043e\u0442\u0430\u043b \u0434\u043b\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430\nconst d = $input.first().json;\nreturn {\n json: {\n project_id: d.project_id,\n date: d.date,\n followers: d.new_followers,\n followers_today: d.followers_today,\n new_followers: d.new_followers\n }\n};"
},
"id": "map-daily-data-payload",
"name": "\ud83d\udce6 Map daily_data",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
2640,
-512
]
},
{
"parameters": {
"jsCode": "// \u041f\u043e\u0441\u0442\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u0437\u0430 \u0412\u0427\u0415\u0420\u0410 (\u0438\u043b\u0438 \u0437\u0430 \u043a\u0430\u0436\u0434\u044b\u0439 \u0434\u0435\u043d\u044c \u043f\u0440\u0438 \u0431\u044d\u043a\u0444\u0438\u043b\u043b\u0435).\nconst items = $input.all();\nconst out = items.map(item => {\n const periodData = item.json;\n const start = periodData.yesterday_only_start || periodData.yesterday_date;\n const end = periodData.yesterday_only_end || periodData.yesterday_date;\n const url = `https://pyscczcuersdjvpmkiec.supabase.co/rest/v1/instagram_posts_stats?project_id=eq.64c94e87-630c-470e-8ab1-8f7c8c835efa&posted_at=gte.${start}&posted_at=lte.${end}&order=posted_at.asc`;\n return { json: { url, ...periodData } };\n});\nconsole.log(`\ud83d\udd17 \u041f\u043e\u0441\u0442\u044b \u0437\u0430 ${items.length} \u0434\u043d.`);\nreturn out;"
},
"id": "e00d5035-181e-4087-980f-b35faf651480",
"name": "\ud83d\udd17 \u041f\u043e\u0441\u0442\u0440\u043e\u0438\u0442\u044c URL \u043f\u043e\u0441\u0442\u043e\u0432",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
1856,
-112
]
},
{
"parameters": {
"url": "={{ $json.url }}",
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "apikey",
"value": "<redacted-credential>"
},
{
"name": "Authorization",
"value": "<redacted-credential>"
}
]
},
"options": {
"timeout": 30000,
"alwaysOutputData": true
}
},
"id": "220dfa44-3f76-49f2-aca5-585e57934c1f",
"name": "\ud83d\udcca \u041f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043f\u043e\u0441\u0442\u044b",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
2080,
-112
]
},
{
"parameters": {
"jsCode": "// \u041e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c \u043f\u043e\u0441\u0442\u044b\nconst postsResponse = $input.first().json;\nlet posts = [];\n\nif (Array.isArray(postsResponse)) {\n posts = postsResponse;\n} else if (postsResponse.data && Array.isArray(postsResponse.data)) {\n posts = postsResponse.data;\n}\n\nconsole.log(`\ud83d\udcca \u041d\u0430\u0439\u0434\u0435\u043d\u043e \u043f\u043e\u0441\u0442\u043e\u0432: ${posts.length}`);\n\n// \u0421\u0447\u0438\u0442\u0430\u0435\u043c \u043c\u0435\u0442\u0440\u0438\u043a\u0438 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0439\nconst publications = posts.filter(p => {\n const mediaType = (p.media_type || '').toLowerCase();\n return !mediaType.includes('story') && mediaType !== 'stories';\n}).length;\n\nconst totalReach = posts.reduce((sum, p) => sum + (p.reach || 0), 0);\nconst totalComments = posts.reduce((sum, p) => sum + (p.comments || 0), 0);\nconst totalLikes = posts.reduce((sum, p) => sum + (p.likes || 0), 0);\nconst totalShares = posts.reduce((sum, p) => sum + (p.shares || 0), 0);\nconst totalDiagnostics = posts.reduce((sum, p) => sum + (p.leads_count || 0), 0);\nconst totalSales = posts.reduce((sum, p) => sum + (p.paid_leads || 0), 0);\nconst totalRevenue = posts.reduce((sum, p) => sum + (p.revenue || 0), 0);\n\nreturn {\n json: {\n posts_count: posts.length,\n publications: publications,\n reach: totalReach,\n comments: totalComments,\n likes: totalLikes,\n shares: totalShares,\n diagnostics: totalDiagnostics,\n sales: totalSales,\n revenue: Math.round(totalRevenue)\n }\n};"
},
"id": "00ffcd72-7504-4a2f-96db-430c86aeb258",
"name": "\ud83d\udd0d \u041e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043f\u043e\u0441\u0442\u044b",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
2304,
-112
]
},
{
"parameters": {
"jsCode": "// \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0432\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u043f\u043e\u0442\u043e\u043a\u0430\nlet postsData = null;\nlet followersData = null;\nlet periodData = null;\nlet newFollowersData = null;\n\nconst allInputs = $input.all();\n\nfor (const input of allInputs) {\n const data = input.json;\n if (data.period_start && data.period_end && data.period_start_timestamp) {\n periodData = data;\n } else if (data.followers_today !== undefined) {\n newFollowersData = data;\n } else if (data.posts_count !== undefined) {\n postsData = data;\n }\n}\n\nif (!periodData) {\n try { periodData = $('\ud83d\udcc5 \u0420\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u0442\u044c \u043f\u0435\u0440\u0438\u043e\u0434').first().json; } catch (e) {}\n}\nif (!newFollowersData) {\n try { newFollowersData = $('\ud83e\uddee \u0410\u0433\u0440\u0435\u0433\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u043e\u0432').first().json; } catch (e) {}\n}\nif (!postsData) {\n try { postsData = $('\ud83d\udd0d \u041e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043f\u043e\u0441\u0442\u044b').first().json; } catch (e) {}\n}\n\nconst currentFollowers = newFollowersData ? (newFollowersData.followers_today || 0) : 0;\nconst newFollowers = newFollowersData ? (newFollowersData.new_followers || 0) : 0;\nconst postsCount = postsData ? (postsData.posts_count || 0) : 0;\nconst publications = postsData ? (postsData.publications || 0) : 0;\nconst reach = postsData ? (postsData.reach || 0) : 0;\nconst comments = postsData ? (postsData.comments || 0) : 0;\nconst diagnostics = postsData ? (postsData.diagnostics || 0) : 0;\nconst sales = postsData ? (postsData.sales || 0) : 0;\nconst revenue = postsData ? (postsData.revenue || 0) : 0;\n\nconsole.log(`\\n=== \u0410\u0413\u0420\u0415\u0413\u0410\u0426\u0418\u042f \u0417\u0410 ${periodData ? periodData.yesterday_date : '\u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e'} ===`);\nconsole.log(`\ud83d\udcca \u041f\u043e\u0441\u0442\u043e\u0432: ${postsCount}`);\nconsole.log(`\ud83d\udcc8 \u041f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0439: ${publications}`);\nconsole.log(`\ud83d\udc65 \u041f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u043e\u0432: ${currentFollowers.toLocaleString('ru-RU')} (+${newFollowers.toLocaleString('ru-RU')} \u043d\u043e\u0432\u044b\u0445)`);\nconsole.log(`\ud83d\udcca \u041e\u0445\u0432\u0430\u0442: ${reach.toLocaleString('ru-RU')}`);\nconsole.log(`\ud83d\udcac \u041a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438: ${comments}`);\nconsole.log(`\ud83c\udfe5 \u0414\u0438\u0430\u0433\u043d\u043e\u0441\u0442\u0438\u043a\u0438: ${diagnostics}`);\nconsole.log(`\ud83d\udcb0 \u0412\u044b\u0440\u0443\u0447\u043a\u0430: ${revenue.toLocaleString('ru-RU')}\u20b8`);\n\nreturn {\n json: {\n project_id: '64c94e87-630c-470e-8ab1-8f7c8c835efa',\n period_start: periodData ? (periodData.yesterday_only_start || periodData.yesterday_date) : null,\n period_end: periodData ? (periodData.yesterday_only_end || periodData.yesterday_date) : null,\n publications: publications,\n reach: reach,\n comments: comments,\n followers: newFollowers, // \u041d\u043e\u0432\u044b\u0435 \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u0438 \u0437\u0430 \u043f\u0435\u0440\u0438\u043e\u0434\n diagnostics: diagnostics,\n sales: sales,\n revenue: revenue\n }\n};"
},
"id": "59cf4d10-4677-4ca0-a6b1-fc6fecfb1a2d",
"name": "\ud83e\uddee \u0410\u0433\u0440\u0435\u0433\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
2528,
-320
]
},
{
"parameters": {
"method": "POST",
"url": "https://pyscczcuersdjvpmkiec.supabase.co/rest/v1/content_production_stats?on_conflict=project_id,period_start,period_end",
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "apikey",
"value": "<redacted-credential>"
},
{
"name": "Authorization",
"value": "<redacted-credential>"
},
{
"name": "Content-Type",
"value": "application/json"
},
{
"name": "Prefer",
"value": "resolution=merge-duplicates"
}
]
},
"sendBody": true,
"specifyBody": "json",
"jsonBody": "={{ JSON.stringify($json) }}",
"options": {
"timeout": 30000
}
},
"id": "1d200caa-50df-424a-bc4c-fd1a418f827b",
"name": "\ud83d\udcbe \u0421\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0443",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
2752,
-320
]
},
{
"parameters": {
"method": "POST",
"url": "https://pyscczcuersdjvpmkiec.supabase.co/rest/v1/daily_data?on_conflict=project_id,date",
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "apikey",
"value": "<redacted-credential>"
},
{
"name": "Authorization",
"value": "<redacted-credential>"
},
{
"name": "Content-Type",
"value": "application/json"
},
{
"name": "Prefer",
"value": "resolution=merge-duplicates"
}
]
},
"sendBody": true,
"specifyBody": "json",
"jsonBody": "={{ JSON.stringify([$json]) }}",
"options": {
"timeout": 30000
}
},
"id": "984a2102-a7ad-4b90-b26b-d59561b83261",
"name": "\ud83d\udcbe \u0417\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u043e\u0432 \u0432 daily_data",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
2752,
-512
]
},
{
"parameters": {
"method": "POST",
"url": "https://pyscczcuersdjvpmkiec.supabase.co/rest/v1/automation_flows?on_conflict=project_id,name",
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "apikey",
"value": "<redacted-credential>"
},
{
"name": "Authorization",
"value": "<redacted-credential>"
},
{
"name": "Content-Type",
"value": "application/json"
},
{
"name": "Prefer",
"value": "resolution=merge-duplicates"
}
]
},
"sendBody": true,
"specifyBody": "json",
"jsonBody": "={{ JSON.stringify([{\n \"project_id\": \"64c94e87-630c-470e-8ab1-8f7c8c835efa\",\n \"name\": \"Instagram Daily Automation\",\n \"n8n_id\": $workflow.id,\n \"flow_name\": $workflow.name,\n \"status\": \"active\",\n \"last_seen\": $now\n}]) }}",
"options": {
"timeout": 30000
}
},
"id": "heartbeat-success",
"name": "\ud83d\udcbe Instagram Daily Automation - OK",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
3200,
-320
]
},
{
"parameters": {
"jsCode": "// \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0432\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u043f\u043e\u0442\u043e\u043a\u0430 (Save, Write, Map, Aggregate data)\nlet statsSaveResult = null;\nlet followersSaveResult = null;\nlet data = null;\nlet followersData = null;\n\nconst allInputs = $input.all();\n\nfor (const input of allInputs) {\n const inputData = input.json;\n if (inputData.statusCode && inputData.headers) {\n if (inputData.request?.url?.includes('content_production_stats')) {\n statsSaveResult = inputData;\n } else if (inputData.request?.url?.includes('daily_data')) {\n followersSaveResult = inputData;\n }\n } else if (inputData.project_id && inputData.period_start && !inputData.date) {\n data = inputData;\n } else if (inputData.new_followers !== undefined || (inputData.project_id && inputData.date && (inputData.followers !== undefined || inputData.followers_today !== undefined))) {\n followersData = inputData;\n }\n}\n\nconst statsSuccess = statsSaveResult ? (statsSaveResult.statusCode >= 200 && statsSaveResult.statusCode < 300) : false;\nconst followersSuccess = followersSaveResult ? (followersSaveResult.statusCode >= 200 && followersSaveResult.statusCode < 300) : false;\n\nconsole.log(`\\n=== \u0420\u0415\u0417\u0423\u041b\u042c\u0422\u0410\u0422 \u0421\u041e\u0425\u0420\u0410\u041d\u0415\u041d\u0418\u042f ===`);\nconsole.log(`\ud83d\udcca \u0421\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0430: ${statsSuccess ? '\u2705 \u0423\u0421\u041f\u0415\u0425' : '\u274c \u041e\u0428\u0418\u0411\u041a\u0410'}`);\nconsole.log(`\ud83d\udc65 \u041f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u0438: ${followersSuccess ? '\u2705 \u0423\u0421\u041f\u0415\u0425' : '\u274c \u041e\u0428\u0418\u0411\u041a\u0410'}`);\nconsole.log(`\ud83d\udcc5 \u0414\u0430\u0442\u0430: ${followersData ? followersData.date : '\u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e'}`);\nconsole.log(`\ud83d\udc65 \u041d\u043e\u0432\u044b\u0445 \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u043e\u0432: ${followersData ? (followersData.new_followers ?? followersData.followers ?? 0).toLocaleString('ru-RU') : 0}`);\nconsole.log(`\ud83d\udcc8 \u041c\u0435\u0442\u0440\u0438\u043a\u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u044b \u0432 content_production_stats \u0438 daily_data`);\n\nif (statsSuccess && followersSuccess) {\n console.log(`\\n\ud83c\udf89 \u0410\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0430\u0433\u0440\u0435\u0433\u0430\u0446\u0438\u044f Instagram \u0434\u0430\u043d\u043d\u044b\u0445 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0430!`);\n} else {\n console.log(`\\n\u274c \u041e\u0448\u0438\u0431\u043a\u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f:`);\n if (!statsSuccess && statsSaveResult) console.log(` \u0421\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0430: ${JSON.stringify(statsSaveResult, null, 2)}`);\n if (!followersSuccess && followersSaveResult) console.log(` \u041f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u0438: ${JSON.stringify(followersSaveResult, null, 2)}`);\n}\n\nreturn { json: { success: statsSuccess && followersSuccess, data: data, followers: followersData } };"
},
"id": "e5b3f30b-d0f3-46a7-a61c-e5fefb382317",
"name": "\u2705 \u0424\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u043b\u043e\u0433",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
2976,
-320
]
},
{
"parameters": {},
"id": "error-trigger",
"name": "Error Trigger",
"type": "n8n-nodes-base.errorTrigger",
"typeVersion": 1,
"position": [
2976,
-512
]
},
{
"parameters": {
"method": "POST",
"url": "https://pyscczcuersdjvpmkiec.supabase.co/rest/v1/automation_flows?on_conflict=project_id,name",
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "apikey",
"value": "<redacted-credential>"
},
{
"name": "Authorization",
"value": "<redacted-credential>"
},
{
"name": "Content-Type",
"value": "application/json"
},
{
"name": "Prefer",
"value": "resolution=merge-duplicates"
}
]
},
"sendBody": true,
"specifyBody": "json",
"jsonBody": "={{ JSON.stringify([{\n \"project_id\": \"64c94e87-630c-470e-8ab1-8f7c8c835efa\",\n \"name\": \"Instagram Daily Automation\",\n \"n8n_id\": $workflow.id,\n \"flow_name\": $workflow.name,\n \"status\": \"error\",\n \"last_seen\": $now,\n \"logs\": $error.message\n}]) }}",
"options": {
"timeout": 30000
}
},
"id": "heartbeat-error",
"name": "\ud83d\udcbe Instagram Daily Automation - ERROR",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
3200,
-512
]
}
],
"connections": {
"\u23f0 \u0415\u0436\u0435\u0434\u043d\u0435\u0432\u043d\u043e 09:00": {
"main": [
[
{
"node": "\ud83d\udcc5 \u0420\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u0442\u044c \u043f\u0435\u0440\u0438\u043e\u0434",
"type": "main",
"index": 0
}
]
]
},
"\ud83d\udcc5 \u0420\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u0442\u044c \u043f\u0435\u0440\u0438\u043e\u0434": {
"main": [
[
{
"node": "\ud83d\udc65 \u041f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u043e\u0432 (\u0441\u0435\u0433\u043e\u0434\u043d\u044f)",
"type": "main",
"index": 0
},
{
"node": "\ud83d\udd17 \u041f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u043e\u0432 (\u0432\u0447\u0435\u0440\u0430)",
"type": "main",
"index": 0
},
{
"node": "\ud83d\udd17 \u041f\u043e\u0441\u0442\u0440\u043e\u0438\u0442\u044c URL \u043f\u043e\u0441\u0442\u043e\u0432",
"type": "main",
"index": 0
},
{
"node": "\ud83e\uddee \u0410\u0433\u0440\u0435\u0433\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u043e\u0432",
"type": "main",
"index": 2
}
]
]
},
"\ud83d\udc65 \u041f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u043e\u0432 (\u0441\u0435\u0433\u043e\u0434\u043d\u044f)": {
"main": [
[
{
"node": "\ud83e\uddee \u0410\u0433\u0440\u0435\u0433\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u043e\u0432",
"type": "main",
"index": 0
}
]
]
},
"\ud83d\udd17 \u041f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u043e\u0432 (\u0432\u0447\u0435\u0440\u0430)": {
"main": [
[
{
"node": "\ud83d\udcca \u0417\u0430\u043f\u0440\u043e\u0441 \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u043e\u0432 (\u0432\u0447\u0435\u0440\u0430)",
"type": "main",
"index": 0
}
]
]
},
"\ud83d\udcca \u0417\u0430\u043f\u0440\u043e\u0441 \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u043e\u0432 (\u0432\u0447\u0435\u0440\u0430)": {
"main": [
[
{
"node": "\ud83e\uddee \u0410\u0433\u0440\u0435\u0433\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u043e\u0432",
"type": "main",
"index": 1
}
]
]
},
"\ud83e\uddee \u0410\u0433\u0440\u0435\u0433\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u043e\u0432": {
"main": [
[
{
"node": "\ud83d\udce6 Map daily_data",
"type": "main",
"index": 0
},
{
"node": "\ud83e\uddee \u0410\u0433\u0440\u0435\u0433\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435",
"type": "main",
"index": 1
}
]
]
},
"\ud83d\udce6 Map daily_data": {
"main": [
[
{
"node": "\ud83d\udcbe \u0417\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u043e\u0432 \u0432 daily_data",
"type": "main",
"index": 0
},
{
"node": "\u2705 \u0424\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u043b\u043e\u0433",
"type": "main",
"index": 0
}
]
]
},
"\ud83d\udd17 \u041f\u043e\u0441\u0442\u0440\u043e\u0438\u0442\u044c URL \u043f\u043e\u0441\u0442\u043e\u0432": {
"main": [
[
{
"node": "\ud83d\udcca \u041f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043f\u043e\u0441\u0442\u044b",
"type": "main",
"index": 0
}
]
]
},
"\ud83d\udcca \u041f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043f\u043e\u0441\u0442\u044b": {
"main": [
[
{
"node": "\ud83d\udd0d \u041e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043f\u043e\u0441\u0442\u044b",
"type": "main",
"index": 0
}
]
]
},
"\ud83d\udd0d \u041e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043f\u043e\u0441\u0442\u044b": {
"main": [
[
{
"node": "\ud83e\uddee \u0410\u0433\u0440\u0435\u0433\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435",
"type": "main",
"index": 0
}
]
]
},
"\ud83e\uddee \u0410\u0433\u0440\u0435\u0433\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435": {
"main": [
[
{
"node": "\ud83d\udcbe \u0421\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0443",
"type": "main",
"index": 0
},
{
"node": "\u2705 \u0424\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u043b\u043e\u0433",
"type": "main",
"index": 0
}
]
]
},
"\ud83d\udcbe \u0421\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0443": {
"main": [
[
{
"node": "\u2705 \u0424\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u043b\u043e\u0433",
"type": "main",
"index": 0
}
]
]
},
"\ud83d\udcbe \u0417\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u043e\u0432 \u0432 daily_data": {
"main": [
[
{
"node": "\u2705 \u0424\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u043b\u043e\u0433",
"type": "main",
"index": 0
}
]
]
},
"\u2705 \u0424\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u043b\u043e\u0433": {
"main": [
[
{
"node": "\ud83d\udcbe Instagram Daily Automation - OK",
"type": "main",
"index": 0
}
]
]
},
"Error Trigger": {
"main": [
[
{
"node": "\ud83d\udcbe Instagram Daily Automation - ERROR",
"type": "main",
"index": 0
}
]
]
}
}
}
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
Instagram-Daily-Automation. Uses httpRequest, errorTrigger. Scheduled trigger; 17 nodes.
Source: https://github.com/markvision-ai/markvision/blob/9b0d933e890beb6469b781fd459054faf804302b/n8n-workflows/INSTAGRAM-DAILY-AUTOMATION.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 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
Gemini - Video Analysis (NEW). Uses httpRequest, stickyNote, sort, limit. Scheduled trigger; 29 nodes.
📺 Full walkthrough video: https://youtu.be/Me4d4BILvHk