{ "nodes": [ { "name": "Send message", "type": "n8n-nodes-base.mattermost", "position": [ 910, 260 ], "parameters": { "message": "=New information was added to your Google Sheet.\nID: {{$json[\"id\"]}}\nName: {{$json[\"name\"]}}\nEmail: {{$json[\"email\"]}}", "attachments": [], "otherOptions": {}, "channelId": "YOUR_MATTERMOST_CHANNEL_ID" }, "typeVersion": 1, "id": "new-sheet-rows-to-mattermost-0" }, { "name": "Check if new data", "type": "n8n-nodes-base.function", "position": [ 710, 260 ], "parameters": { "functionCode": "const new_items = [];\n// Get static data stored with the workflow\n\nconst data = this.getWorkflowStaticData(\"node\");\ndata.ids = data.ids || [];\nfor (let i = items.length - 1; i >= 0; i--) {\n\n// Check if data is already present\n if (data.ids.includes(items[i].json.ID)) {\n break;\n } else {\n\n// if new data then add it to an array\n new_items.push({\n json: {\n id: items[i].json.ID,\n name: items[i].json.Name,\n email: items[i].json.Email\n },\n });\n }\n}\ndata.ids = items.map((item) => item.json.ID);\n\n// return new items\nreturn new_items;\n" }, "typeVersion": 1, "id": "new-sheet-rows-to-mattermost-1" }, { "name": "Read data", "type": "n8n-nodes-base.googleSheets", "position": [ 510, 260 ], "parameters": { "options": {}, "sheetId": "YOUR_SPREADSHEET_ID", "authentication": "oAuth2" }, "typeVersion": 1, "id": "new-sheet-rows-to-mattermost-2" }, { "name": "Execute every 45 mins", "type": "n8n-nodes-base.interval", "position": [ 310, 260 ], "parameters": { "unit": "minutes" }, "typeVersion": 1, "id": "new-sheet-rows-to-mattermost-3" } ], "connections": { "Read data": { "main": [ [ { "node": "Check if new data", "type": "main", "index": 0 } ] ] }, "Check if new data": { "main": [ [ { "node": "Send message", "type": "main", "index": 0 } ] ] }, "Execute every 45 mins": { "main": [ [ { "node": "Read data", "type": "main", "index": 0 } ] ] } }, "name": "New Google Sheet Rows to Mattermost", "active": false, "pinData": {} }