Repository: louislam/uptime-kuma
File: server/notification-providers/smseagle.js (JavaScript)

Code before:
                    sendMethod = "/send_tocontact";
                } else if (notification.smseagleRecipientType === "smseagle-group") {
                    recipientType = "groupname";
                    sendMethod = "/send_togroup";
                } else if (notification.smseagleRecipientType === "smseagle-to") {
                    recipientType = "to";
                    sendMethod = "/send_sms";
                    if (notification.smseagleMsgType !== "smseagle-sms") {
                        duration = notification.smseagleDuration ?? 10;

                        if (notification.smseagleMsgType === "smseagle-ring") {
                            sendMethod = "/ring_call";
                        } else if (notification.smseagleMsgType === "smseagle-tts") {
                            sendMethod = "/tts_call";
                        } else if (notification.smseagleMsgType === "smseagle-tts-advanced") {
                            sendMethod = "/tts_adv_call";
                            voiceId = notification.smseagleTtsModel ? notification.smseagleTtsModel : 1;
                        }
                    }
                }

                const url = new URL(notification.smseagleUrl + "/http_api" + sendMethod);

                url.searchParams.append("access_token", notification.smseagleToken);
                url.searchParams.append(recipientType, notification.smseagleRecipient);
                if (notification.smseagleRecipientType == null || notification.smseagleRecipientType === "smseagle-sms") {
                    url.searchParams.append("unicode", (notification.smseagleEncoding) ? "1" : "0");
                    url.searchParams.append("highpriority", notification.smseaglePriority ?? "0");
                } else {
                    url.searchParams.append("duration", duration);
                }
                if (notification.smseagleRecipientType !== "smseagle-ring") {
                    url.searchParams.append("message", msg);
                }
                if (voiceId) {
                    url.searchParams.append("voice_id", voiceId);
                }

                let resp = await axios.get(url.toString(), config);

                if (resp.data.indexOf("OK") === -1) {
                    let error = `SMSEagle API returned error: ${resp.data}`;
                    throw new Error(error);
                }

                return okMsg;
            } else if (notification.smseagleApiType === "smseagle-apiv2") { // according to https://www.smseagle.eu/docs/apiv2/
                let config = {
                    headers: {
                        "access-token": notification.smseagleToken,
                        "Content-Type": "application/json",

Review comment (suggestion):
```suggestion
                if (!notification.smseagleRecipientType || notification.smseagleRecipientType === "smseagle-sms") {
```

Code after:
                    sendMethod = "/send_tocontact";
                } else if (notification.smseagleRecipientType === "smseagle-group") {
                    recipientType = "groupname";
                    sendMethod = "/send_togroup";
                } else if (notification.smseagleRecipientType === "smseagle-to") {
                    recipientType = "to";
                    sendMethod = "/send_sms";
                    if (notification.smseagleMsgType !== "smseagle-sms") {
                        duration = notification.smseagleDuration ?? 10;

                        if (notification.smseagleMsgType === "smseagle-ring") {
                            sendMethod = "/ring_call";
                        } else if (notification.smseagleMsgType === "smseagle-tts") {
                            sendMethod = "/tts_call";
                        } else if (notification.smseagleMsgType === "smseagle-tts-advanced") {
                            sendMethod = "/tts_adv_call";
                            voiceId = notification.smseagleTtsModel ? notification.smseagleTtsModel : 1;
                        }
                    }
                }

                const url = new URL(notification.smseagleUrl + "/http_api" + sendMethod);

                url.searchParams.append("access_token", notification.smseagleToken);
                url.searchParams.append(recipientType, notification.smseagleRecipient);
                if (!notification.smseagleRecipientType || notification.smseagleRecipientType === "smseagle-sms") {
                    url.searchParams.append("unicode", (notification.smseagleEncoding) ? "1" : "0");
                    url.searchParams.append("highpriority", notification.smseaglePriority ?? "0");
                } else {
                    url.searchParams.append("duration", duration);
                }
                if (notification.smseagleRecipientType !== "smseagle-ring") {
                    url.searchParams.append("message", msg);
                }
                if (voiceId) {
                    url.searchParams.append("voice_id", voiceId);
                }

                let resp = await axios.get(url.toString(), config);

                if (resp.data.indexOf("OK") === -1) {
                    let error = `SMSEagle API returned error: ${resp.data}`;
                    throw new Error(error);
                }

                return okMsg;
            } else if (notification.smseagleApiType === "smseagle-apiv2") { // according to https://www.smseagle.eu/docs/apiv2/
                let config = {
                    headers: {
                        "access-token": notification.smseagleToken,
                        "Content-Type": "application/json",