{"record":{"id":"7b44e7544eb12504","repo":"RocketChat/Rocket.Chat","slug":"error-invalid-triggerwords","errorCode":"error-invalid-triggerWords","errorMessage":"Invalid triggerWords","messagePattern":"Invalid triggerWords","errorType":"validation","errorClass":"Meteor.Error","httpStatus":null,"severity":"error","filePath":"apps/meteor/server/lib/integrations/lib/validateOutgoingIntegration.ts","lineNumber":163,"sourceCode":"\tconst user = await Users.findOne({ username: integration.username });\n\n\tif (!user) {\n\t\tthrow new Meteor.Error('error-invalid-user', 'Invalid user (did you delete the `rocket.cat` user?)', { function: 'validateOutgoing' });\n\t}\n\n\tconst integrationData: IOutgoingIntegration = {\n\t\t...integration,\n\t\tscriptEngine: integration.scriptEngine ?? 'isolated-vm',\n\t\ttype: 'webhook-outgoing',\n\t\tchannel: channels,\n\t\tuserId: user._id,\n\t\t_createdAt: new Date(),\n\t\t_createdBy: await Users.findOne(userId, { projection: { username: 1 } }),\n\t};\n\n\tif (outgoingEvents[integration.event].use.triggerWords && integration.triggerWords) {\n\t\tif (!Match.test(integration.triggerWords, [String])) {\n\t\t\tthrow new Meteor.Error('error-invalid-triggerWords', 'Invalid triggerWords', {\n\t\t\t\tfunction: 'validateOutgoing',\n\t\t\t});\n\t\t}\n\n\t\tintegrationData.triggerWords = integration.triggerWords.filter((word) => word && word.trim() !== '');\n\t} else {\n\t\tdelete integrationData.triggerWords;\n\t}\n\n\t// Default to transpiling with Babel for backwards compatibility; integrations\n\t// can opt-out per-record by setting `skipTranspile: true` (removed in 9.0.0).\n\tconst skipTranspile = integration.skipTranspile === true;\n\tintegrationData.skipTranspile = skipTranspile;\n\n\tif (\n\t\t!isScriptEngineFrozen(integrationData.scriptEngine) &&\n\t\tintegration.scriptEnabled === true &&\n\t\tintegration.script &&","sourceCodeStart":145,"sourceCodeEnd":181,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0/apps/meteor/server/lib/integrations/lib/validateOutgoingIntegration.ts#L145-L181","documentation":"Thrown in validateOutgoing when the event supports trigger words (only sendMessage does) and integration.triggerWords is present but fails Match.test(…, [String]). Trigger words must arrive as an array of strings; after the shape check the server filters out blank entries, but a non-array or mixed-type array is rejected with Meteor.Error code 'error-invalid-triggerWords'.","triggerScenarios":"integrations.create with event 'sendMessage' and triggerWords: 'deploy, build' (a single CSV string), triggerWords: ['deploy', 42], or null; also passing triggerWords for events other than sendMessage simply deletes them rather than erroring, so the throw is specific to sendMessage + wrong shape.","commonSituations":"Users pasting a comma-separated list into the field and the client sending it unsplit; API payloads modeled on the channel CSV behavior; form state defaulting triggerWords to null instead of omitting the key.","solutions":["Send triggerWords as an array of strings: ['deploy', 'build']","Split CSV input client-side before submitting: csv.split(',').map((s) => s.trim()).filter(Boolean)","Omit the field entirely when no trigger words are needed"],"exampleFix":"// before\n{ event: 'sendMessage', triggerWords: 'deploy, build' }\n\n// after\n{ event: 'sendMessage', triggerWords: ['deploy', 'build'] }","handlingStrategy":"validation","validationCode":"if (triggerWords !== undefined && (!Array.isArray(triggerWords) || !triggerWords.every((w) => typeof w === 'string'))) {\n  throw new TypeError('triggerWords must be an array of strings');\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Split comma-separated trigger-word input before submission","Remember triggerWords only has effect for the sendMessage event"],"tags":["integrations","outgoing-webhook","trigger-words","validation"],"backgroundTag":"schema-validation-failed","analyzedSha":"b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0","analyzedAt":"2026-08-18T15:26:39.429Z","contentChangedAt":"2026-08-18T15:26:39.429Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}