summaryrefslogtreecommitdiff
path: root/server/services/twilio.js
blob: ab4855fe07430577aee4f9847400121efda413c7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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);
  console.log(phone, message);
  client.messages
    .create({
      body: message,
      from: process.env.TWILIO_PHONE_NUMBER,
      to: phone,
    })
    .then((message) => console.log(message.sid));
};

export default sendSMS;