How to use the twilio.twiml function in twilio

To help you get started, we’ve selected a few twilio examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DanielCordell / TextEverything / plugins / index.js View on Github external
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.`)
github TwilioDevEd / api-snippets / twiml / voice / conference / conference-9 / conference-9.3.x.js View on Github external
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());
github TwilioDevEd / api-snippets / twiml / message / your-response / your-response-1 / your-response-1.3.x.js View on Github external
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());
github TwilioDevEd / api-snippets / twiml / voice / connect / connect-1 / connect-1.3.x.js View on Github external
const VoiceResponse = require('twilio').twiml.VoiceResponse;

const response = new VoiceResponse();
const connect = response.connect();
connect.room('DailyStandup');

console.log(response.toString());
github TwilioDevEd / api-snippets / twiml / voice / play / play-3 / play-3.3.x.js View on Github external
const VoiceResponse = require('twilio').twiml.VoiceResponse;


const response = new VoiceResponse();
response.play({
    digits: 'wwww3'
});

console.log(response.toString());
github TwilioDevEd / api-snippets / twiml / voice / dial / dial-4 / dial-4.3.x.js View on Github external
const VoiceResponse = require('twilio').twiml.VoiceResponse;


const response = new VoiceResponse();
const dial = response.dial({
    callerId: '+15551112222'
});
dial.number('+15558675310');

console.log(response.toString());
github TwilioDevEd / api-snippets / twiml / voice / queue / queue-2 / queue-2.3.x.js View on Github external
const VoiceResponse = require('twilio').twiml.VoiceResponse;


const response = new VoiceResponse();
response.say('You will now be connected to an agent.');

console.log(response.toString());
github slco-2016 / clientcomm / app / controllers / voice.js View on Github external
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'
github TwilioDevEd / api-snippets / rest / messages / generate-twiml-mms / generate-twiml-mms.3.x.js View on Github external
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());
});