Last active
March 10, 2018 19:27
-
-
Save ShMcK/e6c5d4a6e0e0f5005dff0a44a80bc5ff to your computer and use it in GitHub Desktop.
twilio-multiple.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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