Skip to content

Instantly share code, notes, and snippets.

@ShMcK
Last active March 10, 2018 19:27
Show Gist options
  • Save ShMcK/e6c5d4a6e0e0f5005dff0a44a80bc5ff to your computer and use it in GitHub Desktop.
Save ShMcK/e6c5d4a6e0e0f5005dff0a44a80bc5ff to your computer and use it in GitHub Desktop.
twilio-multiple.js
const twilio = require('./utils/twilio');
class TwilioSMS {
constructor(messagingServiceSid, account) {
this.from = messagingServiceSid;
this.sms = twilio.init(account);
this.sendSMS = ({ to, body }) => this.sms.create({ to, body, messagingServiceSid: this.from });
this.attempts = 0;
}
send(to, body) {
return this.sendSMS({ to, body })
.catch((error) => {
// handle errors
})
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment