Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const MessagingResponse = require('twilio').twiml.MessagingResponse;
var config = require('./../config/config.json')
var normalPath = require('path').join(__dirname)
var methods = {
handle: function(request, response) {
require('fs').readdir(normalPath, (err, files) => {
if(err)
{
throw err
}
var validCommand = false
if(!config.twilio.allowed_numbers.includes(request.From))
{
console.log(`Received command from disallowed number ${request.From}. Not responding.`)
const VoiceResponse = require('twilio').twiml.VoiceResponse;
const response = new VoiceResponse();
const dial = response.dial({
action: 'handleLeaveConference.php',
method: 'POST',
hangupOnStar: true,
timeLimit: 30
});
dial.conference('LoveTwilio');
console.log(response.toString());
const MessagingResponse = require('twilio').twiml.MessagingResponse;
const response = new MessagingResponse();
const message = response.message();
message.body('Hello World!');
response.redirect('https://demo.twilio.com/welcome/sms/');
console.log(response.toString());
const VoiceResponse = require('twilio').twiml.VoiceResponse;
const response = new VoiceResponse();
const connect = response.connect();
connect.room('DailyStandup');
console.log(response.toString());
const VoiceResponse = require('twilio').twiml.VoiceResponse;
const response = new VoiceResponse();
response.play({
digits: 'wwww3'
});
console.log(response.toString());
const VoiceResponse = require('twilio').twiml.VoiceResponse;
const response = new VoiceResponse();
const dial = response.dial({
callerId: '+15551112222'
});
dial.number('+15558675310');
console.log(response.toString());
const VoiceResponse = require('twilio').twiml.VoiceResponse;
const response = new VoiceResponse();
response.say('You will now be connected to an agent.');
console.log(response.toString());
playMessage(req, res) {
const ovmId = req.query.ovmId;
const twilioResponse = new twilio.twiml.VoiceResponse();
OutboundVoiceMessages.findById(ovmId)
.then((ovm) => {
if (ovm) {
const url = ovm.getTemporaryRecordingUrl();
twilioResponse.say(
{ voice: 'woman' },
'Hello. You have a new message from your case manager.');
twilioResponse.play(url);
twilioResponse.say(
{ voice: 'woman' },
'Thank you.');
} else {
twilioResponse.say(
{ voice: 'woman' },
'Sorry, we can\'t find a recording with that Id'
const http = require('http');
const express = require('express');
const MessagingResponse = require('twilio').twiml.MessagingResponse;
const app = express();
app.post('/sms', (req, res) => {
const twiml = new MessagingResponse();
const message = twiml.message();
message.body('The Robots are coming! Head for the hills!');
message.media(
'https://farm8.staticflickr.com/7090/6941316406_80b4d6d50e_z_d.jpg'
);
res.writeHead(200, { 'Content-Type': 'text/xml' });
res.end(twiml.toString());
});