{"record":{"id":"c8a7c35c53997003","repo":"RocketChat/Rocket.Chat","slug":"invalid-service-url","errorCode":null,"errorMessage":"Invalid service URL","messagePattern":"Invalid service URL","errorType":"exception","errorClass":null,"httpStatus":400,"severity":"error","filePath":"apps/meteor/ee/server/api/v1/omnichannel/triggers.ts","lineNumber":93,"sourceCode":"\t\tasync post() {\n\t\t\tconst { _id: triggerId } = this.urlParams;\n\t\t\tconst { token: visitorToken, extraData } = this.bodyParams;\n\n\t\t\tconst trigger = await LivechatTrigger.findOneById(triggerId);\n\n\t\t\tif (!trigger) {\n\t\t\t\tthrow new Error('Invalid trigger');\n\t\t\t}\n\n\t\t\tif (!trigger?.actions.length || !isExternalServiceTrigger(trigger)) {\n\t\t\t\tthrow new Error('Trigger is not configured to use an external service');\n\t\t\t}\n\n\t\t\tconst { params: { serviceTimeout = 5000, serviceUrl, serviceFallbackMessage = 'trigger-default-fallback-message' } = {} } =\n\t\t\t\ttrigger.actions[0];\n\n\t\t\tif (!serviceUrl) {\n\t\t\t\tthrow new Error('Invalid service URL');\n\t\t\t}\n\n\t\t\tconst token = settings.get<string>('Livechat_secret_token');\n\n\t\t\tif (!token) {\n\t\t\t\tthrow new Error('Livechat secret token is not configured');\n\t\t\t}\n\n\t\t\tconst body = {\n\t\t\t\tmetadata: extraData,\n\t\t\t\tvisitorToken,\n\t\t\t};\n\n\t\t\tconst headers = {\n\t\t\t\t'Accept': 'application/json',\n\t\t\t\t'Content-Type': 'application/json',\n\t\t\t\t'X-RocketChat-Livechat-Token': token,\n\t\t\t};","sourceCodeStart":75,"sourceCodeEnd":111,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0/apps/meteor/ee/server/api/v1/omnichannel/triggers.ts#L75-L111","documentation":"For a valid external-service trigger, the first action's params are destructured with defaults (serviceTimeout 5000, serviceFallbackMessage 'trigger-default-fallback-message') but serviceUrl has no default; when it is missing or empty the route throws 'Invalid service URL' and the outbound call never happens.","triggerScenarios":"Trigger whose external-service action was saved without a Service URL (empty or omitted serviceUrl), then POST /api/v1/livechat/triggers/<id>/external-service/call is hit.","commonSituations":"Trigger form submitted with the URL field cleared; triggers imported or migrated with params dropped; URL stored under a different key by older tooling.","solutions":["Edit the trigger and set the Service URL on its external-service action, then save.","Re-fetch the trigger and confirm actions[0].params.serviceUrl is non-empty before calling.","Validate the same URL with POST /api/v1/livechat/triggers/external-service/test to confirm reachability and response shape."],"exampleFix":"// before: actions[0].params = { serviceTimeout: 5000 }  // no serviceUrl\n// after:  actions[0].params = {\n//   serviceUrl: 'https://svc.example.com/trigger',\n//   serviceTimeout: 5000,\n//   serviceFallbackMessage: 'One moment please',\n// }","handlingStrategy":"validation","validationCode":"const { triggers } = await api.get('/v1/livechat/triggers', { params: { count: 0 } });\nconst trigger = triggers.find((t) => t._id === triggerId);\nconst serviceUrl = trigger?.actions?.[0]?.params?.serviceUrl;\nif (!serviceUrl) throw new Error('Trigger action has no serviceUrl configured');\nawait api.post(`/v1/livechat/triggers/${triggerId}/external-service/call`, body);","typeGuard":"const hasServiceUrl = (t: { actions?: { params?: { serviceUrl?: string } }[] } | undefined): boolean =>\n  typeof t?.actions?.[0]?.params?.serviceUrl === 'string' && t.actions[0].params.serviceUrl.length > 0;","tryCatchPattern":"try {\n  await api.post(`/v1/livechat/triggers/${triggerId}/external-service/call`, body);\n} catch (e) {\n  if (e?.response?.data?.error === 'Invalid service URL') {\n    // set actions[0].params.serviceUrl on the trigger, then retry\n  } else throw e;\n}","preventionTips":["Require a non-empty Service URL in your trigger-creation forms.","After saving or importing triggers, re-fetch and verify params.serviceUrl.","Only serviceTimeout and serviceFallbackMessage have defaults; serviceUrl must be set explicitly."],"tags":["omnichannel","livechat-triggers","external-service","url-configuration"],"backgroundTag":"missing-configuration","analyzedSha":"b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0","analyzedAt":"2026-08-18T15:26:39.429Z","contentChangedAt":"2026-08-18T15:26:39.429Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}