Skip to content

Latest commit

 

History

History
276 lines (200 loc) · 12 KB

File metadata and controls

276 lines (200 loc) · 12 KB

Twilio Essentials - Programmable Messaging and Programmable Voice

Unit 1 - Introducing Twilio and Programmable Messaging

Video 1 - Welcome

Video 2 - Signing up

Video 3 - What even is a message?

Video 4 - Send a text message

Video 5 - Receiving a message

TwiML Bin: TwilioQuest

<?xml version="1.0" encoding="UTF-8"?>
<Response>
  <Message>Discover your power to change the world with code! https://twilio.com/quest</Message>
</Response>

Video 6 - Responding dynamically

/auto-responder

exports.handler = function (context, event, callback) {
  console.log(`Body was ${event.Body}`);
  const twiml = new Twilio.twiml.MessagingResponse();
  if (event.Body.toUpperCase() === "QUEST") {
    twiml.message(
      "Discover your power to change the world with code! https://twilio.com/quest"
    );
  } else {
    twiml.message(
      `I don't know what you mean by "${event.Body}". Did you mean QUEST?`
    );
  }
  console.log(`TwiML: ${twiml}`);
  return callback(null, twiml);
};

Video 7 - Review + Practice

Practice Programmable Messaging

Here are some practice and example applications for you to experiment with. Let us know how it's going @TwilioDevs or in the community

Unit 2 - Programmable Voice

Video 1 - Appreciating the Phone

Video 2 - Receive a Call

TwiML Bin: Ahoy World

<?xml version="1.0" encoding="UTF-8"?>
<Response>
  <Say>Ahoy World!</Say>
</Response>

TwiML Bin: Ahoy Rick

<?xml version="1.0" encoding="UTF-8"?>
<Response>
  <Say voice="Polly.Matthew-Neural">And now an important message:</Say>
  <Play>https://twil.io/professional-recording-example</Play>
</Response>

Video 3 - Gather Input

TwiML Bin: Ahoy World (featuring Gather)

<?xml version="1.0" encoding="UTF-8"?>
<Response>
  <Say voice="Polly.Matthew-Neural">And now an important message:</Say>
  <Gather numDigits="1" action="https://exploration-[YOUR DIGITS HERE].twil.io/handle-feedback">
    <Say voice="Polly.Matthew-Neural">Press 1 to approve of this joke, Press 2 to talk to a manager</Say>
    <Play>https://twil.io/professional-recording-example</Play>
  </Gather>
  <Say>You listened to the whole song! Way to never give up!</Say>
</Response>

Function: /handle-feedback

exports.handler = function (context, event, callback) {
  const twiml = new Twilio.twiml.VoiceResponse();
  console.log(`User pressed ${event.Digits}`);
  if (event.Digits === "1") {
    twiml.say("That's great! Glad we didn't let you down!");
  } else if (event.Digits === "2") {
    //TODO: Look up user from phone number => event.From
    const name = "Karen";
    twiml.say(
      `Thank you for reporting this joke, ${name}, connecting you with a supervisor`
    );
    twiml.enqueue("managers");
  } else {
    twiml.say(`You pressed ${event.Digits}...but why?`);
  }
  return callback(null, twiml);
};

TwiML Bin: Get the next caller in the queue

If you had a phone number you could set a dial in number to use the following TwiML Bin on incoming calls. You'd then just have the manager call this number and they'd get the next caller in the queue!

<Response>
    <Dial>
        <Queue>managers</Queue>
    </Dial>
</Response>

Video 4 - Create an Outbound Call

Function: /status-displayer

exports.handler = function (context, event, callback) {
  console.log(`Call: ${event.CallSid} status ${event.CallStatus}`);
  return callback(null);
};

Video 5 - Review + Practice

Practice Programmable Voice

Here are some practice and example applications for you to experiment with. Let us know how it's going @TwilioDevs or in the community

Unit 3 - All Together Now

You can view all the completed PhoneMO source code.

Video 1 - Project Introduction

Video 2 - Use the Serverless Toolkit

Video 3 - Create a Conference

Video 4 - Use Private Data

⏰⏰⏰⏰⏰⏰

Whoops! I mistakenly put muted: false but I meant muted: true! We want callers that aren't the speakers to be silent. Sorry about that!

⏰⏰⏰⏰⏰⏰

Video 5 - Allow for registration via SMS

Code for showing the schedule

// Keep track of when a user does something unexpected and then flip the a showHelp boolean
if (showHelp) {
  const talks = data.getUpcomingTalks();
  const options = talks.map(talk => `For ${talk.title}:  join ${talk.code}`);
  twiml.message(options.join("\n"));
}

Video 6 - Call the registrants

Video 7 - Deploy

Video 8 - Send a follow-up survey

Video 9 - Wrap-up

Practice

  • 📲 Give me a call or send me a text +15038368731 and let me know how you felt about the course! I used Studio to build both the Messaging and Voice flows. Import the flows.
  • 💡 Build an entirely Serverless Voice Mail application! Wire up the incoming number to a Twilio Function that uses the <Record> verb. Turn on transcription and use the webhook to send the transcription to a number specified in an environment variable.
  • 👩‍💻 CodeExchange - Call Forwarding with Voicemail

Ideas for the finishing touches for PhoneMO