{ "name": "Suggest Inclusive Language in Mattermost", "nodes": [ { "name": "Webhook", "type": "n8n-nodes-base.webhook", "position": [ 150, 450 ], "parameters": { "httpMethod": "POST", "path": "suggest-inclusive-language-in-mattermost", "responseMode": "onReceived", "options": { "responseData": "{}", "responseContentType": "application/json" } }, "typeVersion": 1, "id": "suggest-inclusive-language-in-mattermost-0" }, { "id": "suggest-inclusive-language-in-mattermost-check", "name": "Check the message", "type": "n8n-nodes-base.code", "typeVersion": 2, "parameters": { "mode": "runOnceForEachItem", "jsCode": "function plan({body,token}) {\n if(typeof token!=='string'||!token||body?.token!==token)throw Error('Invalid Mattermost webhook token');\n if(typeof body?.channel_id!=='string'||!body.channel_id||typeof body?.text!=='string')throw Error('Invalid Mattermost event');\n const match=['guys','Guys','bros','Bros','dudes','Dudes','gals','Gals'].some(word=>body.text.includes(word));\n return {match,channelId:body.channel_id};\n}\n\nconst result=plan({body:$json.body,token:$env.MATTERMOST_OUTGOING_TOKEN});return result.match?{json:result}:null;" } }, { "name": "Mattermost1", "type": "n8n-nodes-base.mattermost", "position": [ 550, 300 ], "parameters": { "message": "May I suggest \"folks\" or โ€œy'allโ€? We use gender inclusive language here. ๐Ÿ˜„", "channelId": "={{ $json.channelId }}", "attachments": [], "otherOptions": {} }, "typeVersion": 1, "id": "suggest-inclusive-language-in-mattermost-1" } ], "active": false, "settings": {}, "connections": { "Webhook": { "main": [ [ { "node": "Check the message", "type": "main", "index": 0 } ] ] }, "Check the message": { "main": [ [ { "node": "Mattermost1", "type": "main", "index": 0 } ] ] } }, "pinData": {} }