diff --git a/server/notification-providers/octopush.js b/server/notification-providers/octopush.js index 524a4a880..d5c475d3d 100644 --- a/server/notification-providers/octopush.js +++ b/server/notification-providers/octopush.js @@ -49,7 +49,15 @@ class Octopush extends NotificationProvider { }, params: data }; - await axios.post("https://www.octopush-dm.com/api/sms/json", {}, config); + + // V1 API returns 200 even on error so we must check + // response data + let response = await axios.post("https://www.octopush-dm.com/api/sms/json", {}, config); + if ("error_code" in response.data) { + if (response.data.error_code !== "000") { + this.throwGeneralAxiosError(`Octopush error ${JSON.stringify(response.data)}`); + } + } } else { throw new Error("Unknown Octopush version!"); }