Skip to content

Instantly share code, notes, and snippets.

What would you like to do?

A Twiml with the following content:

<?xml version="1.0" encoding="UTF-8"?>
            (786) 528-8304
            (785) 528-8303
            (784) 528-8302

And two functions:

One for the redirect SMS:

exports.handler = function(context, event, callback) {
    const twiml = new Twilio.twiml.MessagingResponse();

    twiml.message("At this time, MLH is only able to receive calls on this number. Please try calling the number or emailing");
    callback(null, twiml);

And another for updating the other numbers that are also on call for one specific incident response number:

exports.handler = function(context, event, callback) {
  const attendant = event.To;
  const twilioNumber = event.ForwardedFrom
  const caller = event.Caller

  const phoneNumbers = [

  const filteredNumbers = phoneNumbers.filter((phoneNumber) => {
    return !attendant.endsWith(phoneNumber)

  const twilioClient = context.getTwilioClient();

  filteredNumbers.forEach((phoneNumber) => {
      from: twilioNumber,
      to: phoneNumber,
      body: `Call from ${caller} answered by ${attendant}`,
    }, function(err, result) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment