112 lines
3.5 KiB
JSON
112 lines
3.5 KiB
JSON
{
|
||
"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": []
|
||
} |