generated from lighthouse-labs/node-skeleton
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathserver-sms.js
40 lines (28 loc) · 1.04 KB
/
server-sms.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
const accountSid = process.env.TWILIO_ACCOUNT_SID; // Account SID from www.twilio.com/console
const authToken = process.env.TWILIO_AUTH_TOKEN; // Auth Token from www.twilio.com/console
const client = require('twilio')(accountSid, authToken);
//Twilio Phone Number - Where the texts will be receive from
const twilioPhone = '+15873192825';
//This function takes in a string as a message and sends it via sms from the twilio api
const sendCustomerSMS = function (message){
client.messages
.create({
body: message,
from: twilioPhone,
to: '+15872204888'
})
.then(message => console.log(message.sid));
// client.messages
// .create({body: message, from: twilioPhone, to: '+15872204888'})
// .then(message => console.log(message.sid));
}
const sendRestaurantSMS = function (message){
client.messages
.create({
body: message,
from: twilioPhone,
to: '+15872204888'
})
.then(message => console.log(message.sid));
}
module.exports = { sendCustomerSMS, sendRestaurantSMS };