{"record":{"id":"b7b5cfcd55fd4f1a","repo":"RocketChat/Rocket.Chat","slug":"error-invalid-event-type","errorCode":"error-invalid-event-type","errorMessage":"Invalid event type","messagePattern":"Invalid event type","errorType":"validation","errorClass":"Meteor.Error","httpStatus":null,"severity":"error","filePath":"apps/meteor/server/lib/integrations/lib/validateOutgoingIntegration.ts","lineNumber":22,"sourceCode":"import { Meteor } from 'meteor/meteor';\n\nimport { compileIntegrationScript } from './compileIntegrationScript';\nimport { isScriptEngineFrozen } from './validateScriptEngine';\nimport { outgoingEvents } from '../../../../app/integrations/lib/outgoingEvents';\nimport { parseCSV } from '../../../../lib/utils/parseCSV';\nimport { hasPermissionAsync, hasAllPermissionAsync } from '../../authorization/hasPermission';\n\nconst scopedChannels = ['all_public_channels', 'all_private_groups', 'all_direct_messages'];\nconst validChannelChars = ['@', '#'];\n\nfunction _verifyRequiredFields(integration: INewOutgoingIntegration | IUpdateOutgoingIntegration): void {\n\tif (\n\t\t!integration.event ||\n\t\t!Match.test(integration.event, String) ||\n\t\tintegration.event.trim() === '' ||\n\t\t!outgoingEvents[integration.event]\n\t) {\n\t\tthrow new Meteor.Error('error-invalid-event-type', 'Invalid event type', {\n\t\t\tfunction: 'validateOutgoing._verifyRequiredFields',\n\t\t});\n\t}\n\n\tif (!integration.username || !Match.test(integration.username, String) || integration.username.trim() === '') {\n\t\tthrow new Meteor.Error('error-invalid-username', 'Invalid username', {\n\t\t\tfunction: 'validateOutgoing._verifyRequiredFields',\n\t\t});\n\t}\n\n\tif (outgoingEvents[integration.event].use.targetRoom && !integration.targetRoom) {\n\t\tthrow new Meteor.Error('error-invalid-targetRoom', 'Invalid Target Room', {\n\t\t\tfunction: 'validateOutgoing._verifyRequiredFields',\n\t\t});\n\t}\n\n\tif (!Match.test(integration.urls, [String])) {\n\t\tthrow new Meteor.Error('error-invalid-urls', 'Invalid URLs', {","sourceCodeStart":4,"sourceCodeEnd":40,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0/apps/meteor/server/lib/integrations/lib/validateOutgoingIntegration.ts#L4-L40","documentation":"Thrown by _verifyRequiredFields while validating a new or updated outgoing integration: the `event` field must be a non-empty string that is a key of the outgoingEvents map. The allowed values are sendMessage, fileUploaded, roomArchived, roomCreated, roomJoined, roomLeft, and userCreated; anything else fails with Meteor.Error code 'error-invalid-event-type'.","triggerScenarios":"POST /api/v1/integrations.create (or .update) with type 'webhook-outgoing' where event is omitted, empty, not a string, or misspelled such as 'message-sent', 'send-message', 'MessageSent', or 'file-upload'. Validation runs before any record is created, so nothing is persisted.","commonSituations":"Developers guessing kebab-case names from other APIs; copy-pasting from outdated docs or blog posts that predate the camelCase event rename; sending the numeric index of a dropdown instead of the value.","solutions":["Use one of the exact camelCase values: 'sendMessage', 'fileUploaded', 'roomArchived', 'roomCreated', 'roomJoined', 'roomLeft', 'userCreated'","Check the event list served to the UI (apps/meteor/app/integrations/lib/outgoingEvents.ts) or the Admin -> Integrations -> New Outgoing dropdown for canonical values","If reading user input, validate it against the list before calling the API so the error surfaces in your own form"],"exampleFix":"// before\n{ type: 'webhook-outgoing', event: 'message-sent', ... }\n\n// after\n{ type: 'webhook-outgoing', event: 'sendMessage', ... }","handlingStrategy":"type-guard","validationCode":"const OUTGOING_EVENTS = ['sendMessage', 'fileUploaded', 'roomArchived', 'roomCreated', 'roomJoined', 'roomLeft', 'userCreated'] as const;\nif (!OUTGOING_EVENTS.includes(event)) {\n  throw new RangeError(`event must be one of: ${OUTGOING_EVENTS.join(', ')}`);\n}","typeGuard":"const isOutgoingEvent = (e: string): e is OutgoingIntegrationEvent =>\n  ['sendMessage', 'fileUploaded', 'roomArchived', 'roomCreated', 'roomJoined', 'roomLeft', 'userCreated'].includes(e);","tryCatchPattern":null,"preventionTips":["Drive the event dropdown from the outgoingEvents map so only valid values can be submitted","Remember the names are camelCase ('sendMessage', not 'send-message')"],"tags":["integrations","outgoing-webhook","validation","rest-api"],"backgroundTag":"invalid-enum-value","analyzedSha":"b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0","analyzedAt":"2026-08-18T15:26:39.429Z","schemaVersion":2},"datasetVersion":"2026-08-21T13:17:26.733Z"}