initial commit
This commit is contained in:
commit
2a5c82c5bf
490
Insta_Post_Cache.json
Normal file
490
Insta_Post_Cache.json
Normal file
@ -0,0 +1,490 @@
|
||||
{
|
||||
"name": "Insta Post Cache",
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {},
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"typeVersion": 1,
|
||||
"position": [
|
||||
-368,
|
||||
-16
|
||||
],
|
||||
"id": "028b7b07-d02a-4e96-8ee3-f1197b999c46",
|
||||
"name": "When clicking ‘Execute workflow’"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"url": "https://graph.facebook.com/v24.0/17841470338696118/media?fields=id,caption,timestamp,comments_count&limit=5",
|
||||
"authentication": "genericCredentialType",
|
||||
"genericAuthType": "httpBearerAuth",
|
||||
"options": {
|
||||
"pagination": {
|
||||
"pagination": {
|
||||
"paginationMode": "responseContainsNextURL",
|
||||
"nextURL": "={{ $response.body.paging?.next }}",
|
||||
"limitPagesFetched": true,
|
||||
"maxRequests": 6
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"typeVersion": 4.3,
|
||||
"position": [
|
||||
-160,
|
||||
-16
|
||||
],
|
||||
"id": "dbff29da-5eae-4993-a3d9-8d41755c8a9d",
|
||||
"name": "Call FB to get the last posts",
|
||||
"credentials": {
|
||||
"httpHeaderAuth": {
|
||||
"id": "bU1D0djQYelYC4km",
|
||||
"name": "gitea-auth"
|
||||
},
|
||||
"httpQueryAuth": {
|
||||
"id": "9poWzM5erRyAfM1e",
|
||||
"name": "Query Auth account"
|
||||
},
|
||||
"httpBearerAuth": {
|
||||
"id": "iDvltYWG0ECfJA1r",
|
||||
"name": "Bearer Auth account"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"jsCode": "// Process each Instagram post\nconst outputItems = [];\n\nfor (const item of $input.all()) {\n const caption = item.json.caption || '';\n const postId = item.json.id;\n \n // Extract keyword - handle smart quotes too\n const keywordMatch = caption.match(/comment\\s+[\"'\"\"']?(\\w+)[\"'\"\"']?/i);\n const keyword = keywordMatch ? keywordMatch[1].toLowerCase() : null;\n \n // Extract WordPress post ID\n const wpPostIdMatch = caption.match(/ID:\\s*(\\d+)/i);\n const wpPostId = wpPostIdMatch ? parseInt(wpPostIdMatch[1]) : null;\n \n outputItems.push({\n json: {\n instagram_post_id: postId,\n instagram_caption: caption,\n keyword: keyword,\n wp_post_id: wpPostId,\n ...item.json\n }\n });\n}\n\nreturn outputItems;"
|
||||
},
|
||||
"type": "n8n-nodes-base.code",
|
||||
"typeVersion": 2,
|
||||
"position": [
|
||||
208,
|
||||
-16
|
||||
],
|
||||
"id": "e73f63f0-316a-4a26-93b7-6e67cb355c00",
|
||||
"name": "Get the Code and keyword"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"jsCode": "// This processes each post as a separate item\nconst hoursAgo = 10;\nconst cutoffTime = new Date(Date.now() - (hoursAgo * 60 * 60 * 1000));\n// You have 5 items, each with a data array\nconst allPages = $input.all();\n\nconsole.log(`Received ${allPages.length} pages`);\n\n// Flatten all data arrays into one big array\nconst allPosts = allPages.flatMap(page => {\n const posts = page.json.data || [];\n console.log(`Page has ${posts.length} posts`);\n return posts;\n});\n\nconsole.log(`Total posts across all pages: ${allPosts.length}`);\n\n// Return as separate items\nreturn allPosts.map(post => ({\n json: {\n postID: post.id,\n caption: post.caption || '',\n timestamp: post.timestamp\n }\n}));"
|
||||
},
|
||||
"type": "n8n-nodes-base.code",
|
||||
"typeVersion": 2,
|
||||
"position": [
|
||||
32,
|
||||
-16
|
||||
],
|
||||
"id": "6222089d-837a-4e01-b9e9-3a27e9a5b0ff",
|
||||
"name": "JS to get the post info"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"url": "=https://graph.facebook.com/v24.0/{{ $json.postId }}/comments?fields=id,text,username,timestamp&since={{ $now.minus({minutes: 5}).toISO() }}",
|
||||
"authentication": "genericCredentialType",
|
||||
"genericAuthType": "httpHeaderAuth",
|
||||
"options": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"typeVersion": 4.3,
|
||||
"position": [
|
||||
240,
|
||||
352
|
||||
],
|
||||
"id": "3b8c5f20-e068-4fa6-a446-1bbd800dd2b3",
|
||||
"name": "Now get the comments",
|
||||
"credentials": {
|
||||
"httpHeaderAuth": {
|
||||
"id": "bU1D0djQYelYC4km",
|
||||
"name": "gitea-auth"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"options": {
|
||||
"pagination": {
|
||||
"pagination": {
|
||||
"paginationMode": "responseContainsNextURL",
|
||||
"nextURL": "={{ $json.paging.next }}"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"typeVersion": 4.3,
|
||||
"position": [
|
||||
-48,
|
||||
320
|
||||
],
|
||||
"id": "8ee1772f-a9e8-4d4b-9ac3-ac3f53457087",
|
||||
"name": "HTTP Request"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"operation": "upsert",
|
||||
"dataTableId": {
|
||||
"__rl": true,
|
||||
"value": "czv8kqzBgSN7HiMt",
|
||||
"mode": "list",
|
||||
"cachedResultName": "Insta-Post-Data",
|
||||
"cachedResultUrl": "/projects/xJUdeIR7ChAsPEQN/datatables/czv8kqzBgSN7HiMt"
|
||||
},
|
||||
"filters": {
|
||||
"conditions": [
|
||||
{
|
||||
"keyName": "Postid",
|
||||
"keyValue": "={{ $json.postID }}"
|
||||
}
|
||||
]
|
||||
},
|
||||
"columns": {
|
||||
"mappingMode": "defineBelow",
|
||||
"value": {
|
||||
"Postid": "={{ $json.postID }}",
|
||||
"timestamp": "={{ $json.timestamp }}",
|
||||
"caption": "={{ $json.caption }}",
|
||||
"pbs_keyword": "={{ $json.keyword }}",
|
||||
"pbs_postid": "={{ $json.wp_post_id }}"
|
||||
},
|
||||
"matchingColumns": [],
|
||||
"schema": [
|
||||
{
|
||||
"id": "Postid",
|
||||
"displayName": "Postid",
|
||||
"required": false,
|
||||
"defaultMatch": false,
|
||||
"display": true,
|
||||
"type": "number",
|
||||
"readOnly": false,
|
||||
"removed": false
|
||||
},
|
||||
{
|
||||
"id": "caption",
|
||||
"displayName": "caption",
|
||||
"required": false,
|
||||
"defaultMatch": false,
|
||||
"display": true,
|
||||
"type": "string",
|
||||
"readOnly": false,
|
||||
"removed": false
|
||||
},
|
||||
{
|
||||
"id": "timestamp",
|
||||
"displayName": "timestamp",
|
||||
"required": false,
|
||||
"defaultMatch": false,
|
||||
"display": true,
|
||||
"type": "dateTime",
|
||||
"readOnly": false,
|
||||
"removed": false
|
||||
},
|
||||
{
|
||||
"id": "pbs_keyword",
|
||||
"displayName": "pbs_keyword",
|
||||
"required": false,
|
||||
"defaultMatch": false,
|
||||
"display": true,
|
||||
"type": "string",
|
||||
"readOnly": false,
|
||||
"removed": false
|
||||
},
|
||||
{
|
||||
"id": "pbs_postid",
|
||||
"displayName": "pbs_postid",
|
||||
"required": false,
|
||||
"defaultMatch": false,
|
||||
"display": true,
|
||||
"type": "number",
|
||||
"readOnly": false,
|
||||
"removed": false
|
||||
}
|
||||
],
|
||||
"attemptToConvertTypes": false,
|
||||
"convertFieldsToString": false
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.dataTable",
|
||||
"typeVersion": 1.1,
|
||||
"position": [
|
||||
672,
|
||||
-224
|
||||
],
|
||||
"id": "8b80a33e-8bb0-414d-b8e8-74a7aa814ed3",
|
||||
"name": "Upsert row(s)1"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"operation": "rowNotExists",
|
||||
"dataTableId": {
|
||||
"__rl": true,
|
||||
"value": "bq738miYhEK37VaJ",
|
||||
"mode": "list",
|
||||
"cachedResultName": "Insta-Post-Data",
|
||||
"cachedResultUrl": "/projects/xJUdeIR7ChAsPEQN/datatables/bq738miYhEK37VaJ"
|
||||
},
|
||||
"matchType": "allConditions",
|
||||
"filters": {
|
||||
"conditions": [
|
||||
{
|
||||
"keyName": "Postid",
|
||||
"keyValue": "={{ $json.postID }}"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"type": "n8n-nodes-base.dataTable",
|
||||
"typeVersion": 1.1,
|
||||
"position": [
|
||||
400,
|
||||
-16
|
||||
],
|
||||
"id": "52f357f5-9a8d-4d37-b768-6a926cabc750",
|
||||
"name": "If row does not exist"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"dataTableId": {
|
||||
"__rl": true,
|
||||
"value": "bq738miYhEK37VaJ",
|
||||
"mode": "list",
|
||||
"cachedResultName": "Insta-Post-Data",
|
||||
"cachedResultUrl": "/projects/xJUdeIR7ChAsPEQN/datatables/bq738miYhEK37VaJ"
|
||||
},
|
||||
"columns": {
|
||||
"mappingMode": "defineBelow",
|
||||
"value": {
|
||||
"pbs_postid": "={{ $json.wp_post_id }}",
|
||||
"pbs_keyword": "={{ $json.keyword }}",
|
||||
"timestamp": "={{ $json.timestamp }}",
|
||||
"caption": "={{ $json.instagram_caption }}",
|
||||
"Postid": "={{ $json.postID }}"
|
||||
},
|
||||
"matchingColumns": [],
|
||||
"schema": [
|
||||
{
|
||||
"id": "id1",
|
||||
"displayName": "id1",
|
||||
"required": false,
|
||||
"defaultMatch": false,
|
||||
"display": true,
|
||||
"type": "number",
|
||||
"readOnly": false,
|
||||
"removed": true
|
||||
},
|
||||
{
|
||||
"id": "Postid",
|
||||
"displayName": "Postid",
|
||||
"required": false,
|
||||
"defaultMatch": false,
|
||||
"display": true,
|
||||
"type": "string",
|
||||
"readOnly": false,
|
||||
"removed": false
|
||||
},
|
||||
{
|
||||
"id": "caption",
|
||||
"displayName": "caption",
|
||||
"required": false,
|
||||
"defaultMatch": false,
|
||||
"display": true,
|
||||
"type": "string",
|
||||
"readOnly": false,
|
||||
"removed": false
|
||||
},
|
||||
{
|
||||
"id": "timestamp",
|
||||
"displayName": "timestamp",
|
||||
"required": false,
|
||||
"defaultMatch": false,
|
||||
"display": true,
|
||||
"type": "dateTime",
|
||||
"readOnly": false,
|
||||
"removed": false
|
||||
},
|
||||
{
|
||||
"id": "pbs_keyword",
|
||||
"displayName": "pbs_keyword",
|
||||
"required": false,
|
||||
"defaultMatch": false,
|
||||
"display": true,
|
||||
"type": "string",
|
||||
"readOnly": false,
|
||||
"removed": false
|
||||
},
|
||||
{
|
||||
"id": "pbs_postid",
|
||||
"displayName": "pbs_postid",
|
||||
"required": false,
|
||||
"defaultMatch": false,
|
||||
"display": true,
|
||||
"type": "number",
|
||||
"readOnly": false,
|
||||
"removed": false
|
||||
},
|
||||
{
|
||||
"id": "createdAt1",
|
||||
"displayName": "createdAt1",
|
||||
"required": false,
|
||||
"defaultMatch": false,
|
||||
"display": true,
|
||||
"type": "dateTime",
|
||||
"readOnly": false,
|
||||
"removed": true
|
||||
},
|
||||
{
|
||||
"id": "updatedAt1",
|
||||
"displayName": "updatedAt1",
|
||||
"required": false,
|
||||
"defaultMatch": false,
|
||||
"display": true,
|
||||
"type": "dateTime",
|
||||
"readOnly": false,
|
||||
"removed": true
|
||||
}
|
||||
],
|
||||
"attemptToConvertTypes": false,
|
||||
"convertFieldsToString": false
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.dataTable",
|
||||
"typeVersion": 1.1,
|
||||
"position": [
|
||||
576,
|
||||
-16
|
||||
],
|
||||
"id": "78be39f2-27e4-415f-b52b-448b5ec66289",
|
||||
"name": "Insert row"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"rule": {
|
||||
"interval": [
|
||||
{
|
||||
"triggerAtHour": 18,
|
||||
"triggerAtMinute": 8
|
||||
},
|
||||
{
|
||||
"triggerAtMinute": 8
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"type": "n8n-nodes-base.scheduleTrigger",
|
||||
"typeVersion": 1.3,
|
||||
"position": [
|
||||
-384,
|
||||
-160
|
||||
],
|
||||
"id": "6b3aecf6-bd2c-49df-8e8e-63b1d6ae6728",
|
||||
"name": "Schedule Trigger"
|
||||
}
|
||||
],
|
||||
"pinData": {
|
||||
"Schedule Trigger": [
|
||||
{
|
||||
"json": {
|
||||
"timestamp": "2026-06-29T00:08:06.015-04:00",
|
||||
"Readable date": "June 29th 2026, 12:08:06 am",
|
||||
"Readable time": "12:08:06 am",
|
||||
"Day of week": "Monday",
|
||||
"Year": "2026",
|
||||
"Month": "June",
|
||||
"Day of month": "29",
|
||||
"Hour": "00",
|
||||
"Minute": "08",
|
||||
"Second": "06",
|
||||
"Timezone": "America/New_York (UTC-04:00)"
|
||||
},
|
||||
"pairedItem": {
|
||||
"item": 0
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"connections": {
|
||||
"When clicking ‘Execute workflow’": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Call FB to get the last posts",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Call FB to get the last posts": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "JS to get the post info",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"JS to get the post info": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Get the Code and keyword",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Get the Code and keyword": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "If row does not exist",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Now get the comments": {
|
||||
"main": [
|
||||
[]
|
||||
]
|
||||
},
|
||||
"If row does not exist": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Insert row",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Schedule Trigger": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Call FB to get the last posts",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"active": true,
|
||||
"settings": {
|
||||
"executionOrder": "v1",
|
||||
"availableInMCP": false
|
||||
},
|
||||
"versionId": "cb67f90e-7f5a-4361-83f4-8efbb12f04e2",
|
||||
"meta": {
|
||||
"instanceId": "eeb18e777509f7207ee9abd45845e7fbf014989719160f3ed6ae633d872bf6c4"
|
||||
},
|
||||
"id": "CNts_6nNU2F04pX6MFyw0",
|
||||
"tags": []
|
||||
}
|
||||
72
PBS-Cache-Purge.json
Normal file
72
PBS-Cache-Purge.json
Normal file
@ -0,0 +1,72 @@
|
||||
{
|
||||
"name": "PBS-Cache-Purge",
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {
|
||||
"httpMethod": "POST",
|
||||
"path": "f791b88f-37d8-4a67-af54-c3e6aa6a930d",
|
||||
"options": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.webhook",
|
||||
"typeVersion": 2.1,
|
||||
"position": [
|
||||
0,
|
||||
0
|
||||
],
|
||||
"id": "c8dc32b7-16e4-42ca-942c-72df73edc4cd",
|
||||
"name": "PBS-Save-Hook",
|
||||
"webhookId": "f791b88f-37d8-4a67-af54-c3e6aa6a930d"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"method": "POST",
|
||||
"url": "https://api.cloudflare.com/client/v4/zones/5b64a56e652d7ffeb7b790ce2d915192/purge_cache",
|
||||
"authentication": "genericCredentialType",
|
||||
"genericAuthType": "httpBearerAuth",
|
||||
"sendBody": true,
|
||||
"specifyBody": "json",
|
||||
"jsonBody": "={\n \"files\": [\"{{ $json.body.url }}\"]\n}",
|
||||
"options": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"typeVersion": 4.3,
|
||||
"position": [
|
||||
208,
|
||||
0
|
||||
],
|
||||
"id": "64490c69-d271-4994-a296-f7d46936dfc7",
|
||||
"name": "CF-Post-Purge",
|
||||
"credentials": {
|
||||
"httpBearerAuth": {
|
||||
"id": "Hmo79vo4h9ZGPh3i",
|
||||
"name": "CF Cache Purge"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"pinData": {},
|
||||
"connections": {
|
||||
"PBS-Save-Hook": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "CF-Post-Purge",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"active": true,
|
||||
"settings": {
|
||||
"executionOrder": "v1",
|
||||
"availableInMCP": false
|
||||
},
|
||||
"versionId": "3c0023b9-9931-49b4-99b9-d4ffdb873406",
|
||||
"meta": {
|
||||
"instanceId": "eeb18e777509f7207ee9abd45845e7fbf014989719160f3ed6ae633d872bf6c4"
|
||||
},
|
||||
"id": "e5livH0ZC27mW4q3pvpUr",
|
||||
"tags": []
|
||||
}
|
||||
293
PBS_Cloudflare_Cache_Warmer_5_days.json
Normal file
293
PBS_Cloudflare_Cache_Warmer_5_days.json
Normal file
@ -0,0 +1,293 @@
|
||||
{
|
||||
"name": "PBS: Cloudflare Cache Warmer 5 days",
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {
|
||||
"rule": {
|
||||
"interval": [
|
||||
{
|
||||
"daysInterval": 5
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"id": "17b4e5fd-e821-477e-9df0-aade6ccefbbf",
|
||||
"name": "Daily 4 AM ET",
|
||||
"type": "n8n-nodes-base.scheduleTrigger",
|
||||
"typeVersion": 1.2,
|
||||
"position": [
|
||||
-720,
|
||||
-80
|
||||
]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"operation": "executeQuery",
|
||||
"query": "SELECT recipe_url AS url, recipe_title AS title\nFROM pbs_recipes\nWHERE recipe_url IS NOT NULL\n AND recipe_url != ''\nORDER BY post_id ASC",
|
||||
"options": {}
|
||||
},
|
||||
"id": "22f29499-7bcd-4699-8c3a-799c58d0cfec",
|
||||
"name": "Get Recipe URLs",
|
||||
"type": "n8n-nodes-base.mySql",
|
||||
"typeVersion": 2.4,
|
||||
"position": [
|
||||
-496,
|
||||
-80
|
||||
],
|
||||
"credentials": {
|
||||
"mySql": {
|
||||
"id": "4ETlVumrAq95ispJ",
|
||||
"name": "MySQL account"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"jsCode": "// Initialize tracking counters before the loop begins.\nconst staticData = $getWorkflowStaticData('global');\nstaticData.warmed = 0;\nstaticData.errors = 0;\nstaticData.errorUrls = [];\nstaticData.totalUrls = $input.all().length;\n\n// Pass all items through unchanged\nreturn $input.all();\n"
|
||||
},
|
||||
"id": "efebcbc9-c6a8-44c6-a92c-591e478bf0b0",
|
||||
"name": "Init Counters",
|
||||
"type": "n8n-nodes-base.code",
|
||||
"typeVersion": 2,
|
||||
"position": [
|
||||
-272,
|
||||
-80
|
||||
]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"options": {}
|
||||
},
|
||||
"id": "beae05d0-c631-403c-b414-a224e3e1b531",
|
||||
"name": "Loop Recipe URLs",
|
||||
"type": "n8n-nodes-base.splitInBatches",
|
||||
"typeVersion": 3,
|
||||
"position": [
|
||||
-32,
|
||||
-80
|
||||
]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"url": "={{ $json.url }}",
|
||||
"options": {
|
||||
"redirect": {
|
||||
"redirect": {}
|
||||
},
|
||||
"response": {
|
||||
"response": {
|
||||
"responseFormat": "text"
|
||||
}
|
||||
},
|
||||
"timeout": 30000
|
||||
}
|
||||
},
|
||||
"id": "f7cd0cc1-b755-49ff-b08c-e040da9f285d",
|
||||
"name": "Warm Cache (GET)",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"typeVersion": 4.2,
|
||||
"position": [
|
||||
208,
|
||||
-80
|
||||
],
|
||||
"onError": "continueRegularOutput"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"jsCode": "// Track success/failure for each URL warming attempt.\nconst staticData = $getWorkflowStaticData('global');\n\nconst item = $input.first().json;\nconst statusCode = item.statusCode || item.$response?.statusCode || 200;\nconst url = $('Loop Recipe URLs').first().json.url || 'unknown';\n\nif (statusCode >= 200 && statusCode < 400) {\n staticData.warmed++;\n} else {\n staticData.errors++;\n if (staticData.errorUrls.length < 10) {\n staticData.errorUrls.push(url + ' (' + statusCode + ')');\n }\n}\n\nreturn [{ json: { tracked: true } }];\n"
|
||||
},
|
||||
"id": "73caf61c-cd15-4dd1-977e-9bf053e1f062",
|
||||
"name": "Track Results",
|
||||
"type": "n8n-nodes-base.code",
|
||||
"typeVersion": 2,
|
||||
"position": [
|
||||
384,
|
||||
-80
|
||||
]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"jsCode": "// Build final summary message after all recipe URLs have been warmed.\nconst staticData = $getWorkflowStaticData('global');\nconst warmed = staticData.warmed || 0;\nconst errors = staticData.errors || 0;\nconst errorUrls = staticData.errorUrls || [];\nconst total = staticData.totalUrls || (warmed + errors);\n\nlet message = '🔥 *PBS Cache Warmer — Daily Run Complete*\\n';\nmessage += '\\n*Recipe URLs in database:* ' + total;\nmessage += '\\n*Warmed successfully:* ' + warmed;\nmessage += '\\n*Errors:* ' + errors;\n\nif (errors > 0 && errorUrls.length > 0) {\n message += '\\n\\n*Failed URLs (first 10):*';\n errorUrls.forEach(u => {\n message += '\\n• ' + u;\n });\n}\n\nif (errors === 0) {\n message += '\\n\\n✅ All recipe pages cached successfully.';\n}\n\n// Clean up static data for next run\nstaticData.warmed = 0;\nstaticData.errors = 0;\nstaticData.errorUrls = [];\nstaticData.totalUrls = 0;\nconst title = \"PBS-Cache Refresh\"\nconst timestamp = $now.toFormat('MMM dd, HH:mm:ss')\n\nreturn [{ json: { title, message, timestamp } }];\n"
|
||||
},
|
||||
"id": "866a4920-9d22-47e6-b48c-e121be8ec3e9",
|
||||
"name": "Build Summary",
|
||||
"type": "n8n-nodes-base.code",
|
||||
"typeVersion": 2,
|
||||
"position": [
|
||||
176,
|
||||
-272
|
||||
]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"workflowId": {
|
||||
"__rl": true,
|
||||
"value": "-DlPrT1UsgmacYJyoUJXU",
|
||||
"mode": "list",
|
||||
"cachedResultUrl": "/workflow/-DlPrT1UsgmacYJyoUJXU",
|
||||
"cachedResultName": "PBS: Google Chat Notify (Sub-Workflow)"
|
||||
},
|
||||
"workflowInputs": {
|
||||
"mappingMode": "defineBelow",
|
||||
"value": {},
|
||||
"matchingColumns": [],
|
||||
"schema": [],
|
||||
"attemptToConvertTypes": false,
|
||||
"convertFieldsToString": true
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.executeWorkflow",
|
||||
"typeVersion": 1.3,
|
||||
"position": [
|
||||
384,
|
||||
-288
|
||||
],
|
||||
"id": "67d65c33-84ed-40bb-bfb3-7a54e1f1664c",
|
||||
"name": "Call 'PBS: Google Chat Notify (Sub-Workflow)'"
|
||||
},
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "0810a6a3-9440-4bae-a399-5c73f1f3f460",
|
||||
"name": "Wait 5s",
|
||||
"type": "n8n-nodes-base.wait",
|
||||
"typeVersion": 1.1,
|
||||
"position": [
|
||||
608,
|
||||
-80
|
||||
],
|
||||
"webhookId": "d3c0e894-852f-42ff-a7ef-d5b692b74958"
|
||||
}
|
||||
],
|
||||
"pinData": {
|
||||
"Daily 4 AM ET": [
|
||||
{
|
||||
"json": {
|
||||
"timestamp": "2026-04-20T22:20:39.641-04:00",
|
||||
"Readable date": "April 20th 2026, 10:20:39 pm",
|
||||
"Readable time": "10:20:39 pm",
|
||||
"Day of week": "Monday",
|
||||
"Year": "2026",
|
||||
"Month": "April",
|
||||
"Day of month": "20",
|
||||
"Hour": "22",
|
||||
"Minute": "20",
|
||||
"Second": "39",
|
||||
"Timezone": "America/New_York (UTC-04:00)"
|
||||
},
|
||||
"pairedItem": {
|
||||
"item": 0
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"connections": {
|
||||
"Daily 4 AM ET": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Get Recipe URLs",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Get Recipe URLs": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Init Counters",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Init Counters": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Loop Recipe URLs",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Loop Recipe URLs": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Build Summary",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "Warm Cache (GET)",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Warm Cache (GET)": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Track Results",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Track Results": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Wait 5s",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Build Summary": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Call 'PBS: Google Chat Notify (Sub-Workflow)'",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Wait 5s": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Loop Recipe URLs",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"active": true,
|
||||
"settings": {
|
||||
"executionOrder": "v1",
|
||||
"availableInMCP": false
|
||||
},
|
||||
"versionId": "1139d52b-c9ea-4e78-8dc8-ef6904416593",
|
||||
"meta": {
|
||||
"templateCredsSetupCompleted": true,
|
||||
"instanceId": "eeb18e777509f7207ee9abd45845e7fbf014989719160f3ed6ae633d872bf6c4"
|
||||
},
|
||||
"id": "UPgYRkjq9YrUbGmvWL_wC",
|
||||
"tags": []
|
||||
}
|
||||
112
PBS_Google_Chat_Notify_(Sub-Workflow).json
Normal file
112
PBS_Google_Chat_Notify_(Sub-Workflow).json
Normal file
@ -0,0 +1,112 @@
|
||||
{
|
||||
"name": "PBS: Google Chat Notify (Sub-Workflow)",
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {
|
||||
"method": "POST",
|
||||
"url": "https://chat.googleapis.com/v1/spaces/AAQAdoDxA4c/messages?key=AIzaSyDdI0hCZtE6vySjMm-WEfRq3CPzqKqqsHI&token=bZPNAI8knELwfTEAoYHLZJdnZntrEUXn16lIODjwuEc",
|
||||
"sendHeaders": true,
|
||||
"headerParameters": {
|
||||
"parameters": [
|
||||
{
|
||||
"name": "Content-Type",
|
||||
"value": "application/json"
|
||||
}
|
||||
]
|
||||
},
|
||||
"sendBody": true,
|
||||
"specifyBody": "json",
|
||||
"jsonBody": "={ \"text\": {{ JSON.stringify($json.message) }} }",
|
||||
"options": {}
|
||||
},
|
||||
"id": "d42f145d-7e2b-4836-bc60-ad9e1cb6ee75",
|
||||
"name": "Send to Google Chat",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"typeVersion": 4.2,
|
||||
"position": [
|
||||
272,
|
||||
-48
|
||||
]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"inputSource": "passthrough"
|
||||
},
|
||||
"type": "n8n-nodes-base.executeWorkflowTrigger",
|
||||
"typeVersion": 1.1,
|
||||
"position": [
|
||||
-192,
|
||||
-48
|
||||
],
|
||||
"id": "ef786647-34e9-45d2-b4e5-8fdf017ed3ea",
|
||||
"name": "PBS-Sub-GChat"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"jsCode": "// Format the Google Chat message with icon, title, timestamp, and body.\n// Expected input fields:\n// icon (string) — emoji for the message type (e.g. '🔥', '⚠️', '🚨', '✅')\n// title (string) — short descriptor of what triggered this\n// message (string) — the main body content\n//\n// Output: single formatted text string ready for Google Chat.\n\nconst item = $input.first().json;\nconst icon = item.icon || 'ℹ️';\nconst title = item.title || 'PBS Notification';\nconst body = item.message || '';\n\n// Timestamp in ET\nconst now = new Date();\nconst timestamp = now.toLocaleString('en-US', {\n timeZone: 'America/New_York',\n weekday: 'short',\n year: 'numeric',\n month: 'short',\n day: 'numeric',\n hour: '2-digit',\n minute: '2-digit',\n second: '2-digit',\n hour12: true\n});\n\nconst formatted = `${icon} *${title}*\\n🕐 ${timestamp} ET\\n\\n${body}`;\n\nreturn [{ json: { message: formatted } }];\n"
|
||||
},
|
||||
"id": "02e9fecc-9d2b-4132-9d29-8ebd413ba2a0",
|
||||
"name": "Format Message",
|
||||
"type": "n8n-nodes-base.code",
|
||||
"typeVersion": 2,
|
||||
"position": [
|
||||
64,
|
||||
-48
|
||||
]
|
||||
}
|
||||
],
|
||||
"pinData": {
|
||||
"PBS-Sub-GChat": [
|
||||
{
|
||||
"json": {
|
||||
"title": "PBS-Cache Refresh",
|
||||
"message": "🔥 *PBS Cache Warmer — Daily Run Complete*\n\n*Recipe URLs in database:* 84\n*Warmed successfully:* 84\n*Errors:* 0\n\n✅ All recipe pages cached successfully.",
|
||||
"timestamp": "Apr 20, 22:29:01"
|
||||
},
|
||||
"pairedItem": {
|
||||
"item": 0
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"connections": {
|
||||
"Send to Google Chat": {
|
||||
"main": [
|
||||
[]
|
||||
]
|
||||
},
|
||||
"PBS-Sub-GChat": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Format Message",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Format Message": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Send to Google Chat",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"active": true,
|
||||
"settings": {
|
||||
"executionOrder": "v1",
|
||||
"availableInMCP": false
|
||||
},
|
||||
"versionId": "f246fa6b-41f6-4639-966b-02442bc5284b",
|
||||
"meta": {
|
||||
"instanceId": "eeb18e777509f7207ee9abd45845e7fbf014989719160f3ed6ae633d872bf6c4"
|
||||
},
|
||||
"id": "-DlPrT1UsgmacYJyoUJXU",
|
||||
"tags": []
|
||||
}
|
||||
457
PostPBSUpdate_new.json
Normal file
457
PostPBSUpdate_new.json
Normal file
@ -0,0 +1,457 @@
|
||||
{
|
||||
"name": "PostPBSUpdate_new",
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {
|
||||
"action": "hmac",
|
||||
"binaryData": true,
|
||||
"type": "SHA256",
|
||||
"dataPropertyName": "computed-sha256",
|
||||
"secret": "gqdSG9s8Lt8qYMgpxtSaeGM6nbYQAqq3X"
|
||||
},
|
||||
"type": "n8n-nodes-base.crypto",
|
||||
"typeVersion": 1,
|
||||
"position": [
|
||||
-1088,
|
||||
176
|
||||
],
|
||||
"id": "6bdf8b9f-f928-4614-8433-b0cd2ca3aad7",
|
||||
"name": "x-hash-create",
|
||||
"alwaysOutputData": false
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"conditions": {
|
||||
"options": {
|
||||
"caseSensitive": true,
|
||||
"leftValue": "",
|
||||
"typeValidation": "strict",
|
||||
"version": 3
|
||||
},
|
||||
"conditions": [
|
||||
{
|
||||
"id": "376cee8d-570b-4f25-bd45-c349a23061ae",
|
||||
"leftValue": "={{ $json.headers['x-pbs-signature'] }}",
|
||||
"rightValue": "={{ 'sha256=' + $json['computed-sha256'] }}",
|
||||
"operator": {
|
||||
"type": "string",
|
||||
"operation": "equals"
|
||||
}
|
||||
}
|
||||
],
|
||||
"combinator": "and"
|
||||
},
|
||||
"looseTypeValidation": "={{ false }}",
|
||||
"options": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.if",
|
||||
"typeVersion": 2.3,
|
||||
"position": [
|
||||
-864,
|
||||
176
|
||||
],
|
||||
"id": "14278d6e-b856-43ce-9457-3109544acfb7",
|
||||
"name": "xhash-check"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"errorMessage": "hash error"
|
||||
},
|
||||
"type": "n8n-nodes-base.stopAndError",
|
||||
"typeVersion": 1,
|
||||
"position": [
|
||||
-352,
|
||||
256
|
||||
],
|
||||
"id": "555c813d-b40e-4e3f-bba9-f04d52a8c0fc",
|
||||
"name": "Stop and Error"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"httpMethod": "POST",
|
||||
"path": "e53cd013-b4c3-4110-be41-c8c412d29e23",
|
||||
"options": {
|
||||
"rawBody": true
|
||||
}
|
||||
},
|
||||
"type": "n8n-nodes-base.webhook",
|
||||
"typeVersion": 2.1,
|
||||
"position": [
|
||||
-1344,
|
||||
176
|
||||
],
|
||||
"id": "079615e4-e43f-4659-9703-cd102a7442ad",
|
||||
"name": "WebH-listen for PBS update",
|
||||
"webhookId": "e53cd013-b4c3-4110-be41-c8c412d29e23"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"rules": {
|
||||
"values": [
|
||||
{
|
||||
"conditions": {
|
||||
"options": {
|
||||
"caseSensitive": true,
|
||||
"leftValue": "",
|
||||
"typeValidation": "strict",
|
||||
"version": 3
|
||||
},
|
||||
"conditions": [
|
||||
{
|
||||
"leftValue": "={{ $json.body.categories }}",
|
||||
"rightValue": "={{ 'recipes' }}",
|
||||
"operator": {
|
||||
"type": "array",
|
||||
"operation": "contains",
|
||||
"rightType": "any"
|
||||
},
|
||||
"id": "0ef2f922-a8ea-4952-9fe1-ac0213e552bb"
|
||||
}
|
||||
],
|
||||
"combinator": "and"
|
||||
},
|
||||
"renameOutput": true,
|
||||
"outputKey": "Recipe Update"
|
||||
},
|
||||
{
|
||||
"conditions": {
|
||||
"options": {
|
||||
"caseSensitive": true,
|
||||
"leftValue": "",
|
||||
"typeValidation": "strict",
|
||||
"version": 3
|
||||
},
|
||||
"conditions": [
|
||||
{
|
||||
"id": "470240b2-3e66-4a88-b892-b87e54d6d240",
|
||||
"leftValue": "={{ $json.body.categories }}",
|
||||
"rightValue": "={{ \"post\" }}",
|
||||
"operator": {
|
||||
"type": "array",
|
||||
"operation": "contains",
|
||||
"rightType": "any"
|
||||
}
|
||||
}
|
||||
],
|
||||
"combinator": "and"
|
||||
},
|
||||
"renameOutput": true,
|
||||
"outputKey": "Post Update"
|
||||
}
|
||||
]
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.switch",
|
||||
"typeVersion": 3.4,
|
||||
"position": [
|
||||
-608,
|
||||
64
|
||||
],
|
||||
"id": "b5ff3369-89c7-481c-9b23-18b17ee1621a",
|
||||
"name": "Switch on Tag"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"operation": "executeQuery",
|
||||
"query": "INSERT INTO pbs_recipes (post_id, recipe_title, recipe_url, keyword)\nVALUES (\n $1, $2, $3, $4\n)\nON DUPLICATE KEY UPDATE\n recipe_title = VALUES(recipe_title),\n recipe_url = VALUES(recipe_url),\n keyword = COALESCE(keyword, VALUES(keyword));",
|
||||
"options": {
|
||||
"queryReplacement": "={{ [$json.body.post_id, $json.body.title, $json.body.url, $json.body.tags.length > 0 ? $json.body.tags[0] : null] }}"
|
||||
}
|
||||
},
|
||||
"type": "n8n-nodes-base.mySql",
|
||||
"typeVersion": 2.5,
|
||||
"position": [
|
||||
-336,
|
||||
-48
|
||||
],
|
||||
"id": "9c016955-dbe1-41fe-95dc-145c8065b1d3",
|
||||
"name": "Update_recipe",
|
||||
"credentials": {
|
||||
"mySql": {
|
||||
"id": "4ETlVumrAq95ispJ",
|
||||
"name": "MySQL account"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"mode": "raw",
|
||||
"jsonOutput": "={\n \"title\": \"⛔ Hash Verification FAILED 🚨\",\n \"message\": \"Incoming webhook 'PostPBSUpdate failed signature check. Possible spoofed or malicious request. Check n8n logs immediately.\",\n \"timestamp\": \"{{ $now.toFormat('MMM dd, HH:mm:ss') }}\",\n \"space\": \"insta\"\n}",
|
||||
"options": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.set",
|
||||
"typeVersion": 3.4,
|
||||
"position": [
|
||||
-704,
|
||||
352
|
||||
],
|
||||
"id": "963df8ce-4e18-4d9c-98d6-2c96bfc4a383",
|
||||
"name": "set_xhash_error"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"workflowId": {
|
||||
"__rl": true,
|
||||
"value": "P465jEMJyKNZGOHVppbv2",
|
||||
"mode": "list",
|
||||
"cachedResultUrl": "/workflow/P465jEMJyKNZGOHVppbv2",
|
||||
"cachedResultName": "SendPBSChat_New"
|
||||
},
|
||||
"workflowInputs": {
|
||||
"mappingMode": "defineBelow",
|
||||
"value": {},
|
||||
"matchingColumns": [],
|
||||
"schema": [],
|
||||
"attemptToConvertTypes": false,
|
||||
"convertFieldsToString": true
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.executeWorkflow",
|
||||
"typeVersion": 1.3,
|
||||
"position": [
|
||||
208,
|
||||
-48
|
||||
],
|
||||
"id": "8be01273-8509-44f9-9f1e-3b5496b8974c",
|
||||
"name": "Call 'SendPBSChat'1"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"mode": "raw",
|
||||
"jsonOutput": "={\n \"title\": \"PBS-Update: Success ✅\",\n \"message\": \"Updated Hub Content with new PBS recipe. {{ $('WebH-listen for PBS update').item.json.body.title }}\",\n \"timestamp\": \"{{ $now.toFormat('MMM dd, HH:mm:ss') }}\",\n \"space\": \"insta\"\n}",
|
||||
"options": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.set",
|
||||
"typeVersion": 3.4,
|
||||
"position": [
|
||||
16,
|
||||
-48
|
||||
],
|
||||
"id": "474889e9-d8ec-4919-a140-871a1f95ffc6",
|
||||
"name": "set_pbs_update_success"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"workflowId": {
|
||||
"__rl": true,
|
||||
"value": "P465jEMJyKNZGOHVppbv2",
|
||||
"mode": "list",
|
||||
"cachedResultUrl": "/workflow/P465jEMJyKNZGOHVppbv2",
|
||||
"cachedResultName": "SendPBSChat_New"
|
||||
},
|
||||
"workflowInputs": {
|
||||
"mappingMode": "defineBelow",
|
||||
"value": {},
|
||||
"matchingColumns": [],
|
||||
"schema": [],
|
||||
"attemptToConvertTypes": false,
|
||||
"convertFieldsToString": true
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.executeWorkflow",
|
||||
"typeVersion": 1.3,
|
||||
"position": [
|
||||
-544,
|
||||
368
|
||||
],
|
||||
"id": "0af25ba2-cdf9-4436-a004-29ad59dcb9b7",
|
||||
"name": "Call 'SendPBSChat_New'"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"method": "POST",
|
||||
"url": "https://api.cloudflare.com/client/v4/zones/5b64a56e652d7ffeb7b790ce2d915192/purge_cache",
|
||||
"authentication": "genericCredentialType",
|
||||
"genericAuthType": "httpBearerAuth",
|
||||
"sendBody": true,
|
||||
"specifyBody": "json",
|
||||
"jsonBody": "={\n \"files\": [\"{{ $json.body.url }}\"]\n}",
|
||||
"options": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"typeVersion": 4.3,
|
||||
"position": [
|
||||
-160,
|
||||
-48
|
||||
],
|
||||
"id": "a96df5e0-54b6-43e3-a4ab-c64f6420cf6d",
|
||||
"name": "CF-Post-Purge",
|
||||
"credentials": {
|
||||
"httpBearerAuth": {
|
||||
"id": "Hmo79vo4h9ZGPh3i",
|
||||
"name": "CF Cache Purge"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"pinData": {
|
||||
"WebH-listen for PBS update": [
|
||||
{
|
||||
"json": {
|
||||
"headers": {
|
||||
"host": "n8n.plantbasedsoutherner.com",
|
||||
"user-agent": "WordPress/6.9.4; https://plantbasedsoutherner.com",
|
||||
"content-length": "201",
|
||||
"accept": "*/*",
|
||||
"accept-encoding": "deflate, gzip, br, zstd",
|
||||
"content-type": "application/json",
|
||||
"origin": "https://n8n.plantbasedsoutherner.com",
|
||||
"x-forwarded-for": "172.238.188.247",
|
||||
"x-forwarded-host": "n8n.plantbasedsoutherner.com",
|
||||
"x-forwarded-port": "443",
|
||||
"x-forwarded-proto": "https",
|
||||
"x-forwarded-server": "874112b5743e",
|
||||
"x-pbs-signature": "sha256=94218559d5eb16ccf5d4d475cf64f7e2748785854fa481c156142f24f610ce59",
|
||||
"x-real-ip": "172.238.188.247"
|
||||
},
|
||||
"params": {},
|
||||
"query": {},
|
||||
"body": {
|
||||
"post_id": 2437,
|
||||
"title": "A Little Southern Luck for St. Paddy's Day",
|
||||
"url": "https://plantbasedsoutherner.com/a-little-southern-luck-for-st-paddys-day/",
|
||||
"tags": [],
|
||||
"categories": [
|
||||
"recipes",
|
||||
"roundup"
|
||||
]
|
||||
},
|
||||
"webhookUrl": "https://n8n.plantbasedsoutherner.com/webhook/e53cd013-b4c3-4110-be41-c8c412d29e23",
|
||||
"executionMode": "production"
|
||||
},
|
||||
"binary": {
|
||||
"data": {
|
||||
"data": "eyJwb3N0X2lkIjoyNDM3LCJ0aXRsZSI6IkEgTGl0dGxlIFNvdXRoZXJuIEx1Y2sgZm9yIFN0LiBQYWRkeSdzIERheSIsInVybCI6Imh0dHBzOlwvXC9wbGFudGJhc2Vkc291dGhlcm5lci5jb21cL2EtbGl0dGxlLXNvdXRoZXJuLWx1Y2stZm9yLXN0LXBhZGR5cy1kYXlcLyIsInRhZ3MiOltdLCJjYXRlZ29yaWVzIjpbInJlY2lwZXMiLCJyb3VuZHVwIl19",
|
||||
"mimeType": "application/json"
|
||||
}
|
||||
},
|
||||
"pairedItem": {
|
||||
"item": 0
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"connections": {
|
||||
"x-hash-create": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "xhash-check",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"xhash-check": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Switch on Tag",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "set_xhash_error",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"WebH-listen for PBS update": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "x-hash-create",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Switch on Tag": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Update_recipe",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Update_recipe": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "CF-Post-Purge",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"set_xhash_error": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Call 'SendPBSChat_New'",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"set_pbs_update_success": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Call 'SendPBSChat'1",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Call 'SendPBSChat_New'": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Stop and Error",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"CF-Post-Purge": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "set_pbs_update_success",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"active": true,
|
||||
"settings": {
|
||||
"executionOrder": "v1",
|
||||
"availableInMCP": false
|
||||
},
|
||||
"versionId": "e9eb9c21-754e-4825-9afc-5e77f07f51c9",
|
||||
"meta": {
|
||||
"templateCredsSetupCompleted": true,
|
||||
"instanceId": "eeb18e777509f7207ee9abd45845e7fbf014989719160f3ed6ae633d872bf6c4"
|
||||
},
|
||||
"id": "fLN1C9mloAhLhdK7zM5I1",
|
||||
"tags": []
|
||||
}
|
||||
213
SendPBSChat_New.json
Normal file
213
SendPBSChat_New.json
Normal file
@ -0,0 +1,213 @@
|
||||
{
|
||||
"name": "SendPBSChat_New",
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {
|
||||
"inputSource": "passthrough"
|
||||
},
|
||||
"type": "n8n-nodes-base.executeWorkflowTrigger",
|
||||
"typeVersion": 1.1,
|
||||
"position": [
|
||||
-656,
|
||||
192
|
||||
],
|
||||
"id": "97180c9d-35e0-4b13-a9c6-f6af36002192",
|
||||
"name": "Enter_Msg_Post"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"rules": {
|
||||
"values": [
|
||||
{
|
||||
"conditions": {
|
||||
"options": {
|
||||
"caseSensitive": true,
|
||||
"leftValue": "",
|
||||
"typeValidation": "strict",
|
||||
"version": 3
|
||||
},
|
||||
"conditions": [
|
||||
{
|
||||
"leftValue": "={{ $('Enter_Msg_Post').item.json.space }}",
|
||||
"rightValue": "insta",
|
||||
"operator": {
|
||||
"type": "string",
|
||||
"operation": "equals"
|
||||
},
|
||||
"id": "c86cc6d5-7623-4936-99fd-7fe40ef88e48"
|
||||
}
|
||||
],
|
||||
"combinator": "and"
|
||||
},
|
||||
"renameOutput": true,
|
||||
"outputKey": "insta-msg"
|
||||
},
|
||||
{
|
||||
"conditions": {
|
||||
"options": {
|
||||
"caseSensitive": true,
|
||||
"leftValue": "",
|
||||
"typeValidation": "strict",
|
||||
"version": 3
|
||||
},
|
||||
"conditions": [
|
||||
{
|
||||
"id": "345bde6a-521e-4b79-94b6-d9bcf9a45a05",
|
||||
"leftValue": "={{ $('Enter_Msg_Post').item.json.space }}",
|
||||
"rightValue": "automation",
|
||||
"operator": {
|
||||
"type": "string",
|
||||
"operation": "equals",
|
||||
"name": "filter.operator.equals"
|
||||
}
|
||||
}
|
||||
],
|
||||
"combinator": "and"
|
||||
},
|
||||
"renameOutput": true,
|
||||
"outputKey": "Auto-msg"
|
||||
}
|
||||
]
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.switch",
|
||||
"typeVersion": 3.4,
|
||||
"position": [
|
||||
-272,
|
||||
192
|
||||
],
|
||||
"id": "86ab99df-e8ec-46f3-8be8-0a2a898395a0",
|
||||
"name": "Switch"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"method": "POST",
|
||||
"url": "https://chat.googleapis.com/v1/spaces/AAQAdoDxA4c/messages?key=AIzaSyDdI0hCZtE6vySjMm-WEfRq3CPzqKqqsHI&token=bZPNAI8knELwfTEAoYHLZJdnZntrEUXn16lIODjwuEc",
|
||||
"sendBody": true,
|
||||
"bodyParameters": {
|
||||
"parameters": [
|
||||
{
|
||||
"name": "cardsV2",
|
||||
"value": "={{ $json.cardsV2 }}"
|
||||
}
|
||||
]
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"typeVersion": 4.3,
|
||||
"position": [
|
||||
48,
|
||||
48
|
||||
],
|
||||
"id": "40a1e284-f9d5-47f1-9a7d-309b18ece9aa",
|
||||
"name": "Insta to PBS Chat"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"method": "POST",
|
||||
"url": "https://chat.googleapis.com/v1/spaces/AAQAS9WI6CY/messages?key=AIzaSyDdI0hCZtE6vySjMm-WEfRq3CPzqKqqsHI&token=7V71Cn484L9ijJjmVTS14raIiSQd3j8TgAu1XTEdV9Q",
|
||||
"sendBody": true,
|
||||
"bodyParameters": {
|
||||
"parameters": [
|
||||
{
|
||||
"name": "cardsV2",
|
||||
"value": "={{ $json.cardsV2 }}"
|
||||
}
|
||||
]
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"typeVersion": 4.3,
|
||||
"position": [
|
||||
64,
|
||||
256
|
||||
],
|
||||
"id": "a537eef5-98cb-4fa3-b114-e23ba65dd2cf",
|
||||
"name": "Auto to PBS Chat"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"jsCode": "const input = $('Enter_Msg_Post').first().json;\n\nconst widgets = [\n { textParagraph: { text: input.message } }\n];\n\nif (input.link_url) {\n widgets.push({\n buttonList: {\n buttons: [{\n text: \"Open in pbs-hub\",\n onClick: { openLink: { url: input.link_url } }\n }]\n }\n });\n}\n\nreturn [{\n json: {\n cardsV2: [{\n card: {\n header: { title: `🌻 PBS Alert: ${input.title}` },\n sections: [{ widgets }]\n }\n }]\n }\n}];"
|
||||
},
|
||||
"type": "n8n-nodes-base.code",
|
||||
"typeVersion": 2,
|
||||
"position": [
|
||||
-448,
|
||||
192
|
||||
],
|
||||
"id": "90a03870-1a0d-4af2-a961-905587545176",
|
||||
"name": "Code in JavaScript"
|
||||
}
|
||||
],
|
||||
"pinData": {
|
||||
"Enter_Msg_Post": [
|
||||
{
|
||||
"json": {
|
||||
"title": "Send Message Problem ⚠️",
|
||||
"message": "This message did not trigger an auto recipe reply!\n\nReel ID: 18008185346730575\nCommenter: @tinyplanteaters\nComment: Yum 😋",
|
||||
"space": "automation",
|
||||
"timestamp": "May 31, 19:35:03"
|
||||
},
|
||||
"pairedItem": {
|
||||
"item": 0
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"connections": {
|
||||
"Enter_Msg_Post": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Code in JavaScript",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Switch": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Insta to PBS Chat",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "Auto to PBS Chat",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Code in JavaScript": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Switch",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"active": true,
|
||||
"settings": {
|
||||
"executionOrder": "v1",
|
||||
"availableInMCP": false
|
||||
},
|
||||
"versionId": "575e25bc-2af9-4930-98f1-88d7e33d9950",
|
||||
"meta": {
|
||||
"instanceId": "eeb18e777509f7207ee9abd45845e7fbf014989719160f3ed6ae633d872bf6c4"
|
||||
},
|
||||
"id": "P465jEMJyKNZGOHVppbv2",
|
||||
"tags": []
|
||||
}
|
||||
906
Sub-instra-reply-handle-new.json
Normal file
906
Sub-instra-reply-handle-new.json
Normal file
@ -0,0 +1,906 @@
|
||||
{
|
||||
"name": "Sub-instra-reply-handle-new",
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {
|
||||
"inputSource": "passthrough"
|
||||
},
|
||||
"id": "bc9bd3d4-2a46-42ff-bae7-9e430777b7bb",
|
||||
"typeVersion": 1.1,
|
||||
"name": "Enter_Workflow",
|
||||
"type": "n8n-nodes-base.executeWorkflowTrigger",
|
||||
"position": [
|
||||
-768,
|
||||
128
|
||||
]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"jsCode": "const value = $('Enter_Workflow').first().json.webhook_payload.body.entry[0].changes[0].value;\n\nconst resolvedMediaId = value.media?.original_media_id || value.media?.id;\n\nreturn [{\n json: {\n ...$input.first().json,\n resolved_media_id: resolvedMediaId\n }\n}];"
|
||||
},
|
||||
"type": "n8n-nodes-base.code",
|
||||
"typeVersion": 2,
|
||||
"position": [
|
||||
-544,
|
||||
128
|
||||
],
|
||||
"id": "c692e1f0-4ee1-4c87-9ce2-a5330497d15c",
|
||||
"name": "Get_Media_ID"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"conditions": {
|
||||
"options": {
|
||||
"caseSensitive": true,
|
||||
"leftValue": "",
|
||||
"typeValidation": "strict",
|
||||
"version": 3
|
||||
},
|
||||
"conditions": [
|
||||
{
|
||||
"id": "c4be9e7f-8c56-442e-8a0f-b31bc917f6e0",
|
||||
"leftValue": "={{ $('Enter_Workflow').item.json.webhook_payload.body.entry[0].changes[0].value.text }}\n",
|
||||
"rightValue": "\\brecipe\\b",
|
||||
"operator": {
|
||||
"type": "string",
|
||||
"operation": "regex"
|
||||
}
|
||||
}
|
||||
],
|
||||
"combinator": "and"
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.if",
|
||||
"typeVersion": 2.3,
|
||||
"position": [
|
||||
928,
|
||||
32
|
||||
],
|
||||
"id": "e77f8544-1e55-473b-8934-0b0a596ffe27",
|
||||
"name": "Check_if_Recipe"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"jsCode": "// 1. Grab the comment from the incoming Webhook\nconst commentText = $('Enter_Workflow').first().json.webhook_payload.body.entry[0].changes[0].value.text\n\n\n// 3. Find the matching recipe\n // 1. Grab the keyword directly from the object\n const kw = $('Merge').first().json.reel_keyword || $('Merge').first().json.keyword || null;\n // 3. Run the match against the comment\n const regex = new RegExp(`\\\\b${kw}\\\\b`, 'i'); // Fixed: parentheses instead of backtick\n const match = regex.test(commentText);\n\n// 4. Return the result\nif (match) {\n return {\n found: true,\n };\n} else {\n return { found: false };\n}"
|
||||
},
|
||||
"type": "n8n-nodes-base.code",
|
||||
"typeVersion": 2,
|
||||
"position": [
|
||||
1136,
|
||||
160
|
||||
],
|
||||
"id": "8bbdca4c-8ee4-4809-b10a-5559e6ed6562",
|
||||
"name": "Get_Msg_Keyword"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"conditions": {
|
||||
"options": {
|
||||
"caseSensitive": true,
|
||||
"leftValue": "",
|
||||
"typeValidation": "strict",
|
||||
"version": 3
|
||||
},
|
||||
"conditions": [
|
||||
{
|
||||
"id": "7694f195-eabf-46ea-915f-fbfd8b49f30b",
|
||||
"leftValue": "={{ $json.found }}",
|
||||
"rightValue": true,
|
||||
"operator": {
|
||||
"type": "boolean",
|
||||
"operation": "equals"
|
||||
}
|
||||
}
|
||||
],
|
||||
"combinator": "and"
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.if",
|
||||
"typeVersion": 2.3,
|
||||
"position": [
|
||||
1328,
|
||||
160
|
||||
],
|
||||
"id": "68dfc980-fac5-4fa7-af2a-1b7ac2ec3851",
|
||||
"name": "If_Keyword_Used"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"method": "POST",
|
||||
"url": "https://n8n.staging.plantbasedsoutherner.com/webhook/staging-test",
|
||||
"sendBody": true,
|
||||
"bodyParameters": {
|
||||
"parameters": [
|
||||
{
|
||||
"name": "title",
|
||||
"value": "=Get Reel Data Error ⚠️"
|
||||
},
|
||||
{
|
||||
"name": "message",
|
||||
"value": "={{ 'Did not find a record!\\nReel ID: ' + $('Get_Media_ID').item.json.resolved_media_id+ '\\nCommenter: @' + $('Enter_Workflow').first().json.webhook_payload.body.entry[0].changes[0].value.from.username + '\\ncomment: '+ $('Enter_Workflow').item.json.webhook_payload.body.entry[0].changes[0].value.text}}\n"
|
||||
},
|
||||
{
|
||||
"name": "timestamp",
|
||||
"value": "={{ $now.toFormat('MMM dd, HH:mm:ss') }}"
|
||||
}
|
||||
]
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"typeVersion": 4.3,
|
||||
"position": [
|
||||
1312,
|
||||
848
|
||||
],
|
||||
"id": "581dd3e0-8544-4e78-9874-dc587e89774c",
|
||||
"name": "Send_Data_Error_Msg"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"method": "POST",
|
||||
"url": "https://n8n.staging.plantbasedsoutherner.com/webhook/staging-test",
|
||||
"sendBody": true,
|
||||
"bodyParameters": {
|
||||
"parameters": [
|
||||
{
|
||||
"name": "title",
|
||||
"value": "Send Message Problem ⚠️"
|
||||
},
|
||||
{
|
||||
"name": "message",
|
||||
"value": "={{ \"This message did not trigger an auto recipe reply!\\n\\nReel ID: \" + $('Get_Media_ID').item.json.resolved_media_id + \"\\nCommenter: @\" + $('Enter_Workflow').item.json.webhook_payload.body.entry[0].changes[0].value.from.username + \"\\nComment: \" + $('Enter_Workflow').item.json.webhook_payload.body.entry[0].changes[0].value.text }}"
|
||||
},
|
||||
{
|
||||
"name": "timestamp",
|
||||
"value": "={{ $now.toFormat('MMM dd, HH:mm:ss') }}"
|
||||
}
|
||||
]
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"typeVersion": 4.3,
|
||||
"position": [
|
||||
1520,
|
||||
832
|
||||
],
|
||||
"id": "72f6c10b-1c08-494a-8a3c-2b97a0798248",
|
||||
"name": "Send_No_Reply_Msg"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"method": "POST",
|
||||
"url": "https://graph.instagram.com/v24.0/26121541700773885/messages",
|
||||
"authentication": "genericCredentialType",
|
||||
"genericAuthType": "httpBearerAuth",
|
||||
"sendHeaders": true,
|
||||
"headerParameters": {
|
||||
"parameters": [
|
||||
{
|
||||
"name": "Content-Type",
|
||||
"value": "application/json"
|
||||
}
|
||||
]
|
||||
},
|
||||
"sendBody": true,
|
||||
"specifyBody": "json",
|
||||
"jsonBody": "={\n \"recipient\": {\n \"comment_id\": \"{{ $json.comment_id }}\"\n },\n \"message\": {\n \"text\": \"{{ $json.dm_message }}\"\n }\n}",
|
||||
"options": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"typeVersion": 4.3,
|
||||
"position": [
|
||||
1712,
|
||||
-144
|
||||
],
|
||||
"id": "6149e145-253b-451e-a426-d38a409b9504",
|
||||
"name": "FB_DM_Msg",
|
||||
"credentials": {
|
||||
"httpHeaderAuth": {
|
||||
"id": "bU1D0djQYelYC4km",
|
||||
"name": "gitea-auth"
|
||||
},
|
||||
"httpBearerAuth": {
|
||||
"id": "y2nNsjj4Bi9JwGHX",
|
||||
"name": "insta-auth"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"jsCode": "// 1. Get the user who commented\nconst webhookData = $('Enter_Workflow').first().json.webhook_payload.body.entry[0].changes[0].value;\nconst recipientId = webhookData.from.id; // or from.self_ig_scoped_id\nconst commentId = webhookData.id;\nconst username = webhookData.from.username;\n\n// 2. Get the recipe data (from Merge for TRUE path, or from search keyword for FALSE path)\nconst recipeData = $('Merge').first().json;\nconst recipeUrl = recipeData.recipe_url;\nconst recipeTitle = recipeData.recipe_title;\n\n// Array of public reply messages (randomized)\nconst publicReplies = [\n `Sending you the recipe in your DMs! 🌻`,\n `🌻 Check your DMs for the recipe!`,\n `Recipe headed to your inbox! 🌻`,\n `🌻 DM sent with the recipe!`,\n `Recipe incoming! Check your messages 🌻`,\n `🌻 On its way to your DMs!`\n];\n\n// Pick a random reply\nconst randomReply = publicReplies[Math.floor(Math.random() * publicReplies.length)];\n\n// DM message stays consistent\nconst dmMessage = `Here's the recipe! 🌻 ${recipeUrl}`;\n\n// 4. Return data for the HTTP Request node\nreturn {\n json: {\n comment_id: commentId,\n username: username, \n public_reply_message: randomReply, // Random public comment\n dm_message: dmMessage, // Consistent DM message\n recipe_title: recipeTitle,\n recipe_url: recipeUrl\n \n }\n};\n"
|
||||
},
|
||||
"type": "n8n-nodes-base.code",
|
||||
"typeVersion": 2,
|
||||
"position": [
|
||||
1488,
|
||||
-80
|
||||
],
|
||||
"id": "21d50229-5490-4904-a9df-3b4db87190ac",
|
||||
"name": "Prep_FB_Msg"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"method": "POST",
|
||||
"url": "=https://graph.instagram.com/v24.0/{{ $json.comment_id }}/replies",
|
||||
"authentication": "genericCredentialType",
|
||||
"genericAuthType": "httpBearerAuth",
|
||||
"sendBody": true,
|
||||
"specifyBody": "json",
|
||||
"jsonBody": "={\n \"message\": \"@{{ $json.username }} {{ $json.public_reply_message }}\"\n}",
|
||||
"options": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"typeVersion": 4.3,
|
||||
"position": [
|
||||
1712,
|
||||
48
|
||||
],
|
||||
"id": "e1a60149-ad78-492f-833a-ef6f7b96c4ee",
|
||||
"name": "FB_Reel_Reply",
|
||||
"credentials": {
|
||||
"httpBearerAuth": {
|
||||
"id": "y2nNsjj4Bi9JwGHX",
|
||||
"name": "insta-auth"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"conditions": {
|
||||
"options": {
|
||||
"caseSensitive": true,
|
||||
"leftValue": "",
|
||||
"typeValidation": "strict",
|
||||
"version": 3
|
||||
},
|
||||
"conditions": [
|
||||
{
|
||||
"id": "a552f373-88c2-4cca-aed4-771aad252155",
|
||||
"leftValue": "={{ $json.id }}",
|
||||
"rightValue": "={{0}}",
|
||||
"operator": {
|
||||
"type": "number",
|
||||
"operation": "exists",
|
||||
"singleValue": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"combinator": "and"
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.if",
|
||||
"typeVersion": 2.3,
|
||||
"position": [
|
||||
112,
|
||||
176
|
||||
],
|
||||
"id": "b5ab3f2c-f518-474c-bd53-a7e67f0ce970",
|
||||
"name": "Check_Return_Data",
|
||||
"alwaysOutputData": false
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"operation": "executeQuery",
|
||||
"query": "SELECT IP.*, PR.keyword, PR.recipe_url, PR.recipe_title \n FROM platform_posts AS IP \n LEFT JOIN pbs_recipes as PR on IP.pbs_post_id = PR.post_id \n WHERE IP.platform_post_id = $1",
|
||||
"options": {
|
||||
"queryReplacement": "={{ ($json.resolved_media_id)}}"
|
||||
}
|
||||
},
|
||||
"type": "n8n-nodes-base.mySql",
|
||||
"typeVersion": 2.5,
|
||||
"position": [
|
||||
-336,
|
||||
144
|
||||
],
|
||||
"id": "dc2e570e-03e7-4984-8fb1-07212950e6f9",
|
||||
"name": "Get_Reel_Datas",
|
||||
"alwaysOutputData": true,
|
||||
"credentials": {
|
||||
"mySql": {
|
||||
"id": "4ETlVumrAq95ispJ",
|
||||
"name": "MySQL account"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"mode": "raw",
|
||||
"jsonOutput": "={\n \"data\": [\n {{$input.first().json}}\n ]\n}\n",
|
||||
"options": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.set",
|
||||
"typeVersion": 3.4,
|
||||
"position": [
|
||||
-192,
|
||||
-144
|
||||
],
|
||||
"id": "2ea8eb67-7896-4439-a009-949950a5935d",
|
||||
"name": "Set_Reply_Data"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"url": "=https://graph.instagram.com/v25.0/{{ $json.resolved_media_id }}?fields=id,caption,timestamp,comments_count",
|
||||
"authentication": "genericCredentialType",
|
||||
"genericAuthType": "httpBearerAuth",
|
||||
"options": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"typeVersion": 4.3,
|
||||
"position": [
|
||||
-368,
|
||||
-144
|
||||
],
|
||||
"id": "a35000ac-c014-4b8f-a7ac-ecb0195688c0",
|
||||
"name": "CallFB_Get_Post_Info",
|
||||
"credentials": {
|
||||
"httpHeaderAuth": {
|
||||
"id": "bU1D0djQYelYC4km",
|
||||
"name": "gitea-auth"
|
||||
},
|
||||
"httpQueryAuth": {
|
||||
"id": "9poWzM5erRyAfM1e",
|
||||
"name": "Query Auth account"
|
||||
},
|
||||
"httpBearerAuth": {
|
||||
"id": "y2nNsjj4Bi9JwGHX",
|
||||
"name": "insta-auth"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"jsCode": "// This processes each post as a separate item\n// You have 5 items, each with a data array\nconst allPages = $input.all();\n\n// Flatten all data arrays into one big array\nconst allPosts = allPages.flatMap(page => {\n const posts = page.json.data || [];\n return posts;\n});\n\n\n// Return as separate items\nreturn allPosts.map(post => ({\n json: {\n postID: post.id,\n caption: post.caption || '',\n timestamp: post.timestamp\n }\n}));"
|
||||
},
|
||||
"type": "n8n-nodes-base.code",
|
||||
"typeVersion": 2,
|
||||
"position": [
|
||||
-32,
|
||||
-144
|
||||
],
|
||||
"id": "d1190f3c-9e0c-4dbf-94fb-423cea08aa4a",
|
||||
"name": "JS_Post_Info"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"jsCode": "//set the static data for later\nconst staticData = $getWorkflowStaticData('global');\nstaticData.success = true;\nstaticData.reason = 'na';\n\n// Process each Instagram post\nconst outputItems = [];\n\nfor (const item of $input.all()) {\n const caption = item.json.caption || '';\n const postId = item.json.id;\n \n // Extract keyword - handle smart quotes too\n //const keywordMatch = caption.match(/comment\\s*[:\"'\"\"']?\\s*(\\w+)/i);\n //const keyword = keywordMatch ? keywordMatch[1].toLowerCase() : null;\n\n const keywordMatch = caption.match(/comment\\s*[\\u201C\\u201D\"'\"\"']?\\s*(\\w+)/i);\n const keyword = keywordMatch ? keywordMatch[1].toLowerCase() : null;\n \n // Extract WordPress post ID\n const wpPostIdMatch = caption.match(/ID\\s*:?\\s*(\\d+)/i);\n const wpPostId = wpPostIdMatch ? parseInt(wpPostIdMatch[1]) : null;\n \n outputItems.push({\n json: {\n instagram_post_id: postId,\n instagram_caption: caption,\n reel_keyword: keyword,\n reel_wp_post_id: wpPostId,\n ...item.json\n }\n });\n}\n\nreturn outputItems;"
|
||||
},
|
||||
"type": "n8n-nodes-base.code",
|
||||
"typeVersion": 2,
|
||||
"position": [
|
||||
128,
|
||||
-144
|
||||
],
|
||||
"id": "daa8e4c0-e8a6-4aec-a555-fa4e9d97412a",
|
||||
"name": "JS_Code_and_keyword"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"mode": "combine",
|
||||
"combineBy": "combineByPosition",
|
||||
"options": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.merge",
|
||||
"typeVersion": 3.2,
|
||||
"position": [
|
||||
-80,
|
||||
176
|
||||
],
|
||||
"id": "35cc2609-31da-4c59-8e82-3e1e16dc7c30",
|
||||
"name": "Merge"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"jsCode": "return [{\n json: {\n ...$('Get_Media_ID').first().json,\n ...$('Merge').first().json\n }\n}];"
|
||||
},
|
||||
"type": "n8n-nodes-base.code",
|
||||
"typeVersion": 2,
|
||||
"position": [
|
||||
416,
|
||||
352
|
||||
],
|
||||
"id": "d685d601-f747-479a-862d-9bc568fa0aa0",
|
||||
"name": "Code in JavaScript1"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"conditions": {
|
||||
"options": {
|
||||
"caseSensitive": true,
|
||||
"leftValue": "",
|
||||
"typeValidation": "strict",
|
||||
"version": 3
|
||||
},
|
||||
"conditions": [
|
||||
{
|
||||
"id": "72d18483-cc91-4b53-9cc0-bff0ba2df30e",
|
||||
"leftValue": "={{ $json.recipe_url }}",
|
||||
"rightValue": "",
|
||||
"operator": {
|
||||
"type": "string",
|
||||
"operation": "exists",
|
||||
"singleValue": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "89594b5f-5872-4004-b845-3f8189c94713",
|
||||
"leftValue": "={{ $json.recipe_url }}",
|
||||
"rightValue": "",
|
||||
"operator": {
|
||||
"type": "string",
|
||||
"operation": "notEmpty",
|
||||
"singleValue": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"combinator": "and"
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.if",
|
||||
"typeVersion": 2.3,
|
||||
"position": [
|
||||
320,
|
||||
176
|
||||
],
|
||||
"id": "4e833080-8ed2-4c45-a299-33480cdec9ac",
|
||||
"name": "Check_URL"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"conditions": {
|
||||
"options": {
|
||||
"caseSensitive": true,
|
||||
"leftValue": "",
|
||||
"typeValidation": "strict",
|
||||
"version": 3
|
||||
},
|
||||
"conditions": [
|
||||
{
|
||||
"id": "5e42803a-6d66-404b-ae45-b3421c1e6f2e",
|
||||
"leftValue": "={{ $json.success }}",
|
||||
"rightValue": false,
|
||||
"operator": {
|
||||
"type": "boolean",
|
||||
"operation": "true",
|
||||
"singleValue": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"combinator": "and"
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.if",
|
||||
"typeVersion": 2.3,
|
||||
"position": [
|
||||
800,
|
||||
352
|
||||
],
|
||||
"id": "6c4d4448-fa48-4df7-83e2-2a61164953bc",
|
||||
"name": "Return_Sub_ReelCache"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"mode": "raw",
|
||||
"jsonOutput": "={ \n \"title\": \"Send Message Problem ⚠️\",\n \"message\": \"{{ \"This message did not trigger an auto recipe reply!\\n\\nReel ID: \" + $('Get_Media_ID').item.json.resolved_media_id + \"\\nCommenter: @\" + $('Enter_Workflow').item.json.webhook_payload.body.entry[0].changes[0].value.from.username + \"\\nComment: \" + $('Enter_Workflow').item.json.webhook_payload.body.entry[0].changes[0].value.text }}\",\n \"link_url\": \"{{ 'https://plantbasedsoutherner.com/admin/platform-posts/' + $('Get_Reel_Datas').first().json.id }}\",\n \"space\": \"automation\",\n \"timestamp\": \"{{ $now.toFormat('MMM dd, HH:mm:ss') }}\"\n}",
|
||||
"includeOtherFields": "={{ false }}",
|
||||
"options": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.set",
|
||||
"typeVersion": 3.4,
|
||||
"position": [
|
||||
1552,
|
||||
416
|
||||
],
|
||||
"id": "6ff7a17a-1263-49a4-baf8-eeaf2a4fc890",
|
||||
"name": "set_Send_No_Reply_Msg"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"workflowId": {
|
||||
"__rl": true,
|
||||
"value": "P465jEMJyKNZGOHVppbv2",
|
||||
"mode": "list",
|
||||
"cachedResultUrl": "/workflow/P465jEMJyKNZGOHVppbv2",
|
||||
"cachedResultName": "SendPBSChat_New"
|
||||
},
|
||||
"workflowInputs": {
|
||||
"mappingMode": "defineBelow",
|
||||
"value": {},
|
||||
"matchingColumns": [],
|
||||
"schema": [],
|
||||
"attemptToConvertTypes": false,
|
||||
"convertFieldsToString": true
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.executeWorkflow",
|
||||
"typeVersion": 1.3,
|
||||
"position": [
|
||||
1888,
|
||||
496
|
||||
],
|
||||
"id": "7917e735-40f5-4202-9ef7-f3a9902575cb",
|
||||
"name": "Call_PBS_Msg"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"mode": "raw",
|
||||
"jsonOutput": "={ \n \"title\": \"Get Reel Data Error ⚠️\",\n \"message\": \"{{ 'Did not find a record!\\nReel ID: ' + $('Get_Media_ID').item.json.resolved_media_id+ '\\nCommenter: @' + $('Enter_Workflow').first().json.webhook_payload.body.entry[0].changes[0].value.from.username + '\\ncomment: '+ $('Enter_Workflow').item.json.webhook_payload.body.entry[0].changes[0].value.text}}\",\n \"link_url\": \"{{ 'https://plantbasedsoutherner.com/admin/platform-posts/' + $('Get_Reel_Datas').first().json.id }}\",\n \"space\": \"automation\",\n \"timestamp\": \"{{ $now.toFormat('MMM dd, HH:mm:ss') }}\"\n}",
|
||||
"includeOtherFields": "={{ false }}",
|
||||
"options": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.set",
|
||||
"typeVersion": 3.4,
|
||||
"position": [
|
||||
1280,
|
||||
576
|
||||
],
|
||||
"id": "7d9d04bf-0f6a-4ef3-9ff8-93a59422046a",
|
||||
"name": "set_Send_Data_Error_Msg"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"workflowId": {
|
||||
"__rl": true,
|
||||
"value": "_bFiVQvN0skfuU6KlNtDO",
|
||||
"mode": "list",
|
||||
"cachedResultUrl": "/workflow/_bFiVQvN0skfuU6KlNtDO",
|
||||
"cachedResultName": "instra-reel-cache-new"
|
||||
},
|
||||
"workflowInputs": {
|
||||
"mappingMode": "defineBelow",
|
||||
"value": {},
|
||||
"matchingColumns": [],
|
||||
"schema": [],
|
||||
"attemptToConvertTypes": false,
|
||||
"convertFieldsToString": true
|
||||
},
|
||||
"options": {
|
||||
"waitForSubWorkflow": true
|
||||
}
|
||||
},
|
||||
"type": "n8n-nodes-base.executeWorkflow",
|
||||
"typeVersion": 1.3,
|
||||
"position": [
|
||||
624,
|
||||
352
|
||||
],
|
||||
"id": "c032d658-0105-4aad-831d-0ca87127e50d",
|
||||
"name": "Call 'instra-reel-cache-new'"
|
||||
}
|
||||
],
|
||||
"pinData": {
|
||||
"Enter_Workflow": [
|
||||
{
|
||||
"json": {
|
||||
"webhook_payload": {
|
||||
"headers": {
|
||||
"host": "n8n.plantbasedsoutherner.com",
|
||||
"user-agent": "Webhooks/1.0 (https://fb.me/webhooks)",
|
||||
"content-length": "321",
|
||||
"accept": "*/*",
|
||||
"content-type": "application/json",
|
||||
"origin": "https://n8n.plantbasedsoutherner.com",
|
||||
"x-forwarded-for": "173.252.95.22",
|
||||
"x-forwarded-host": "n8n.plantbasedsoutherner.com",
|
||||
"x-forwarded-port": "443",
|
||||
"x-forwarded-proto": "https",
|
||||
"x-forwarded-server": "874112b5743e",
|
||||
"x-hub-signature": "sha1=c00e77402d3e1f402656d6d3f7993be3014e0614",
|
||||
"x-hub-signature-256": "sha256=a6262a348114ddf7086e37ea14533d194b79d63c6c9cf3aeac01dc84e9ccc02a",
|
||||
"x-real-ip": "173.252.95.22",
|
||||
"accept-encoding": "gzip"
|
||||
},
|
||||
"params": {},
|
||||
"query": {},
|
||||
"body": {
|
||||
"entry": [
|
||||
{
|
||||
"id": "17841470338696118",
|
||||
"time": 1780270502,
|
||||
"changes": [
|
||||
{
|
||||
"value": {
|
||||
"from": {
|
||||
"id": "1383387096491187",
|
||||
"username": "tinyplanteaters"
|
||||
},
|
||||
"media": {
|
||||
"id": "18008185346730575",
|
||||
"media_product_type": "REELS"
|
||||
},
|
||||
"id": "17923963638346992",
|
||||
"text": "Yum 😋"
|
||||
},
|
||||
"field": "comments"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"object": "instagram"
|
||||
},
|
||||
"webhookUrl": "https://n8n.plantbasedsoutherner.com/webhook/pi37K-qE4hpB-ncEGa5ph-BYoFD-fTBjmtc",
|
||||
"executionMode": "production"
|
||||
}
|
||||
},
|
||||
"pairedItem": {
|
||||
"item": 0
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"connections": {
|
||||
"Enter_Workflow": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Get_Media_ID",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Get_Media_ID": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Get_Reel_Datas",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
},
|
||||
{
|
||||
"node": "CallFB_Get_Post_Info",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Check_if_Recipe": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Prep_FB_Msg",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "Get_Msg_Keyword",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Get_Msg_Keyword": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "If_Keyword_Used",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"If_Keyword_Used": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Prep_FB_Msg",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "set_Send_No_Reply_Msg",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Prep_FB_Msg": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "FB_DM_Msg",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
},
|
||||
{
|
||||
"node": "FB_Reel_Reply",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Check_Return_Data": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Check_URL",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "Code in JavaScript1",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Get_Reel_Datas": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Merge",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Set_Reply_Data": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "JS_Post_Info",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"CallFB_Get_Post_Info": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Set_Reply_Data",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"JS_Post_Info": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "JS_Code_and_keyword",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"JS_Code_and_keyword": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Merge",
|
||||
"type": "main",
|
||||
"index": 1
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Merge": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Check_Return_Data",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Code in JavaScript1": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Call 'instra-reel-cache-new'",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Check_URL": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Check_if_Recipe",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "set_Send_Data_Error_Msg",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Return_Sub_ReelCache": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Check_if_Recipe",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "set_Send_Data_Error_Msg",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"set_Send_No_Reply_Msg": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Call_PBS_Msg",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"set_Send_Data_Error_Msg": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Call_PBS_Msg",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Call 'instra-reel-cache-new'": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Return_Sub_ReelCache",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"active": true,
|
||||
"settings": {
|
||||
"executionOrder": "v1",
|
||||
"availableInMCP": false
|
||||
},
|
||||
"versionId": "0aa99e07-3a91-4005-923d-2c88acb71fae",
|
||||
"meta": {
|
||||
"templateCredsSetupCompleted": true,
|
||||
"instanceId": "eeb18e777509f7207ee9abd45845e7fbf014989719160f3ed6ae633d872bf6c4"
|
||||
},
|
||||
"id": "gtosD7EYCQQ8JoqOaLtUA",
|
||||
"tags": []
|
||||
}
|
||||
697
insta-webhook-new.json
Normal file
697
insta-webhook-new.json
Normal file
@ -0,0 +1,697 @@
|
||||
{
|
||||
"name": "insta-webhook-new",
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {
|
||||
"multipleMethods": true,
|
||||
"httpMethod": [
|
||||
"POST",
|
||||
"GET"
|
||||
],
|
||||
"path": "pi37K-qE4hpB-ncEGa5ph-BYoFD-fTBjmtc",
|
||||
"responseMode": "responseNode",
|
||||
"options": {
|
||||
"rawBody": true
|
||||
}
|
||||
},
|
||||
"type": "n8n-nodes-base.webhook",
|
||||
"typeVersion": 2.1,
|
||||
"position": [
|
||||
-928,
|
||||
208
|
||||
],
|
||||
"id": "83c49ffb-88f3-4e60-9127-16a9a2b3dade",
|
||||
"name": "Insta-Webhook",
|
||||
"webhookId": "fc68db76-1651-4716-8170-dcda36aa4a5d"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"action": "hmac",
|
||||
"binaryData": true,
|
||||
"type": "SHA256",
|
||||
"dataPropertyName": "computed-sha256",
|
||||
"secret": "af19006e69ba95eb398f68a614a5c861"
|
||||
},
|
||||
"type": "n8n-nodes-base.crypto",
|
||||
"typeVersion": 1,
|
||||
"position": [
|
||||
-640,
|
||||
128
|
||||
],
|
||||
"id": "e09068d3-4397-4391-8854-20348c5a9007",
|
||||
"name": "x-hash-create",
|
||||
"alwaysOutputData": false
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"conditions": {
|
||||
"options": {
|
||||
"caseSensitive": true,
|
||||
"leftValue": "",
|
||||
"typeValidation": "strict",
|
||||
"version": 3
|
||||
},
|
||||
"conditions": [
|
||||
{
|
||||
"id": "376cee8d-570b-4f25-bd45-c349a23061ae",
|
||||
"leftValue": "={{ $json.headers['x-hub-signature-256'] }}",
|
||||
"rightValue": "={{ 'sha256=' + $json['computed-sha256'] }}",
|
||||
"operator": {
|
||||
"type": "string",
|
||||
"operation": "equals"
|
||||
}
|
||||
}
|
||||
],
|
||||
"combinator": "and"
|
||||
},
|
||||
"looseTypeValidation": "={{ false }}",
|
||||
"options": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.if",
|
||||
"typeVersion": 2.3,
|
||||
"position": [
|
||||
-480,
|
||||
32
|
||||
],
|
||||
"id": "cb9f2f49-dffa-4703-bee0-36404e1c622c",
|
||||
"name": "xhash-check"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"conditions": {
|
||||
"options": {
|
||||
"caseSensitive": true,
|
||||
"leftValue": "",
|
||||
"typeValidation": "strict",
|
||||
"version": 3
|
||||
},
|
||||
"conditions": [
|
||||
{
|
||||
"id": "abf63ae7-71ab-4b33-a3b5-d04b018b158a",
|
||||
"leftValue": "={{ $json.query['hub.mode'] }}",
|
||||
"rightValue": "subscribe",
|
||||
"operator": {
|
||||
"type": "string",
|
||||
"operation": "equals"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "89c602d5-d7b3-4cae-8bc1-9aa02ab2e0a7",
|
||||
"leftValue": "={{ $json.query['hub.verify_token'] }}",
|
||||
"rightValue": "kCSL6gd75nf8JQ6HH9c8#QfeYE!Ee!zH8Ci$",
|
||||
"operator": {
|
||||
"type": "string",
|
||||
"operation": "equals"
|
||||
}
|
||||
}
|
||||
],
|
||||
"combinator": "and"
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.if",
|
||||
"typeVersion": 2.3,
|
||||
"position": [
|
||||
-720,
|
||||
320
|
||||
],
|
||||
"id": "a1cdb5e0-631f-42a8-831c-fe51e574fe52",
|
||||
"name": "Subscribe check"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"respondWith": "text",
|
||||
"responseBody": "={{ $json.query['hub.challenge'] }}",
|
||||
"options": {
|
||||
"responseCode": 200
|
||||
}
|
||||
},
|
||||
"type": "n8n-nodes-base.respondToWebhook",
|
||||
"typeVersion": 1.5,
|
||||
"position": [
|
||||
-496,
|
||||
208
|
||||
],
|
||||
"id": "4a17f7d8-3764-4f61-9ef3-c29f2eecdb0f",
|
||||
"name": "subscribe respond"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"respondWith": "text",
|
||||
"responseBody": "return false",
|
||||
"options": {
|
||||
"responseCode": 400
|
||||
}
|
||||
},
|
||||
"type": "n8n-nodes-base.respondToWebhook",
|
||||
"typeVersion": 1.5,
|
||||
"position": [
|
||||
-496,
|
||||
384
|
||||
],
|
||||
"id": "35564549-82a2-4374-9d4f-97d2565516f4",
|
||||
"name": "subscribe error"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"conditions": {
|
||||
"options": {
|
||||
"caseSensitive": true,
|
||||
"leftValue": "",
|
||||
"typeValidation": "strict",
|
||||
"version": 3
|
||||
},
|
||||
"conditions": [
|
||||
{
|
||||
"id": "d494455e-0ca8-430e-9d76-496d5d5762e5",
|
||||
"leftValue": "={{ $json.body.entry[0].changes[0].value.from.username }}",
|
||||
"rightValue": "plantbasedsoutherner",
|
||||
"operator": {
|
||||
"type": "string",
|
||||
"operation": "equals",
|
||||
"name": "filter.operator.equals"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "8aba4377-943a-4f4d-a74f-8d0411c30b24",
|
||||
"leftValue": "={{ $json.body.entry[0].changes[0].value.from.id }}",
|
||||
"rightValue": "178414703386961181",
|
||||
"operator": {
|
||||
"type": "string",
|
||||
"operation": "equals",
|
||||
"name": "filter.operator.equals"
|
||||
}
|
||||
}
|
||||
],
|
||||
"combinator": "or"
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.if",
|
||||
"typeVersion": 2.3,
|
||||
"position": [
|
||||
192,
|
||||
-80
|
||||
],
|
||||
"id": "9e2e6790-95f4-4d7d-913b-749a01f2c890",
|
||||
"name": "Check if we sent"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"method": "POST",
|
||||
"url": "https://n8n.staging.plantbasedsoutherner.com/webhook/staging-test",
|
||||
"sendBody": true,
|
||||
"specifyBody": "json",
|
||||
"jsonBody": "={\n \"title\": \"Subscribe Message ⚠️\",\n \"message\": \"Failed to subscribed to FB webook. Check FB workflow.\",\n \"timestamp\": \"{{ $now.toFormat('MMM dd, HH:mm:ss') }}\"\n}",
|
||||
"options": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"typeVersion": 4.3,
|
||||
"position": [
|
||||
224,
|
||||
448
|
||||
],
|
||||
"id": "949aa0db-3592-4bcf-82e7-6cafa8de4759",
|
||||
"name": "subscribe to FB error"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"mode": "raw",
|
||||
"jsonOutput": "={\n \"webhook_payload\": {{ $('Insta-Webhook').first().json }}\n} ",
|
||||
"includeOtherFields": "={{ false }}",
|
||||
"options": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.set",
|
||||
"typeVersion": 3.4,
|
||||
"position": [
|
||||
416,
|
||||
-80
|
||||
],
|
||||
"id": "217a3ba7-da03-42cb-ad0c-70bba8237498",
|
||||
"name": "Edit Fields"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"method": "POST",
|
||||
"url": "https://n8n.staging.plantbasedsoutherner.com/webhook/staging-test",
|
||||
"sendBody": true,
|
||||
"specifyBody": "json",
|
||||
"jsonBody": "={\n \"title\": \"Subscribe Message 🏁\",\n \"message\": \"Successfully subscribed to FB webook. No error message here.\",\n \"timestamp\": \"{{ $now.toFormat('MMM dd, HH:mm:ss') }}\"\n}",
|
||||
"options": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"typeVersion": 4.3,
|
||||
"position": [
|
||||
224,
|
||||
272
|
||||
],
|
||||
"id": "cea660ef-fc75-4ed9-90b4-2c02e005029d",
|
||||
"name": "subscribe to FB success"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"method": "POST",
|
||||
"url": "https://n8n.staging.plantbasedsoutherner.com/webhook/staging-test",
|
||||
"sendBody": true,
|
||||
"specifyBody": "json",
|
||||
"jsonBody": "={\n \"title\": \"⛔ Hash Verification FAILED\",\n \"message\": \"Incoming webhook failed signature check. Possible spoofed or malicious request. Check n8n logs immediately.\",\n \"timestamp\": \"{{ $now.toFormat('MMM dd, HH:mm:ss') }}\",\n \"space\": \"insta\"\n}",
|
||||
"options": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"typeVersion": 4.3,
|
||||
"position": [
|
||||
224,
|
||||
96
|
||||
],
|
||||
"id": "f691fdf0-f1af-4b87-9c64-942c500035e6",
|
||||
"name": "xhash error"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"conditions": {
|
||||
"options": {
|
||||
"caseSensitive": true,
|
||||
"leftValue": "",
|
||||
"typeValidation": "strict",
|
||||
"version": 3
|
||||
},
|
||||
"conditions": [
|
||||
{
|
||||
"id": "12b4e16f-03b5-46c5-a2a6-59c06a584bae",
|
||||
"leftValue": "={{ $json.body.entry[0].messaging?.[0]?.message?.is_echo === true }}",
|
||||
"rightValue": "",
|
||||
"operator": {
|
||||
"type": "boolean",
|
||||
"operation": "true",
|
||||
"singleValue": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"combinator": "and"
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.if",
|
||||
"typeVersion": 2.3,
|
||||
"position": [
|
||||
-288,
|
||||
-112
|
||||
],
|
||||
"id": "784bd9c7-7066-4fd0-9653-3a54ca7c2ea4",
|
||||
"name": "Check_Echo"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"conditions": {
|
||||
"options": {
|
||||
"caseSensitive": true,
|
||||
"leftValue": "",
|
||||
"typeValidation": "strict",
|
||||
"version": 3
|
||||
},
|
||||
"conditions": [
|
||||
{
|
||||
"id": "cbf36acb-c894-4aeb-9c48-cedfce0b75f9",
|
||||
"leftValue": "={{ $json.body.entry[0].messaging?.[0]?.read !== undefined }}",
|
||||
"rightValue": "",
|
||||
"operator": {
|
||||
"type": "boolean",
|
||||
"operation": "true",
|
||||
"singleValue": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"combinator": "and"
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.if",
|
||||
"typeVersion": 2.3,
|
||||
"position": [
|
||||
-64,
|
||||
-96
|
||||
],
|
||||
"id": "949f370d-7ecb-4484-a002-851e8942461a",
|
||||
"name": "Check_Read"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"mode": "raw",
|
||||
"jsonOutput": "={\n \"title\": \"Subscribe Message 🏁\",\n \"message\": \"Successfully subscribed to FB webook. No error message here.\",\n \"timestamp\": \"{{ $now.toFormat('MMM dd, HH:mm:ss') }}\"\n}",
|
||||
"options": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.set",
|
||||
"typeVersion": 3.4,
|
||||
"position": [
|
||||
-288,
|
||||
208
|
||||
],
|
||||
"id": "31f3cfaa-a335-4a13-ae83-600676a6d218",
|
||||
"name": "set_sub_FB_success"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"mode": "raw",
|
||||
"jsonOutput": "={\n \"title\": \"Subscribe Message ⚠️\",\n \"message\": \"Failed to subscribed to FB webook. Check FB workflow.\",\n \"timestamp\": \"{{ $now.toFormat('MMM dd, HH:mm:ss') }}\"\n}",
|
||||
"options": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.set",
|
||||
"typeVersion": 3.4,
|
||||
"position": [
|
||||
-304,
|
||||
400
|
||||
],
|
||||
"id": "104205c9-3fbc-4685-98ea-a53b5dbfbdeb",
|
||||
"name": "set_sub_FB_error"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"mode": "raw",
|
||||
"jsonOutput": "={\n \"title\": \"⛔ Hash Verification FAILED\",\n \"message\": \"Incoming webhook failed signature check. Possible spoofed or malicious request. Check n8n logs immediately.\",\n \"timestamp\": \"{{ $now.toFormat('MMM dd, HH:mm:ss') }}\",\n \"space\": \"insta\"\n}",
|
||||
"options": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.set",
|
||||
"typeVersion": 3.4,
|
||||
"position": [
|
||||
-272,
|
||||
48
|
||||
],
|
||||
"id": "3f7d7b11-b9db-4c15-a3a1-234bfd6d7b76",
|
||||
"name": "set_xhash_error"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"workflowId": {
|
||||
"__rl": true,
|
||||
"value": "P465jEMJyKNZGOHVppbv2",
|
||||
"mode": "list",
|
||||
"cachedResultUrl": "/workflow/P465jEMJyKNZGOHVppbv2",
|
||||
"cachedResultName": "SendPBSChat_New"
|
||||
},
|
||||
"workflowInputs": {
|
||||
"mappingMode": "defineBelow",
|
||||
"value": {},
|
||||
"matchingColumns": [],
|
||||
"schema": [],
|
||||
"attemptToConvertTypes": false,
|
||||
"convertFieldsToString": true
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.executeWorkflow",
|
||||
"typeVersion": 1.3,
|
||||
"position": [
|
||||
-32,
|
||||
208
|
||||
],
|
||||
"id": "edc9675f-f48b-4add-99a9-6cccb3738413",
|
||||
"name": "Call 'SendPBSChat_New'"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"workflowId": {
|
||||
"__rl": true,
|
||||
"value": "gtosD7EYCQQ8JoqOaLtUA",
|
||||
"mode": "list",
|
||||
"cachedResultUrl": "/workflow/gtosD7EYCQQ8JoqOaLtUA",
|
||||
"cachedResultName": "Sub-instra-reply-handle-new"
|
||||
},
|
||||
"workflowInputs": {
|
||||
"mappingMode": "defineBelow",
|
||||
"value": {},
|
||||
"matchingColumns": [],
|
||||
"schema": [],
|
||||
"attemptToConvertTypes": false,
|
||||
"convertFieldsToString": true
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.executeWorkflow",
|
||||
"typeVersion": 1.3,
|
||||
"position": [
|
||||
592,
|
||||
-80
|
||||
],
|
||||
"id": "eeef03ce-52f6-4989-8820-c53649adc6cf",
|
||||
"name": "Call 'Sub-instra-reply-handle-new'"
|
||||
}
|
||||
],
|
||||
"pinData": {
|
||||
"subscribe error": [
|
||||
{
|
||||
"json": {
|
||||
"name": "First item",
|
||||
"code": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"json": {
|
||||
"name": "Second item",
|
||||
"code": 2
|
||||
}
|
||||
}
|
||||
],
|
||||
"Insta-Webhook": [
|
||||
{
|
||||
"json": {
|
||||
"headers": {
|
||||
"host": "n8n.plantbasedsoutherner.com",
|
||||
"user-agent": "Webhooks/1.0 (https://fb.me/webhooks)",
|
||||
"content-length": "301",
|
||||
"accept": "*/*",
|
||||
"content-type": "application/json",
|
||||
"origin": "https://n8n.plantbasedsoutherner.com",
|
||||
"x-forwarded-for": "173.252.95.114",
|
||||
"x-forwarded-host": "n8n.plantbasedsoutherner.com",
|
||||
"x-forwarded-port": "443",
|
||||
"x-forwarded-proto": "https",
|
||||
"x-forwarded-server": "874112b5743e",
|
||||
"x-hub-signature": "sha1=eca2b4e1b17b6fe27c338c49e7f7fa58943f2d5c",
|
||||
"x-hub-signature-256": "sha256=f428f52a183d49ce5df8773907b1da186c45d9c8d5e43b207fb434f0e978c95f",
|
||||
"x-real-ip": "173.252.95.114",
|
||||
"accept-encoding": "gzip"
|
||||
},
|
||||
"params": {},
|
||||
"query": {},
|
||||
"body": {
|
||||
"entry": [
|
||||
{
|
||||
"id": "17841470338696118",
|
||||
"time": 1775170323,
|
||||
"changes": [
|
||||
{
|
||||
"value": {
|
||||
"from": {
|
||||
"id": "2132711740817216",
|
||||
"username": "tjherby"
|
||||
},
|
||||
"media": {
|
||||
"id": "18318289864268976",
|
||||
"media_product_type": "REELS"
|
||||
},
|
||||
"id": "17913212886344579",
|
||||
"text": "bowl"
|
||||
},
|
||||
"field": "comments"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"object": "instagram"
|
||||
},
|
||||
"webhookUrl": "https://n8n.plantbasedsoutherner.com/webhook/pi37K-qE4hpB-ncEGa5ph-BYoFD-fTBjmtc",
|
||||
"executionMode": "production"
|
||||
},
|
||||
"binary": {
|
||||
"data": {
|
||||
"data": "eyJlbnRyeSI6IFt7ImlkIjogIjE3ODQxNDcwMzM4Njk2MTE4IiwgInRpbWUiOiAxNzc1MTcwMzIzLCAiY2hhbmdlcyI6IFt7InZhbHVlIjogeyJmcm9tIjogeyJpZCI6ICIyMTMyNzExNzQwODE3MjE2IiwgInVzZXJuYW1lIjogInRqaGVyYnkifSwgIm1lZGlhIjogeyJpZCI6ICIxODMxODI4OTg2NDI2ODk3NiIsICJtZWRpYV9wcm9kdWN0X3R5cGUiOiAiUkVFTFMifSwgImlkIjogIjE3OTEzMjEyODg2MzQ0NTc5IiwgInRleHQiOiAiYm93bCJ9LCAiZmllbGQiOiAiY29tbWVudHMifV19XSwgIm9iamVjdCI6ICJpbnN0YWdyYW0ifQ==",
|
||||
"mimeType": "application/json"
|
||||
}
|
||||
},
|
||||
"pairedItem": {
|
||||
"item": 0
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"connections": {
|
||||
"Insta-Webhook": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "x-hash-create",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "Subscribe check",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"x-hash-create": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "xhash-check",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"xhash-check": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Check_Echo",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "set_xhash_error",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Subscribe check": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "subscribe respond",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "subscribe error",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"subscribe respond": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "set_sub_FB_success",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"subscribe error": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "set_sub_FB_error",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Check if we sent": {
|
||||
"main": [
|
||||
[],
|
||||
[
|
||||
{
|
||||
"node": "Edit Fields",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Edit Fields": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Call 'Sub-instra-reply-handle-new'",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Check_Echo": {
|
||||
"main": [
|
||||
[],
|
||||
[
|
||||
{
|
||||
"node": "Check_Read",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Check_Read": {
|
||||
"main": [
|
||||
[],
|
||||
[
|
||||
{
|
||||
"node": "Check if we sent",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"set_sub_FB_success": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Call 'SendPBSChat_New'",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"set_sub_FB_error": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Call 'SendPBSChat_New'",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"set_xhash_error": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Call 'SendPBSChat_New'",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"active": true,
|
||||
"settings": {
|
||||
"executionOrder": "v1",
|
||||
"availableInMCP": false
|
||||
},
|
||||
"versionId": "ebdd7e2c-8f3a-4005-8aff-8e31926265f4",
|
||||
"meta": {
|
||||
"instanceId": "eeb18e777509f7207ee9abd45845e7fbf014989719160f3ed6ae633d872bf6c4"
|
||||
},
|
||||
"id": "6LYoDb7YmZdo1XyqcqB8n",
|
||||
"tags": []
|
||||
}
|
||||
951
instra-reel-cache-new.json
Normal file
951
instra-reel-cache-new.json
Normal file
@ -0,0 +1,951 @@
|
||||
{
|
||||
"name": "instra-reel-cache-new",
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {},
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"typeVersion": 1,
|
||||
"position": [
|
||||
-1488,
|
||||
672
|
||||
],
|
||||
"id": "8c7dbb5f-85e3-4ae4-90ad-4bb5aa9893c2",
|
||||
"name": "When clicking ‘Execute workflow’"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"url": "https://graph.facebook.com/v24.0/17841470338696118/media?fields=id,caption,timestamp,comments_count&limit=5",
|
||||
"authentication": "genericCredentialType",
|
||||
"genericAuthType": "httpBearerAuth",
|
||||
"options": {
|
||||
"pagination": {
|
||||
"pagination": {
|
||||
"paginationMode": "responseContainsNextURL",
|
||||
"nextURL": "={{ $response.body.paging?.next }}",
|
||||
"limitPagesFetched": true,
|
||||
"maxRequests": 6
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"typeVersion": 4.3,
|
||||
"position": [
|
||||
-1280,
|
||||
672
|
||||
],
|
||||
"id": "f8854bba-7869-435c-800c-56b9b80d0053",
|
||||
"name": "Call FB to get the last posts",
|
||||
"credentials": {
|
||||
"httpHeaderAuth": {
|
||||
"id": "bU1D0djQYelYC4km",
|
||||
"name": "gitea-auth"
|
||||
},
|
||||
"httpQueryAuth": {
|
||||
"id": "9poWzM5erRyAfM1e",
|
||||
"name": "Query Auth account"
|
||||
},
|
||||
"httpBearerAuth": {
|
||||
"id": "zdT0ctdFDyJPrO8I",
|
||||
"name": "fb-auth"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"options": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.splitInBatches",
|
||||
"typeVersion": 3,
|
||||
"position": [
|
||||
-416,
|
||||
80
|
||||
],
|
||||
"id": "7e606a6c-87cf-405e-bc84-bc1691a96437",
|
||||
"name": "Loop Over Items"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"operation": "select",
|
||||
"table": {
|
||||
"__rl": true,
|
||||
"value": "pbs_recipes",
|
||||
"mode": "list",
|
||||
"cachedResultName": "pbs_recipes"
|
||||
},
|
||||
"where": {
|
||||
"values": [
|
||||
{
|
||||
"column": "post_id",
|
||||
"value": "={{ $json.wp_post_id}}"
|
||||
}
|
||||
]
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.mySql",
|
||||
"typeVersion": 2.5,
|
||||
"position": [
|
||||
-208,
|
||||
176
|
||||
],
|
||||
"id": "62a933b5-1827-4519-b2d3-1b7e8c7b6a92",
|
||||
"name": "qry_pbs_recipe",
|
||||
"alwaysOutputData": true,
|
||||
"credentials": {
|
||||
"mySql": {
|
||||
"id": "4ETlVumrAq95ispJ",
|
||||
"name": "MySQL account"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"method": "POST",
|
||||
"url": "https://n8n.plantbasedsoutherner.com/webhook/staging-test",
|
||||
"sendBody": true,
|
||||
"bodyParameters": {
|
||||
"parameters": [
|
||||
{
|
||||
"name": "title",
|
||||
"value": "={{ \"done processing all records\" }}"
|
||||
},
|
||||
{
|
||||
"name": "message",
|
||||
"value": "={{ \"Done\"}}"
|
||||
},
|
||||
{
|
||||
"name": "timestamp",
|
||||
"value": "={{ $now.toFormat('MMM dd, HH:mm:ss') }}"
|
||||
}
|
||||
]
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"typeVersion": 4.3,
|
||||
"position": [
|
||||
-240,
|
||||
-272
|
||||
],
|
||||
"id": "46658896-024e-416b-83d9-1e67fc8f95d2",
|
||||
"name": "done processing message",
|
||||
"executeOnce": true
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"inputSource": "passthrough"
|
||||
},
|
||||
"type": "n8n-nodes-base.executeWorkflowTrigger",
|
||||
"typeVersion": 1.1,
|
||||
"position": [
|
||||
-1488,
|
||||
496
|
||||
],
|
||||
"id": "9fbc8d44-b972-4371-97a0-da0aa234a5ae",
|
||||
"name": "Enter_Cache_Update"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"assignments": {
|
||||
"assignments": [
|
||||
{
|
||||
"id": "7452a3be-7224-49c1-9daa-2f2fecb1bd8d",
|
||||
"name": "data",
|
||||
"value": "= {{ $json.data }}",
|
||||
"type": "array"
|
||||
}
|
||||
]
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.set",
|
||||
"typeVersion": 3.4,
|
||||
"position": [
|
||||
368,
|
||||
944
|
||||
],
|
||||
"id": "cf6c197e-65e7-44bf-9298-25328baf3d6c",
|
||||
"name": "Set_FB_Data"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"jsCode": "// This processes each post as a separate item\n// You have 5 items, each with a data array\nconst allPages = $input.all();\n\n// Flatten all data arrays into one big array\nconst allPosts = allPages.flatMap(page => {\n const posts = page.json.data || [];\n return posts;\n});\n\n\n// Return as separate items\nreturn allPosts.map(post => ({\n json: {\n postID: post.id,\n caption: post.caption || '',\n timestamp: post.timestamp\n }\n}));"
|
||||
},
|
||||
"type": "n8n-nodes-base.code",
|
||||
"typeVersion": 2,
|
||||
"position": [
|
||||
-880,
|
||||
544
|
||||
],
|
||||
"id": "d9b6791d-d256-4a21-8ab8-a7abe829e681",
|
||||
"name": "JS_Post_Info"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"jsCode": "//set the static data for later\nconst staticData = $getWorkflowStaticData('global');\nstaticData.success = true;\nstaticData.reason = 'na';\n\n// Process each Instagram post\nconst outputItems = [];\n\nfor (const item of $input.all()) {\n const caption = item.json.caption || '';\n const postId = String(item.json.postID);\n \n // Extract keyword - handle smart quotes too\n const keywordMatch = caption.match(/comment\\s*[:\"'\"\"']?\\s*(\\w+)/i);\n const keyword = keywordMatch ? keywordMatch[1].toLowerCase() : null;\n \n // Extract WordPress post ID\n const wpPostIdMatch = caption.match(/ID\\s*:?\\s*(\\d+)/i);\n const wpPostId = wpPostIdMatch ? parseInt(wpPostIdMatch[1]) : null;\n \n outputItems.push({\n json: {\n ...item.json, // spread first\n instagram_post_id: postId, // then your explicit fields win\n instagram_caption: caption,\n keyword: keyword,\n wp_post_id: wpPostId,\n }\n });\n}\n\nreturn outputItems;"
|
||||
},
|
||||
"type": "n8n-nodes-base.code",
|
||||
"typeVersion": 2,
|
||||
"position": [
|
||||
-672,
|
||||
544
|
||||
],
|
||||
"id": "60e7af66-0113-4699-9cec-f07715b36d98",
|
||||
"name": "JS_Code_and_keyword"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"operation": "executeQuery",
|
||||
"query": "INSERT INTO instagram_posts (reel_id, pbs_post_id, instagram_caption)\nVALUES (CAST($1 AS CHAR), $2, $3)\nON DUPLICATE KEY UPDATE\n reel_id = VALUES(reel_id),\n pbs_post_id = COALESCE(pbs_post_id, VALUES(pbs_post_id)),\n instagram_caption = VALUES(instagram_caption);\n",
|
||||
"options": {
|
||||
"queryReplacement": "={{ [$('JS_Code_and_keyword').item.json.postID + '',$('JS_Code_and_keyword').item.json.wp_post_id, $('JS_Code_and_keyword').item.json.caption] }}"
|
||||
}
|
||||
},
|
||||
"type": "n8n-nodes-base.mySql",
|
||||
"typeVersion": 2.5,
|
||||
"position": [
|
||||
352,
|
||||
752
|
||||
],
|
||||
"id": "309e1185-1954-47b3-8a71-ca876e1ff9e7",
|
||||
"name": "SQL_Up_Insta_Table",
|
||||
"credentials": {
|
||||
"mySql": {
|
||||
"id": "4ETlVumrAq95ispJ",
|
||||
"name": "MySQL account"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"jsCode": "const staticData = $getWorkflowStaticData('global');\nstaticData.success = false;\nstaticData.reason = 'Failed to get pbs_recipe data';\n\nreturn $input.all();"
|
||||
},
|
||||
"type": "n8n-nodes-base.code",
|
||||
"typeVersion": 2,
|
||||
"position": [
|
||||
160,
|
||||
304
|
||||
],
|
||||
"id": "8124c58d-e55e-435d-99e5-567fffafa8c4",
|
||||
"name": "JS_Set_Failure"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"conditions": {
|
||||
"options": {
|
||||
"caseSensitive": true,
|
||||
"leftValue": "",
|
||||
"typeValidation": "strict",
|
||||
"version": 3
|
||||
},
|
||||
"conditions": [
|
||||
{
|
||||
"id": "bba2d400-e5c7-43f2-8a54-f9efe80e91a9",
|
||||
"leftValue": "={{ $('qry_pbs_recipe').first().json.id }}",
|
||||
"rightValue": "",
|
||||
"operator": {
|
||||
"type": "number",
|
||||
"operation": "exists",
|
||||
"singleValue": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"combinator": "and"
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.if",
|
||||
"typeVersion": 2.3,
|
||||
"position": [
|
||||
-48,
|
||||
176
|
||||
],
|
||||
"id": "b3d35905-05f6-474c-865a-d3950866ae3b",
|
||||
"name": "Check_Data_Return"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"jsCode": "return [{\n json: { \n data : [\n {\n webhook_payload: $input.first().json.webhook_payload,\n id: String($input.first().json.resolved_media_id || $input.first().json.postID),\n caption: $input.first().json.caption || '',\n timestamp: $input.first().json.timestamp\n }\n ]\n }\n}];"
|
||||
},
|
||||
"type": "n8n-nodes-base.code",
|
||||
"typeVersion": 2,
|
||||
"position": [
|
||||
-1280,
|
||||
496
|
||||
],
|
||||
"id": "dcf1617a-829a-40c8-931f-4db9bc5aad73",
|
||||
"name": "Set_Reply_Data"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"operation": "executeQuery",
|
||||
"query": "INSERT INTO platform_posts (platform_post_id, pbs_post_id, caption)\nVALUES ('{{ $('JS_Code_and_keyword').item.json.postID }}', $1, $2)\nON DUPLICATE KEY UPDATE\n platform_post_id = VALUES(platform_post_id),\n pbs_post_id = COALESCE(pbs_post_id, VALUES(pbs_post_id)),\n caption = VALUES(caption);",
|
||||
"options": {
|
||||
"queryReplacement": "={{ [ $('JS_Code_and_keyword').item.json.wp_post_id , $('JS_Code_and_keyword').item.json.caption ] }}"
|
||||
}
|
||||
},
|
||||
"type": "n8n-nodes-base.mySql",
|
||||
"typeVersion": 2.5,
|
||||
"position": [
|
||||
1328,
|
||||
192
|
||||
],
|
||||
"id": "85a47b95-f4a6-4034-bc79-18e338272b93",
|
||||
"name": "SQL_Up_Insta_Table1",
|
||||
"credentials": {
|
||||
"mySql": {
|
||||
"id": "4ETlVumrAq95ispJ",
|
||||
"name": "MySQL account"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"jsCode": "const staticData = $getWorkflowStaticData('global');\n\nreturn [{\n json: {\n success: staticData.success,\n reason: staticData.reason || ''\n }\n}];"
|
||||
},
|
||||
"type": "n8n-nodes-base.code",
|
||||
"typeVersion": 2,
|
||||
"position": [
|
||||
208,
|
||||
-32
|
||||
],
|
||||
"id": "2122a727-fd72-48e4-af76-d56f277a6f77",
|
||||
"name": "Set_Return"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"conditions": {
|
||||
"options": {
|
||||
"caseSensitive": true,
|
||||
"leftValue": "",
|
||||
"typeValidation": "strict",
|
||||
"version": 3
|
||||
},
|
||||
"conditions": [
|
||||
{
|
||||
"id": "cf2c90a9-1ce0-48b1-8e5b-c15aabd56a8d",
|
||||
"leftValue": "={{ $('Loop Over Items').item.json.wp_post_id }}",
|
||||
"rightValue": 0,
|
||||
"operator": {
|
||||
"type": "number",
|
||||
"operation": "empty",
|
||||
"singleValue": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"combinator": "and"
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.if",
|
||||
"typeVersion": 2.3,
|
||||
"position": [
|
||||
352,
|
||||
304
|
||||
],
|
||||
"id": "1185f0f7-94c9-4a63-b22d-92b263371ac0",
|
||||
"name": "Check_Null_ID"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"method": "POST",
|
||||
"url": "https://n8n.staging.plantbasedsoutherner.com/webhook/staging-test",
|
||||
"sendBody": true,
|
||||
"bodyParameters": {
|
||||
"parameters": [
|
||||
{
|
||||
"name": "title",
|
||||
"value": "🚨Update Insta Data Error 🚨"
|
||||
},
|
||||
{
|
||||
"name": "message",
|
||||
"value": "={{ \"This post contains an IMPROPER PBS_ID!\\n\\nReel ID: \" + $('Loop Over Items').item.json.postID + \"\\nKeyword: \" + $('Loop Over Items').item.json.keyword + \"\\nCaption: \" + $('Loop Over Items').item.json.caption }}"
|
||||
},
|
||||
{
|
||||
"name": "timestamp",
|
||||
"value": "={{ $now.toFormat('MMM dd, HH:mm:ss') }}"
|
||||
}
|
||||
]
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"typeVersion": 4.3,
|
||||
"position": [
|
||||
672,
|
||||
736
|
||||
],
|
||||
"id": "93a74a09-ecf4-4a32-a335-4f5855ba1d43",
|
||||
"name": "Send_FK_Error_Msg"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"conditions": {
|
||||
"options": {
|
||||
"caseSensitive": true,
|
||||
"leftValue": "",
|
||||
"typeValidation": "strict",
|
||||
"version": 3
|
||||
},
|
||||
"conditions": [
|
||||
{
|
||||
"id": "14429cfd-1430-445e-a96a-f8ebeafe3059",
|
||||
"leftValue": "={{ $json.id }}",
|
||||
"rightValue": "",
|
||||
"operator": {
|
||||
"type": "number",
|
||||
"operation": "exists",
|
||||
"singleValue": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"combinator": "and"
|
||||
},
|
||||
"looseTypeValidation": "={{ false }}",
|
||||
"options": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.if",
|
||||
"typeVersion": 2.3,
|
||||
"position": [
|
||||
752,
|
||||
256
|
||||
],
|
||||
"id": "04e3c5f9-7ad3-4862-8287-7ec2ea728c80",
|
||||
"name": "Check_Insta_Exists"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"method": "POST",
|
||||
"url": "https://n8n.staging.plantbasedsoutherner.com/webhook/staging-test",
|
||||
"sendBody": true,
|
||||
"bodyParameters": {
|
||||
"parameters": [
|
||||
{
|
||||
"name": "title",
|
||||
"value": "Update Insta Data Problem ⚠️"
|
||||
},
|
||||
{
|
||||
"name": "message",
|
||||
"value": "={{ \"This post did not contain a pbs_ID!\\n\\nReel ID: \" + $('Loop Over Items').item.json.postID + \"\\nKeyword: \" + $('Loop Over Items').item.json.keyword + \"\\nCaption: \" + $('Loop Over Items').item.json.caption }}"
|
||||
},
|
||||
{
|
||||
"name": "timestamp",
|
||||
"value": "={{ $now.toFormat('MMM dd, HH:mm:ss') }}"
|
||||
}
|
||||
]
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"typeVersion": 4.3,
|
||||
"position": [
|
||||
656,
|
||||
928
|
||||
],
|
||||
"id": "6ad9c0af-0d4a-40f5-b50b-a591c81ffbac",
|
||||
"name": "Send_No_ID_Msg"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"operation": "select",
|
||||
"table": {
|
||||
"__rl": true,
|
||||
"value": "platform_posts",
|
||||
"mode": "list",
|
||||
"cachedResultName": "platform_posts"
|
||||
},
|
||||
"where": {
|
||||
"values": [
|
||||
{
|
||||
"column": "platform_post_id",
|
||||
"value": "={{ $('Loop Over Items').item.json.postID }}"
|
||||
}
|
||||
]
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.mySql",
|
||||
"typeVersion": 2.5,
|
||||
"position": [
|
||||
544,
|
||||
256
|
||||
],
|
||||
"id": "9ff48ff9-58c9-4bb2-8912-554d4f6c24a1",
|
||||
"name": "qry_Insta_Data",
|
||||
"alwaysOutputData": true,
|
||||
"credentials": {
|
||||
"mySql": {
|
||||
"id": "4ETlVumrAq95ispJ",
|
||||
"name": "MySQL account"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"mode": "raw",
|
||||
"jsonOutput": "={ \n \"title\": \"Update Insta Data Problem ⚠️\",\n \"message\": \"{{ 'This post contains an IMPROPER PBS_ID!\\n\\nReel ID: ' + $('Loop Over Items').item.json.postID + '\\nKeyword: ' + $('Loop Over Items').item.json.keyword + '\\nCaption: ' + $('Loop Over Items').item.json.caption }}\",\n \"space\": \"automation\",\n \"timestamp\": \"{{ $now.toFormat('MMM dd, HH:mm:ss') }}\"\n}",
|
||||
"options": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.set",
|
||||
"typeVersion": 3.4,
|
||||
"position": [
|
||||
688,
|
||||
480
|
||||
],
|
||||
"id": "b0e95fe0-bf50-4bb2-8dbf-4aa9d04f57bf",
|
||||
"name": "set_Send_FK_Error_Msg"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"workflowId": {
|
||||
"__rl": true,
|
||||
"value": "P465jEMJyKNZGOHVppbv2",
|
||||
"mode": "list",
|
||||
"cachedResultUrl": "/workflow/P465jEMJyKNZGOHVppbv2",
|
||||
"cachedResultName": "SendPBSChat_New"
|
||||
},
|
||||
"workflowInputs": {
|
||||
"mappingMode": "defineBelow",
|
||||
"value": {},
|
||||
"matchingColumns": [],
|
||||
"schema": [],
|
||||
"attemptToConvertTypes": false,
|
||||
"convertFieldsToString": true
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.executeWorkflow",
|
||||
"typeVersion": 1.3,
|
||||
"position": [
|
||||
880,
|
||||
480
|
||||
],
|
||||
"id": "dcb5a7fd-11e7-4efb-ac6b-6d0356c471fc",
|
||||
"name": "Call_Send_FK_Error_Msg"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"mode": "raw",
|
||||
"jsonOutput": "={ \n \"title\": \"Update Insta Data Problem ⚠️\",\n \"message\": \"{{\"This post did not contain a pbs_ID!\\n\\nReel ID: \" + $('Loop Over Items').item.json.postID + \"\\nKeyword: \" + $('Loop Over Items').item.json.keyword + \"\\nCaption: \" + $('Loop Over Items').item.json.caption }}\",\n \"space\": \"automation\",\n \"timestamp\": \"{{ $now.toFormat('MMM dd, HH:mm:ss') }}\"\n}",
|
||||
"includeOtherFields": "={{ false }}",
|
||||
"options": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.set",
|
||||
"typeVersion": 3.4,
|
||||
"position": [
|
||||
960,
|
||||
208
|
||||
],
|
||||
"id": "745e81ae-6c88-4069-a7c0-18767f055bbd",
|
||||
"name": "set_Send_No_ID_Msg"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"workflowId": {
|
||||
"__rl": true,
|
||||
"value": "P465jEMJyKNZGOHVppbv2",
|
||||
"mode": "list",
|
||||
"cachedResultUrl": "/workflow/P465jEMJyKNZGOHVppbv2",
|
||||
"cachedResultName": "SendPBSChat_New"
|
||||
},
|
||||
"workflowInputs": {
|
||||
"mappingMode": "defineBelow",
|
||||
"value": {},
|
||||
"matchingColumns": [],
|
||||
"schema": [],
|
||||
"attemptToConvertTypes": false,
|
||||
"convertFieldsToString": true
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.executeWorkflow",
|
||||
"typeVersion": 1.3,
|
||||
"position": [
|
||||
1152,
|
||||
208
|
||||
],
|
||||
"id": "1ac17c7e-6105-4541-816c-df116212405c",
|
||||
"name": "Call_Send_No_ID_Msg"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"workflowId": {
|
||||
"__rl": true,
|
||||
"value": "P465jEMJyKNZGOHVppbv2",
|
||||
"mode": "list",
|
||||
"cachedResultUrl": "/workflow/P465jEMJyKNZGOHVppbv2",
|
||||
"cachedResultName": "SendPBSChat_New"
|
||||
},
|
||||
"workflowInputs": {
|
||||
"mappingMode": "defineBelow",
|
||||
"value": {},
|
||||
"matchingColumns": [],
|
||||
"schema": [],
|
||||
"attemptToConvertTypes": false,
|
||||
"convertFieldsToString": true
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.executeWorkflow",
|
||||
"typeVersion": 1.3,
|
||||
"position": [
|
||||
-16,
|
||||
-32
|
||||
],
|
||||
"id": "56a2f297-371a-4e73-9ae9-5ae4b8cb3bf5",
|
||||
"name": "Call 'SendPBSChat_New'",
|
||||
"executeOnce": true
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"mode": "raw",
|
||||
"jsonOutput": "={\n \"title\": \"Done processing all records ✅\",\n \"message\": \"Updated Hub Content with new instagram posts.\"\n \"timestamp\": \"{{ $now.toFormat('MMM dd, HH:mm:ss') }}\",\n \"space\": \"automation\"\n}",
|
||||
"options": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.set",
|
||||
"typeVersion": 3.4,
|
||||
"position": [
|
||||
-192,
|
||||
-32
|
||||
],
|
||||
"id": "39857ac8-bbb0-40a4-88f0-1307ef13783b",
|
||||
"name": "set_pbs_update_success",
|
||||
"executeOnce": true
|
||||
}
|
||||
],
|
||||
"pinData": {
|
||||
"Enter_Cache_Update": [
|
||||
{
|
||||
"json": {
|
||||
"webhook_payload": {
|
||||
"headers": {
|
||||
"host": "n8n.plantbasedsoutherner.com",
|
||||
"user-agent": "Webhooks/1.0 (https://fb.me/webhooks)",
|
||||
"content-length": "305",
|
||||
"accept": "*/*",
|
||||
"content-type": "application/json",
|
||||
"origin": "https://n8n.plantbasedsoutherner.com",
|
||||
"x-forwarded-for": "173.252.95.57",
|
||||
"x-forwarded-host": "n8n.plantbasedsoutherner.com",
|
||||
"x-forwarded-port": "443",
|
||||
"x-forwarded-proto": "https",
|
||||
"x-forwarded-server": "874112b5743e",
|
||||
"x-hub-signature": "sha1=6e7fff130640ae3f922551d722fcaec4c13c7684",
|
||||
"x-hub-signature-256": "sha256=2aa0cbd4858e868b2ddc4a335f99dc1999d58c1fed5bfac81eb7b82ec7498f43",
|
||||
"x-real-ip": "173.252.95.57",
|
||||
"accept-encoding": "gzip"
|
||||
},
|
||||
"params": {},
|
||||
"query": {},
|
||||
"body": {
|
||||
"entry": [
|
||||
{
|
||||
"id": "17841470338696118",
|
||||
"time": 1775342848,
|
||||
"changes": [
|
||||
{
|
||||
"value": {
|
||||
"from": {
|
||||
"id": "26460101473680406",
|
||||
"username": "samdoucet"
|
||||
},
|
||||
"media": {
|
||||
"id": "18111441403805423",
|
||||
"media_product_type": "FEED"
|
||||
},
|
||||
"id": "18081936362075987",
|
||||
"text": "Easter"
|
||||
},
|
||||
"field": "comments"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"object": "instagram"
|
||||
},
|
||||
"webhookUrl": "https://n8n.plantbasedsoutherner.com/webhook/pi37K-qE4hpB-ncEGa5ph-BYoFD-fTBjmtc",
|
||||
"executionMode": "production"
|
||||
},
|
||||
"resolved_media_id": "18111441403805423",
|
||||
"instagram_caption": "Easter just got a whole lot easier 💛\n\nIf you’re anything like me, you want a table that feels cozy, familiar, and full without spending the whole day in the kitchen.\n\nSo I pulled together a full plant-based Southern Easter menu.\n\nThe kind of dishes that feel like home, just a little lighter: banana pudding, carrot cake, herby pasta salad, bright spring sides, and yes… biscuits.\n\nEverything you need, all in one place.\n\n✨ 👉👉Want the recipes + grocery list?\n\nComment EASTER and I’ll send it your way 💛\n\nFrom my kitchen to yours—Happy Easter, y’all 🌸\n\n#plantbased #eastermenu #southerncooking #Easter #vegancomfortfood",
|
||||
"reel_keyword": "easter",
|
||||
"reel_wp_post_id": null,
|
||||
"postID": "18111441403805423",
|
||||
"caption": "Easter just got a whole lot easier 💛\n\nIf you’re anything like me, you want a table that feels cozy, familiar, and full without spending the whole day in the kitchen.\n\nSo I pulled together a full plant-based Southern Easter menu.\n\nThe kind of dishes that feel like home, just a little lighter: banana pudding, carrot cake, herby pasta salad, bright spring sides, and yes… biscuits.\n\nEverything you need, all in one place.\n\n✨ 👉👉Want the recipes + grocery list?\n\nComment EASTER and I’ll send it your way 💛\n\nFrom my kitchen to yours—Happy Easter, y’all 🌸\n\n#plantbased #eastermenu #southerncooking #Easter #vegancomfortfood",
|
||||
"timestamp": "2026-04-03T23:14:45+0000"
|
||||
},
|
||||
"pairedItem": {
|
||||
"item": 0
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"connections": {
|
||||
"When clicking ‘Execute workflow’": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Call FB to get the last posts",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Call FB to get the last posts": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "JS_Post_Info",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Loop Over Items": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "set_pbs_update_success",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "qry_pbs_recipe",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"qry_pbs_recipe": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Check_Data_Return",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"done processing message": {
|
||||
"main": [
|
||||
[]
|
||||
]
|
||||
},
|
||||
"Enter_Cache_Update": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Set_Reply_Data",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"JS_Post_Info": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "JS_Code_and_keyword",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"JS_Code_and_keyword": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Loop Over Items",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"JS_Set_Failure": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Check_Null_ID",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Check_Data_Return": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "SQL_Up_Insta_Table1",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "JS_Set_Failure",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Set_Reply_Data": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "JS_Post_Info",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"SQL_Up_Insta_Table1": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Loop Over Items",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Check_Null_ID": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "qry_Insta_Data",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "set_Send_FK_Error_Msg",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Check_Insta_Exists": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Loop Over Items",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "set_Send_No_ID_Msg",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"qry_Insta_Data": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Check_Insta_Exists",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"set_Send_FK_Error_Msg": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Call_Send_FK_Error_Msg",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Call_Send_FK_Error_Msg": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Loop Over Items",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"set_Send_No_ID_Msg": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Call_Send_No_ID_Msg",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Call_Send_No_ID_Msg": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "SQL_Up_Insta_Table1",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"set_pbs_update_success": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Call 'SendPBSChat_New'",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Call 'SendPBSChat_New'": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Set_Return",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"active": true,
|
||||
"settings": {
|
||||
"executionOrder": "v1",
|
||||
"availableInMCP": false
|
||||
},
|
||||
"versionId": "3a99224f-f7da-40ed-b1de-2cd787c42150",
|
||||
"meta": {
|
||||
"templateCredsSetupCompleted": true,
|
||||
"instanceId": "eeb18e777509f7207ee9abd45845e7fbf014989719160f3ed6ae633d872bf6c4"
|
||||
},
|
||||
"id": "_bFiVQvN0skfuU6KlNtDO",
|
||||
"tags": []
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user