{"record":{"id":"eac0901813cbdca6","repo":"louislam/uptime-kuma","slug":"ooredoo-rejected-the-message-reason","errorCode":null,"errorMessage":"Ooredoo rejected the message: ${reason}","messagePattern":"Ooredoo rejected the message: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"server/notification-providers/ooredoo.js","lineNumber":59,"sourceCode":"                const batch = recipients.slice(i, i + MAX_RECIPIENTS_PER_REQUEST);\n                const data = new URLSearchParams({\n                    username: notification.ooredooUsername,\n                    // The gateway expects the access key to be Base64 encoded.\n                    access_key: Buffer.from(notification.ooredooAccessKey).toString(\"base64\"),\n                    message: msg,\n                    batch: batch.join(\" \"),\n                });\n\n                const resp = await axios.post(url, data.toString(), config);\n\n                // The gateway returns HTTP 200 even on failure; the real outcome\n                // is carried in \"response_code\" (0 means the batch was accepted).\n                if (!resp.data || Number(resp.data.response_code) !== 0) {\n                    const reason =\n                        resp.data && resp.data.response_message\n                            ? resp.data.response_message\n                            : \"response_code=\" + (resp.data ? resp.data.response_code : \"unknown\");\n                    throw new Error(\"Ooredoo rejected the message: \" + reason);\n                }\n            }\n\n            return okMsg;\n        } catch (error) {\n            this.throwGeneralAxiosError(error);\n        }\n    }\n\n    /**\n     * Normalize a Maldivian phone number to the \"960XXXXXXX\" format expected\n     * by the Ooredoo gateway. Numbers already in that form are returned as is.\n     * @param {string} phoneNumber The phone number to normalize\n     * @returns {string} The normalized phone number, or \"\" if it is empty\n     */\n    normalizePhoneNumber(phoneNumber) {\n        const number = phoneNumber.replace(/[\\s+]/g, \"\");\n","sourceCodeStart":41,"sourceCodeEnd":77,"githubUrl":"https://github.com/louislam/uptime-kuma/blob/6b5ea0155793e666666745fb8d6fef1e829543a2/server/notification-providers/ooredoo.js#L41-L77","documentation":"The Ooredoo SMS gateway returns HTTP 200 even on logical failure, so the provider checks resp.data.response_code and treats non-zero as failure, throwing 'Ooredoo rejected the message: <reason>'. reason is resp.data.response_message when present, otherwise 'response_code=<code or unknown>'. This is the gateway-level acceptance check, distinct from a transport error.","triggerScenarios":"response_code !== 0: invalid/insufficient credit, malformed recipient numbers rejected by the gateway, wrong sender id, expired/invalid ooredooBearerToken accepted at transport but rejected at logic, or rate/quota limits.","commonSituations":"Ooredoo account out of credits; sender id not approved; recipient numbers blacklisted/off-network; token valid for auth but account suspended.","solutions":["Read response_message in the surfaced error to get the gateway's stated reason and act on it (top up credit, fix sender id, etc.).","Confirm ooredooBearerToken is the current valid token and the account is active in the Ooredoo portal.","Validate recipient numbers pass normalizePhoneNumber before sending (see error 171).","If response_code is missing entirely, treat it as a gateway/envelope change and inspect resp.data."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if (!notification.ooredooBearerToken) {\n    throw new Error(\"ooredooBearerToken is required\");\n}","typeGuard":"/** @param {unknown} data */\nfunction isOoredooAccepted(data) {\n    return data && typeof data === \"object\" && Number(data.response_code) === 0;\n}","tryCatchPattern":"const resp = await axios.post(url, data.toString(), config);\nif (!isOoredooAccepted(resp.data)) {\n    const reason = resp.data?.response_message || `response_code=${resp.data?.response_code ?? \"unknown\"}`;\n    throw new Error(`Ooredoo rejected the message: ${reason}`);\n}","preventionTips":["Treat response_code === 0 as the only success signal, not HTTP 200.","Surface response_message so the gateway's reason is visible.","Monitor account credit and sender-id approval proactively."],"tags":["network","http","ooredoo","sms","gateway-rejection"],"backgroundTag":null,"analyzedSha":"6b5ea0155793e666666745fb8d6fef1e829543a2","analyzedAt":"2026-08-12T23:42:12.959Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}