{"record":{"id":"27991307f33ad91d","repo":"RocketChat/Rocket.Chat","slug":"trigger-is-not-configured-to-use-an-external-servi","errorCode":null,"errorMessage":"Trigger is not configured to use an external service","messagePattern":"Trigger is not configured to use an external service","errorType":"exception","errorClass":null,"httpStatus":400,"severity":"error","filePath":"apps/meteor/ee/server/api/v1/omnichannel/triggers.ts","lineNumber":86,"sourceCode":"\t\t\tnumRequestsAllowed: 10,\n\t\t\tintervalTimeInMS: 60000,\n\t\t},\n\t\tvalidateParams: isLivechatTriggerWebhookCallParams,\n\t\tlicense: ['livechat-enterprise'],\n\t},\n\t{\n\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,","sourceCodeStart":68,"sourceCodeEnd":104,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0/apps/meteor/ee/server/api/v1/omnichannel/triggers.ts#L68-L104","documentation":"After the trigger is found, the call route requires trigger.actions to be non-empty and the trigger to satisfy isExternalServiceTrigger (an external-service action); otherwise it throws 'Trigger is not configured to use an external service'. The trigger exists but is the wrong kind — e.g. a standard send-message trigger.","triggerScenarios":"POST /api/v1/livechat/triggers/<id>/external-service/call for a trigger whose actions array is empty or whose first action is not an external-service action (sender/message actions only).","commonSituations":"Calling the external-service endpoint with a regular message trigger's id; triggers created before external-service actions existed and never migrated; action lists emptied by an editing mistake.","solutions":["Open the trigger (Administration -> Omnichannel -> Triggers) and configure an external-service action with Service URL, timeout and fallback message.","Use the id of a trigger that is actually configured for external service.","After editing, retry and expect the same payload contract as the /external-service/test endpoint."],"exampleFix":"// before: trigger.actions = [{ name: 'send-message', params: { msg: 'Hi' } }]\nawait api.post(`/v1/livechat/triggers/${id}/external-service/call`, body);\n// -> 'Trigger is not configured to use an external service'\n\n// after: give the trigger an external-service action\n// actions: [{ name: 'external-service', params: { serviceUrl, serviceTimeout: 5000, serviceFallbackMessage } }]\nawait api.post(`/v1/livechat/triggers/${id}/external-service/call`, body);","handlingStrategy":"validation","validationCode":"import { isExternalServiceTrigger } from '@rocket.chat/core-typings';\n\nconst { triggers } = await api.get('/v1/livechat/triggers', { params: { count: 0 } });\nconst trigger = triggers.find((t) => t._id === triggerId);\nif (!trigger?.actions?.length || !isExternalServiceTrigger(trigger)) {\n  throw new Error('Trigger must have an external-service action before calling');\n}\nawait api.post(`/v1/livechat/triggers/${trigger._id}/external-service/call`, body);","typeGuard":"import { isExternalServiceTrigger } from '@rocket.chat/core-typings';\n\nconst isCallableExternalTrigger = (t: unknown): boolean =>\n  !!t && Array.isArray((t as { actions?: unknown[] }).actions) &&\n  (t as { actions: unknown[] }).actions.length > 0 && isExternalServiceTrigger(t as any);","tryCatchPattern":"try {\n  await api.post(`/v1/livechat/triggers/${triggerId}/external-service/call`, body);\n} catch (e) {\n  if (e?.response?.data?.error === 'Trigger is not configured to use an external service') {\n    // edit the trigger to use an external-service action, then retry\n  } else throw e;\n}","preventionTips":["Reuse isExternalServiceTrigger from @rocket.chat/core-typings when inspecting triggers programmatically.","Only point external-service call integrations at triggers configured for external service.","Validate trigger configuration whenever triggers are imported or migrated."],"tags":["omnichannel","livechat-triggers","external-service","trigger-configuration"],"backgroundTag":"invalid-trigger-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"}