{"record":{"id":"68cecda7e668ff55","repo":"RocketChat/Rocket.Chat","slug":"livechat-secret-token-is-not-configured","errorCode":null,"errorMessage":"Livechat secret token is not configured","messagePattern":"Livechat secret token is not configured","errorType":"exception","errorClass":"Error","httpStatus":400,"severity":"error","filePath":"apps/meteor/ee/server/api/v1/omnichannel/triggers.ts","lineNumber":26,"sourceCode":"import { settings } from '../../../../../server/settings';\n\nAPI.v1.addRoute(\n\t'livechat/triggers/external-service/test',\n\t{\n\t\tauthRequired: true,\n\t\tpermissionsRequired: ['view-livechat-manager'],\n\t\tvalidateParams: isLivechatTriggerWebhookTestParams,\n\t\trateLimiterOptions: { numRequestsAllowed: 15, intervalTimeInMS: 60000 },\n\t\tlicense: ['livechat-enterprise'],\n\t},\n\t{\n\t\tasync post() {\n\t\t\tconst { webhookUrl, timeout, fallbackMessage, extraData: clientParams } = this.bodyParams;\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: clientParams,\n\t\t\t\tvisitorToken: '1234567890',\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};\n\n\t\t\tconst response = await callTriggerExternalService({\n\t\t\t\turl: webhookUrl,\n\t\t\t\ttimeout,\n\t\t\t\tfallbackMessage,\n\t\t\t\tbody,","sourceCodeStart":8,"sourceCodeEnd":44,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0/apps/meteor/ee/server/api/v1/omnichannel/triggers.ts#L8-L44","documentation":"Both trigger external-service endpoints read the Livechat_secret_token setting and refuse to run when it is empty, because the token is sent as the X-RocketChat-Livechat-Token header so the external service can authenticate the call. The test route (livechat/triggers/external-service/test, rate-limited to 15/min) throws before any HTTP request is made; the call route (livechat/triggers/:_id/external-service/call) has the same check after resolving the trigger.","triggerScenarios":"POST /api/v1/livechat/triggers/external-service/test (or the call route) on a workspace where the Livechat secret token setting was never set or was cleared.","commonSituations":"Fresh installs before Omnichannel was fully configured; tokens cleared or rotated during security audits; cloned test environments missing private settings.","solutions":["Set the Livechat secret token in the workspace settings (Administration -> Omnichannel/Livechat) and retry the test endpoint.","If the setting is not exposed in the UI, set it via POST /api/v1/settings/Livechat_secret_token with an admin account.","After configuring, verify the external service receives the X-RocketChat-Livechat-Token header."],"exampleFix":"// before\nawait api.post('/v1/livechat/triggers/external-service/test', { webhookUrl });\n// -> 'Livechat secret token is not configured'\n\n// after\nawait api.post('/v1/settings/Livechat_secret_token', { value: process.env.LIVECHAT_SECRET_TOKEN });\nawait api.post('/v1/livechat/triggers/external-service/test', { webhookUrl });","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  await api.post('/v1/livechat/triggers/external-service/test', { webhookUrl });\n} catch (e) {\n  if (e?.response?.data?.error === 'Livechat secret token is not configured') {\n    // set the Livechat_secret_token setting, then retry the test\n  } else throw e;\n}","preventionTips":["Configure the Livechat secret token before developing against external-service triggers.","Include the token setting in environment provisioning scripts and clone checklists.","If the token is rotated, update the external service's verification list in the same change."],"tags":["omnichannel","livechat-triggers","external-service","configuration","secret-token"],"backgroundTag":"missing-configuration","analyzedSha":"b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0","analyzedAt":"2026-08-18T15:26:39.429Z","contentChangedAt":"2026-08-18T15:26:39.429Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}