{ "nodes": [ { "name": "Webhook", "type": "n8n-nodes-base.webhook", "position": [ 590, 400 ], "parameters": { "path": "mattermost-webhook-call-invite", "options": {}, "httpMethod": "POST" }, "typeVersion": 1, "id": "mattermost-webhook-call-invite-0" }, { "name": "Set", "type": "n8n-nodes-base.set", "position": [ 780, 400 ], "parameters": { "values": { "string": [ { "name": "YOUR_USER_NAME", "value": "YOUR_WHEREBY_ROOM" } ] }, "options": {}, "keepOnlySet": true }, "typeVersion": 1, "id": "mattermost-webhook-call-invite-1" }, { "name": "Mattermost", "type": "n8n-nodes-base.mattermost", "position": [ 990, 400 ], "parameters": { "message": "Join me in a video call:", "channelId": "={{$json.channelId}}", "attachments": [ { "title": "Join the video call", "title_link": "={{$json.roomUrl}}" } ], "otherOptions": {} }, "typeVersion": 1, "id": "mattermost-webhook-call-invite-2" }, { "id": "mattermost-webhook-call-invite-validate", "name": "Validate the username", "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [ 880, 400 ], "parameters": { "mode": "runOnceForEachItem", "jsCode": "const body = $('Webhook').item.json.body;\nconst name = body?.user_name;\nif (typeof name !== 'string' || !name || !Object.prototype.hasOwnProperty.call($json, name) || typeof $json[name] !== 'string' || !$json[name]) return null;\nreturn { json: { channelId: body.channel_id, roomUrl: 'https://whereby.com/' + $json[name] } };" } } ], "connections": { "Set": { "main": [ [ { "node": "Validate the username", "type": "main", "index": 0 } ] ] }, "Webhook": { "main": [ [ { "node": "Set", "type": "main", "index": 0 } ] ] }, "Validate the username": { "main": [ [ { "node": "Mattermost", "type": "main", "index": 0 } ] ] } }, "name": "Mattermost Webhook Call Invite", "settings": { "executionOrder": "v1", "saveManualExecutions": false, "retryOnFail": false, "retryCount": 0 }, "active": false, "pinData": {} }