Live data from Hacker News

PopcornNotify – Send simple emails and text messages from one API

popcornnotify.com

1–10 of 59 posts

Re: PopcornNotify – Send simple emails and text messages from one API

#10
Although I truly think this is a fantastic product, both in the simplicity of the offering and the simplicity of the API, I was a little concerned about being able to use my own domain and phone number when sending messages, for the sake of building trust with my users. Also, I (selfishly, perhaps) have more faith in the reliability of an established service than something recently launched.

For anyone who has similar concerns and wants to use something more customizable and reliable like Mailgun/Twilio, but wants access to the same elegant API showcased here, you can use something like this (admittedly naive) implementation:

  const mailgun = require('mailgun-js')({apiKey: api_key, domain: domain});
  const twilio = new require('twilio')(accountSid, authToken);

  export default function notify (to, msg, options) {
    if (Array.isArray(to)) {
      to.forEach((toSingle) => notify(toSingle, msg, options));
      return;
    }

    if (to.includes("@")) {
      mailgun.messages().send({
        from: 'Your name ', // your email
        to: to,
        subject: options && options.subject,
        text: msg
      });
    } else {
      twilioClient.messages.create({
          body: msg,
          to: to,
          from: '+5555555555' // your number
      });
    }
  }
This implementation wouldn't require that much extra effort to set up initially (i.e. signing up for two API credentials instead of one and installing two packages instead of one), but it gives you a lot more flexibility to configure the from address and phone number and might help you sleep easier at night.

However, as a fellow startup founder, I think it's noble to support newer projects like this. As such, I've signed up for an account and plan to test it out for at least a month.

Post reply on HN