<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Amy Kapernick</title>
    <description>The latest articles on DEV Community by Amy Kapernick (@amyskapers).</description>
    <link>https://dev.to/amyskapers</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F332198%2F0a38b0da-61ab-4efc-8db8-f546ecbc7c01.png</url>
      <title>DEV Community: Amy Kapernick</title>
      <link>https://dev.to/amyskapers</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/amyskapers"/>
    <language>en</language>
    <item>
      <title>GitHub PR Reviews via Fax</title>
      <dc:creator>Amy Kapernick</dc:creator>
      <pubDate>Thu, 30 Apr 2020 06:06:56 +0000</pubDate>
      <link>https://dev.to/amyskapers/github-pr-reviews-via-fax-62l</link>
      <guid>https://dev.to/amyskapers/github-pr-reviews-via-fax-62l</guid>
      <description>&lt;h2&gt;
  
  
  What I built
&lt;/h2&gt;

&lt;p&gt;An integration that allows reviewing and commenting on a GitHub Pull Request via Fax&lt;/p&gt;

&lt;h4&gt;
  
  
  Category Submission:
&lt;/h4&gt;

&lt;p&gt;COVID-19 Communications, Interesting Integrations, Exciting X-Factors&lt;/p&gt;

&lt;h2&gt;
  
  
  Demo Link
&lt;/h2&gt;

&lt;p&gt;&lt;iframe src="https://player.vimeo.com/video/413450595" width="710" height="399"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Link to Code
&lt;/h2&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vJ70wriM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://practicaldev-herokuapp-com.freetls.fastly.net/assets/github-logo-ba8488d21cd8ee1fee097b8410db9deaa41d0ca30b004c0c63de0a479114156f.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/amykapernick"&gt;
        amykapernick
      &lt;/a&gt; / &lt;a href="https://github.com/amykapernick/github_fax_pr"&gt;
        github_fax_pr
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;h1&gt;
GitHub Fax PR Reviews&lt;/h1&gt;
&lt;p&gt;And integration to allow reviewing and commenting on pull requests via fax.&lt;/p&gt;

&lt;h2&gt;
Demo&lt;/h2&gt;
&lt;p&gt;&lt;a href="https://vimeo.com/413450595" rel="nofollow"&gt;https://vimeo.com/413450595&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
Requirements&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Must have a Twilio Account, and a fax capable phone number (instructions available as &lt;a href="https://www.twilio.com/docs/fax/quickstart#getting-started" rel="nofollow"&gt;part of fax quickstart&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Must have a &lt;a href="https://portal.azure.com/#blade/Microsoft_Azure_Marketplace/MarketplaceOffersBlade/selectedMenuItemId/CognitiveServices_MP/dontDiscardJourney/true/launchingContext/%7B%22source%22%3A%22Resources%20Microsoft.CognitiveServices%2Faccounts%22%7D" rel="nofollow"&gt;Microsoft Cognitive Services Computer Vision resource&lt;/a&gt; set up (can be done as part of the Azure free tier)&lt;/li&gt;
&lt;li&gt;Must have a semi recent version of Node installed (built on v13.9.0)&lt;/li&gt;
&lt;li&gt;Must have a GitHub account and at least one repository&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
To Use&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Download repository&lt;/li&gt;
&lt;li&gt;Run &lt;code&gt;npm install&lt;/code&gt; or &lt;code&gt;yarn install&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Run &lt;code&gt;cp .env.example .env&lt;/code&gt; to create new &lt;code&gt;.env&lt;/code&gt; file&lt;/li&gt;
&lt;li&gt;Fill in env variables in &lt;code&gt;.env&lt;/code&gt; file from your Twilio account&lt;/li&gt;
&lt;li&gt;Use &lt;code&gt;npm start&lt;/code&gt; to run locally&lt;/li&gt;
&lt;li&gt;Use &lt;a href="https://ngrok.com" rel="nofollow"&gt;ngrok&lt;/a&gt; to expose the page&lt;/li&gt;
&lt;li&gt;In your &lt;a href="https://www.twilio.com/console/phone-numbers" rel="nofollow"&gt;Twilio Console&lt;/a&gt;, edit the fax capable number you're using to send
&lt;ul&gt;
&lt;li&gt;Change it to &lt;strong&gt;Accept Incoming Faxes&lt;/strong&gt; (will likely be Voice Calls by default)&lt;/li&gt;
&lt;li&gt;…&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/amykapernick/github_fax_pr"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
 
&lt;h2&gt;
  
  
  How I built it (what's the stack? did I run into issues or discover something new along the way?)
&lt;/h2&gt;

&lt;p&gt;Built on Express using Node JS, using the Twilio Fax API, Microsoft's Cognitive Services Computer Vision API and GitHub's API&lt;/p&gt;

&lt;p&gt;When a pull request is opened on GitHub, it triggers a webhook to fire. That webhook generates a PDF with information about the PR and sends it via fax.&lt;/p&gt;

&lt;p&gt;Comments can be written on the fax, and faxed back, which when received, sends the fax PDF to Microsoft's Cognitive Services Computer Vision to read the text in the PDF. Using the information taken from the fax, a comment is added to the pull request on GitHub.&lt;/p&gt;

&lt;h2&gt;
  
  
  Additional Resources/Info
&lt;/h2&gt;

&lt;p&gt;Built on Twitch stream over a few different sessions&lt;br&gt;
&lt;a href="https://www.twitch.tv/videos/604972244"&gt;https://www.twitch.tv/videos/604972244&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.twitch.tv/videos/605863096"&gt;https://www.twitch.tv/videos/605863096&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.twitch.tv/videos/606613991"&gt;https://www.twitch.tv/videos/606613991&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Live Demo also available on request (not hosted, running locally on my computer, but can be set up to demo)&lt;/p&gt;

</description>
      <category>twiliohackathon</category>
    </item>
    <item>
      <title>Remote Soundboard</title>
      <dc:creator>Amy Kapernick</dc:creator>
      <pubDate>Mon, 27 Apr 2020 11:16:44 +0000</pubDate>
      <link>https://dev.to/amyskapers/remote-soundboard-1d8h</link>
      <guid>https://dev.to/amyskapers/remote-soundboard-1d8h</guid>
      <description>&lt;h2&gt;
  
  
  What I built
&lt;/h2&gt;

&lt;p&gt;A soundboard that can be used by attendees during a remote presentation, attendees can access the page and react to a presentation, the sound then plays on any device that has the page open in the browser.&lt;/p&gt;

&lt;p&gt;This allows the audience to react to a presentation, to hear other audience members reacting and for the speaker to get feedback from the audience on their talk, without them unmuting their microphone or when they're on a one-way platform (eg. Twitch, YouTube Live, Teams Live, etc).&lt;/p&gt;

&lt;h4&gt;
  
  
  Category Submission:
&lt;/h4&gt;

&lt;p&gt;COVID-19 Communications, Engaging Engagements, Exciting X-Factors&lt;/p&gt;

&lt;h2&gt;
  
  
  Link to Code
&lt;/h2&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vJ70wriM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://practicaldev-herokuapp-com.freetls.fastly.net/assets/github-logo-ba8488d21cd8ee1fee097b8410db9deaa41d0ca30b004c0c63de0a479114156f.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/amykapernick"&gt;
        amykapernick
      &lt;/a&gt; / &lt;a href="https://github.com/amykapernick/remote-soundboard"&gt;
        remote-soundboard
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;h1&gt;
Remote Soundboard&lt;/h1&gt;
&lt;p&gt;A soundboard for use in remote presentations, that allows remote attendees to react to a presenter, with sounds playing for any user that has the page open.&lt;/p&gt;
&lt;h2&gt;
Demo&lt;/h2&gt;
&lt;p&gt;&lt;a href="https://vimeo.com/413798818" rel="nofollow"&gt;https://vimeo.com/413798818&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
To Use&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Download repository&lt;/li&gt;
&lt;li&gt;Run &lt;code&gt;npm install&lt;/code&gt; or &lt;code&gt;yarn install&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Run &lt;code&gt;cp .env.example .env&lt;/code&gt; to create new &lt;code&gt;.env&lt;/code&gt; file&lt;/li&gt;
&lt;li&gt;Fill in env variables in &lt;code&gt;.env&lt;/code&gt; file from your Twilio account&lt;/li&gt;
&lt;li&gt;Use &lt;code&gt;npm start&lt;/code&gt; to run locally&lt;/li&gt;
&lt;li&gt;Use &lt;a href="https://ngrok.com" rel="nofollow"&gt;ngrok&lt;/a&gt; to expose the page for other users&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
Env Variables&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;TWILIO_ACCOUNT_SID&lt;/code&gt; - Account SID, found in Twilio Console&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;TWILIO_API_KEY&lt;/code&gt; &amp;amp; &lt;code&gt;TWILIO_API_SECRET&lt;/code&gt; - Generate API key and API secret &lt;a href="https://www.twilio.com/console/project/api-keys" rel="nofollow"&gt;here in Twilio Console&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;TWILIO_SYNC_SERVICE_SID&lt;/code&gt; - Get the default service SID, or create a new service [here in the &lt;a href="https://raw.githubusercontent.com/amykapernick/remote-soundboard/prod/"&gt;Twilio Console&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;



&lt;/div&gt;
&lt;br&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/amykapernick/remote-soundboard"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;br&gt;
&lt;/div&gt;
&lt;br&gt;
 

&lt;h2&gt;
  
  
  How I built it (what's the stack? did I run into issues or discover something new along the way?)
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Running on Express&lt;/li&gt;
&lt;li&gt;Using the Twilio Sync API to play the sound remotely on any device that has the page open&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Additional Resources/Info
&lt;/h2&gt;

&lt;p&gt;Built on my Twitch stream&lt;br&gt;
&lt;a href="https://www.twitch.tv/videos/603849527"&gt;https://www.twitch.tv/videos/603849527&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;iframe src="https://player.vimeo.com/video/413798818" width="710" height="399"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;Live Demo also available on request (not hosted, running locally on my computer, but can be set up to demo)&lt;/p&gt;

</description>
      <category>twiliohackathon</category>
    </item>
    <item>
      <title>Building Quokka on Demand</title>
      <dc:creator>Amy Kapernick</dc:creator>
      <pubDate>Sat, 08 Feb 2020 07:09:18 +0000</pubDate>
      <link>https://dev.to/twilio/building-quokka-on-demand-3n1l</link>
      <guid>https://dev.to/twilio/building-quokka-on-demand-3n1l</guid>
      <description>&lt;p&gt;Last year I got the chance to give a live demo at the Superclass at &lt;a href="https://twilioengage.com/sydney2019"&gt;Twilio Engage&lt;/a&gt; in Sydney. It was just a quick demo so I didn't have the chance to do much, but I thought it would be a good opportunity to show how easy the APIs are to use, and maybe I could put a little Perth in it. Then I came up with the idea of Quokkabot 🎉.&lt;/p&gt;

&lt;p&gt;Using the &lt;a href="https://www.twilio.com/whatsapp"&gt;Twilio WhatsApp API&lt;/a&gt;, it allows people to send a message in and ask for a picture of a Quokka. For those who haven't heard of them before, Quokkas are Australian marsupials (related to kangaroos and wallabies), only found on a small island called Rottnest Island, off the coast of Perth. They're herbivores (although will eat most food you leave lying around) and have no natural predators and aren't afraid of humans. But what's made them famous the most is they look like they're smiling, and are excellent at posing for selfies. So I built a bot which allowed people to ask for (and get a photo of a quokka) to brighten their day.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--hOempYiR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/i/lil45j1as24uwjx8di7f.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--hOempYiR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/i/lil45j1as24uwjx8di7f.png" alt="" width="800" height="603"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I would have preferred to use MMS, but currently only US numbers are supported with the Twilio MMS API (something, something, telcos 😠), so I used the WhatsApp API instead. It's currently still in beta so you have to &lt;a href="https://www.twilio.com/docs/sms/whatsapp/api#twilio-sandbox-for-whatsapp"&gt;join a testing sandbox&lt;/a&gt;, but after that it works fine. For ease of use, I also used &lt;a href="https://www.twilio.com/docs/runtime/functions"&gt;Twilio Functions&lt;/a&gt; so that I didn't have to worry about setting up a serverless function. There's a great &lt;a href="https://www.twilio.com/docs/sms/whatsapp/quickstart/node"&gt;quickstart guide for Twilio API for WhatsApp&lt;/a&gt;, or your can follow along below.&lt;/p&gt;




&lt;p&gt;If you don't already have one, &lt;a href="https://www.twilio.com/referral/09ifDK"&gt;sign up for a Twilio account&lt;/a&gt;. Using the referral link provided will give you $10 credit when you set up your account.&lt;/p&gt;

&lt;p&gt;In the &lt;a href="https://www.twilio.com/console"&gt;Twilio Console&lt;/a&gt;, navigate to &lt;strong&gt;Functions&lt;/strong&gt; → &lt;strong&gt;Manage&lt;/strong&gt; and create a new function. When prompted you can start from scratch using the &lt;strong&gt;Blank&lt;/strong&gt; template. Define your function information, and set it to fire the event on &lt;em&gt;Incoming Messages&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--c8g6MuvT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/i/p8p9h9otrqk879ozsaxj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--c8g6MuvT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/i/p8p9h9otrqk879ozsaxj.png" alt="Alt Text" width="800" height="547"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Twilio gives you some code to start with (even though we're using the Blank template 🤷‍♀️), we just need to make a couple of tweaks to get started. This function will be triggered whenever a WhatsApp message is sent to your number and will send a response to the same number.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;    &lt;span class="nx"&gt;exports&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;handler&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;context&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;callback&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="c1"&gt;// Load the Twilio Markup Language (TwiML) function and message&lt;/span&gt;
        &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;twiml&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;Twilio&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;twiml&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;MessagingResponse&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
        &lt;span class="nx"&gt;message&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;twiml&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

        &lt;span class="c1"&gt;// Set the body of the message&lt;/span&gt;
        &lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;body&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Hi, do you want a quokka?&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

        &lt;span class="c1"&gt;// Send the message&lt;/span&gt;
        &lt;span class="nx"&gt;callback&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;twiml&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Get the full path of your function and hold onto it. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--GNY2GDxG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/i/vklnnzyo3qi9q77w2ztp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--GNY2GDxG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/i/vklnnzyo3qi9q77w2ztp.png" alt="" width="777" height="67"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Navigate to &lt;strong&gt;SMS&lt;/strong&gt; → &lt;strong&gt;WhatsApp&lt;/strong&gt; → &lt;strong&gt;Sandbox&lt;/strong&gt; and enter the function url in the box for when a message comes in. If you haven't used WhatsApp before, you might have to go through the tutorial in the &lt;strong&gt;Learn&lt;/strong&gt; tab first.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--i514meaD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/i/vhxyka7j3l08nbfbre6k.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--i514meaD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/i/vhxyka7j3l08nbfbre6k.png" alt="" width="800" height="194"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you haven't already joined the WhatsApp sandbox, send a message with the activation code to the WhatsApp number, this will join the testing sandbox.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--v9nbCNxv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/i/ymihk7b7o028injbw2dj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--v9nbCNxv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/i/ymihk7b7o028injbw2dj.png" alt="" width="800" height="76"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Send a message to the number and see the response you get back. Try tweaking the &lt;code&gt;message.body&lt;/code&gt; and see the new response you get.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--gLT_Aosa--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/i/4bagfdwwb0xh7k3kqvg0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--gLT_Aosa--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/i/4bagfdwwb0xh7k3kqvg0.png" alt="" width="637" height="583"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We need to know if the people sending a message are asking for a quokka, so to access the message text, define a new variable below our existing ones:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;    &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;twiml&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;Twilio&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;twiml&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;MessagingResponse&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
        &lt;span class="nx"&gt;message&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;twiml&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;

        &lt;span class="c1"&gt;// From the message event, get the Body, which is the message text&lt;/span&gt;
        &lt;span class="nx"&gt;request&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Body&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

        &lt;span class="c1"&gt;// Log the message to view what was sent&lt;/span&gt;

        &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;request&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;On the function page, you can scroll down to the bottom and view the results that we've logged, which is the text of the messages that were sent.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--4xU5JEwn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/i/1spu4b7ijkeb7ld125p7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--4xU5JEwn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/i/1spu4b7ijkeb7ld125p7.png" alt="" width="800" height="251"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Changing the body of our function and using the most advanced AI in tech (an &lt;code&gt;if/else&lt;/code&gt; statement 😂), we can check if the message body contains the word &lt;code&gt;quokka&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;    &lt;span class="nx"&gt;exports&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;handler&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;context&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;callback&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;twiml&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;Twilio&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;twiml&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;MessagingResponse&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
        &lt;span class="nx"&gt;message&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;twiml&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
        &lt;span class="nx"&gt;request&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Body&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

        &lt;span class="c1"&gt;// Check if the message contains the word quokka (not case sensitive)&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;RegExp&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;quokka&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;i&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;test&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;request&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                &lt;span class="c1"&gt;// Set the message body to say they want a  quokka&lt;/span&gt;
            &lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;body&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;You want a quokka&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                &lt;span class="c1"&gt;// They didn't want a quokka, but we should respond anyway.&lt;/span&gt;
            &lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;body&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`You didn't ask for a quokka. Are you sure?`&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;


        &lt;span class="nx"&gt;callback&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;twiml&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With the new function, the response changes based on what the initial message said.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--TDZQU2tA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/i/bnvw6zysqjziga0rp549.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--TDZQU2tA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/i/bnvw6zysqjziga0rp549.png" alt="" width="643" height="299"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;But the reason we're using WhatsApp is so we can add images. As well as being able to define the body of a message, we can also define media to include with it. If we change the first part of our &lt;code&gt;if/else&lt;/code&gt; statement to also define the message media by giving it a URL. I've hosted some images so they're easy to use for this&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;    &lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;RegExp&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;quokka&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;i&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;test&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;request&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;body&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;This is a quokka&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

                &lt;span class="c1"&gt;// Give the URL of an image to send with the message&lt;/span&gt;
            &lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;media&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`https://quokkas.amyskapers.dev/img/quokka_(1).jpg`&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now when you send a message asking for a quokka, it will send you a picture of a quokka!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--nk-ZSLF9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/i/yskdcive8n7lrkiwt832.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--nk-ZSLF9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/i/yskdcive8n7lrkiwt832.png" alt="" width="640" height="622"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To change it up a bit, I have a bunch of different images, and generate a random number each time the function is triggered and feed that number into the image URL. It didn't seem fair that people only got images when asking for quokkas either, so I have a bunch of images of things that aren't quokkas, to send then.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;    &lt;span class="nx"&gt;exports&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;handler&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;context&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;callback&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;twiml&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;Twilio&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;twiml&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;MessagingResponse&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
        &lt;span class="nx"&gt;message&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;twiml&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
        &lt;span class="nx"&gt;request&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Body&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;

        &lt;span class="c1"&gt;// Randomly generate a number between 0 and 9 (inclusive)&lt;/span&gt;
        &lt;span class="nx"&gt;photo&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;floor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;random&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

        &lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;RegExp&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;quokka&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;i&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;test&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;request&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;body&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;This is a quokka&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;media&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`https://quokkas.amyskapers.dev/img/quokka_(&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;photo&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;).jpg`&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
          &lt;span class="c1"&gt;// This text was a bit of a joke that my dad would &lt;/span&gt;
          &lt;span class="c1"&gt;// make when my parents came to visit me in Perth&lt;/span&gt;
            &lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;body&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`This is not a quokka`&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;media&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`https://quokkas.amyskapers.dev/img/not_quokka(&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;photo&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;).jpg`&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;


        &lt;span class="nx"&gt;callback&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;twiml&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now it randomly sends one of the photos of quokkas in each message, shaking it up a bit.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--VtD42n68--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/i/3pubugr8ve2fpbi19q60.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--VtD42n68--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/i/3pubugr8ve2fpbi19q60.png" alt="" width="635" height="518"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;Feel free to play around with it, you can also fork the &lt;a href="https://github.com/amykapernick/quokka-on-demand"&gt;repo on GitHub&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>twilio</category>
      <category>javascript</category>
      <category>whatsapp</category>
      <category>serverless</category>
    </item>
  </channel>
</rss>
