{"record":{"id":"10f7deff108be473","repo":"RocketChat/Rocket.Chat","slug":"error-invalid-targetroom","errorCode":"error-invalid-targetRoom","errorMessage":"Invalid Target Room","messagePattern":"Invalid Target Room","errorType":"validation","errorClass":"Meteor.Error","httpStatus":null,"severity":"error","filePath":"apps/meteor/server/lib/integrations/lib/validateOutgoingIntegration.ts","lineNumber":34,"sourceCode":"\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', {\n\t\t\tfunction: 'validateOutgoing._verifyRequiredFields',\n\t\t});\n\t}\n\n\tintegration.urls = integration.urls.filter((url) => url && url.trim() !== '');\n\n\tif (integration.urls.length === 0) {\n\t\tthrow new Meteor.Error('error-invalid-urls', 'Invalid URLs', {\n\t\t\tfunction: 'validateOutgoing._verifyRequiredFields',\n\t\t});\n\t}\n}","sourceCodeStart":16,"sourceCodeEnd":52,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0/apps/meteor/server/lib/integrations/lib/validateOutgoingIntegration.ts#L16-L52","documentation":"Thrown by _verifyRequiredFields when the chosen event uses a target room but the integration payload omits `targetRoom`. Only the userCreated event declares use.targetRoom = true, because new-user notifications must be posted somewhere other than the channel list, so a userCreated integration without targetRoom is rejected with Meteor.Error code 'error-invalid-targetRoom'.","triggerScenarios":"POST /api/v1/integrations.create with type 'webhook-outgoing' and event 'userCreated' while targetRoom is absent, empty, or undefined in the payload.","commonSituations":"Teams wiring HR/onboarding bots to the userCreated event and forgetting the destination room; payloads copied from a sendMessage integration where targetRoom is not a field.","solutions":["Add targetRoom with the destination room name for userCreated integrations, e.g. targetRoom: 'announcements'","Verify the room exists before saving so you do not just move the failure to delivery time","Remember the rule: only userCreated needs targetRoom; the other six events do not"],"exampleFix":"// before\n{ type: 'webhook-outgoing', event: 'userCreated', username: 'rocket.cat', urls: [...] }\n\n// after\n{ type: 'webhook-outgoing', event: 'userCreated', username: 'rocket.cat', targetRoom: 'announcements', urls: [...] }","handlingStrategy":"validation","validationCode":"const eventsNeedingTargetRoom = ['userCreated'];\nif (eventsNeedingTargetRoom.includes(event) && !integration.targetRoom?.trim()) {\n  throw new TypeError('userCreated integrations require a targetRoom');\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Show the targetRoom field in your form only for userCreated and mark it required there","Verify the target room exists before saving the integration"],"tags":["integrations","outgoing-webhook","validation","target-room"],"backgroundTag":"missing-required-field","analyzedSha":"b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0","analyzedAt":"2026-08-18T15:26:39.429Z","schemaVersion":2},"datasetVersion":"2026-08-21T13:17:26.733Z"}