summaryrefslogtreecommitdiff
path: root/server/services/twilio.js
blob: 69eac16cc70ed4a1389bfc15821a83708321dcd0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import twilio from 'twilio';

const accountSid = process.env.TWILIO_ACCOUNT_SID;
const authToken = process.env.TWILIO_AUTH_TOKEN;

const sendSMS = (phone, message) => {
  const client = twilio(accountSid, authToken);
  client.messages
    .create({
      body: message,
      from: process.env.TWILIO_PHONE_NUMBER,
      to: phone,
    })
    .then((message) => console.log(message.sid));
};

export default sendSMS;