Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Twilio to notifications selections #2964

Closed
1 task done
SomeGuru opened this issue Mar 22, 2023 · 11 comments
Closed
1 task done

Adding Twilio to notifications selections #2964

SomeGuru opened this issue Mar 22, 2023 · 11 comments
Labels
feature-request Request for new features to be added

Comments

@SomeGuru
Copy link

⚠️ Please verify that this feature request has NOT been suggested before.

  • I checked and didn't find similar feature request

🏷️ Feature Request Type

New Notification

🔖 Feature description

Adding in Twilio as a SMS gateway for users to get the messages from the uptime-kuma.

They offer a few different APIs at https://www.twilio.com/docs/usage/api. It would be nice if able to convert to your vue.js code.

a sample of JAVA turned vue.js code would look similar to this, I would assume.
JAVA Code:

// Install the Java helper library from twilio.com/docs/java/install

import com.twilio.Twilio;
import com.twilio.rest.api.v2010.account.Message;
import com.twilio.type.PhoneNumber;

public class Example {
    // Find your Account SID and Auth Token at twilio.com/console
    // and set the environment variables. See http://twil.io/secure
    public static final String ACCOUNT_SID = System.getenv("TWILIO_ACCOUNT_SID");
    public static final String AUTH_TOKEN = System.getenv("TWILIO_AUTH_TOKEN");

    public static void main(String[] args) {
        Twilio.init(ACCOUNT_SID, AUTH_TOKEN);
        Message message = Message.creator(
                new com.twilio.type.PhoneNumber("+15558675310"),
                new com.twilio.type.PhoneNumber("+15017122661"),
                "This is the ship that made the Kessel Run in fourteen parsecs?")
            .create();

        System.out.println(message.getSid());
    }
}

Converted to Vue.JS

<script>
export default {
  data() {
    return {
      ACCOUNT_SID: process.env.TWILIO_ACCOUNT_SID,
      AUTH_TOKEN: process.env.TWILIO_AUTH_TOKEN,
      phoneNumber1: "+15558675310",
      phoneNumber2: "+15017122661",
      messageBody: "This is the ship that made the Kessel Run in fourteen parsecs?",
    };
  },
  methods: {
    sendMessage() {
      const twilio = require('twilio')(this.ACCOUNT_SID, this.AUTH_TOKEN);

      twilio.messages
        .create({
          body: this.messageBody,
          from: this.phoneNumber1,
          to: this.phoneNumber2
        })
        .then(message => console.log(message.sid));
    },
  },
};
</script>

✔️ Solution

My users would benefit, I just would have to find a way to use the gateway properly to send the messages to approved phone numbers only. But still even if just to get the initial twilio messages to my phone would be a great thing.

❓ Alternatives

using the other provided, however then I cannot get to my cell sms to share with others that don't have the other applications on their phones.

📝 Additional Context

No response

@SomeGuru SomeGuru added the feature-request Request for new features to be added label Mar 22, 2023
@Genc
Copy link
Contributor

Genc commented Mar 30, 2023

@SomeGuru Currently, this feature is available in the latest version. Can you test it? If ok let's close issue

@gaetanlord
Copy link

I configure apprise to send sms message to twilio and it is working fine, see
https://github.com/caronc/apprise/wiki#notification-services

Screenshot_2023-03-30_23-32-07

@Genc
Copy link
Contributor

Genc commented Mar 31, 2023

@gaetanlord Can you choose twilio from the dropdown list and try it? Not via Apprise.
Uptime Kuma Version 1.21.1

@gaetanlord
Copy link

gaetanlord commented Apr 1, 2023 via email

@Genc
Copy link
Contributor

Genc commented Apr 1, 2023

@gaetanlord Why? If you have twilio account, you can try this way.

image

@gaetanlord
Copy link

gaetanlord commented Apr 1, 2023 via email

@Genc
Copy link
Contributor

Genc commented Apr 1, 2023

@louislam Can we close this issue?

@louislam louislam closed this as completed Apr 1, 2023
@SyedAsadRazaDevops
Copy link

SyedAsadRazaDevops commented Jun 12, 2023

@Genc and @gaetanlord However, my current version (1.20) doesn't have this feature. According to the official Uptime Kuma, the Twilio integration is available in version 1.21.

@SyedAsadRazaDevops
Copy link

@gaetanlord Why? If you have twilio account, you can try this way.

image

its greater with this new update, but there is still an issue how to add multiple numbers I try with "," but it still failed.

@SyedAsadRazaDevops
Copy link

SyedAsadRazaDevops commented Jun 22, 2023

ERROR

AxiosError: Request failed with status code 400 {"code":21211,"message":"Invalid 'To' Phone Number","status":400}

@CommanderStorm
Copy link
Collaborator

CommanderStorm commented Jun 22, 2023

how to add multiple numbers

Where did you read that this is a feature that is supported by either uptime-kuma or twillio?
The API docs don't say this is a feature.

One notification can, according to their API only contact one To field

Plese refrain from necroposting on closed issues, as this makes issue manaement harder. Instead open a help/... issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Request for new features to be added
Projects
None yet
Development

No branches or pull requests

6 participants