<?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: Standard Library</title>
    <description>The latest articles on DEV Community by Standard Library (@stdlibhq).</description>
    <link>https://dev.to/stdlibhq</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%2F73118%2F6daeba09-5bde-4d11-b85c-fc1927dd30db.png</url>
      <title>DEV Community: Standard Library</title>
      <link>https://dev.to/stdlibhq</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/stdlibhq"/>
    <language>en</language>
    <item>
      <title>How to Build a Slack App to Keep a Slack Channel Topic Locked with Airtable and Standard Library</title>
      <dc:creator>Standard Library</dc:creator>
      <pubDate>Wed, 25 Sep 2019 23:22:15 +0000</pubDate>
      <link>https://dev.to/stdlibhq/how-to-build-a-slack-app-to-keep-a-slack-channel-topic-locked-with-airtable-and-standard-library-59pf</link>
      <guid>https://dev.to/stdlibhq/how-to-build-a-slack-app-to-keep-a-slack-channel-topic-locked-with-airtable-and-standard-library-59pf</guid>
      <description>&lt;p&gt;&lt;a href="https://medium.com/@brimm_reaper/how-to-build-a-slack-app-to-keep-a-slack-channel-topic-locked-with-airtable-and-standard-library-dddea4b9ca03"&gt;Have you ever wanted to lock your Slack channel topics?&lt;/a&gt; A friend of ours, Ben Tossell, recently posed this question on Twitter: &lt;/p&gt;


&lt;blockquote class="ltag__twitter-tweet"&gt;

  &lt;div class="ltag__twitter-tweet__main"&gt;
    &lt;div class="ltag__twitter-tweet__header"&gt;
      &lt;img class="ltag__twitter-tweet__profile-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--X1e_T6KX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://pbs.twimg.com/profile_images/747474443644080128/uJ4UYake_normal.jpg" alt="Ben Tossell profile image"&gt;
      &lt;div class="ltag__twitter-tweet__full-name"&gt;
        Ben Tossell
      &lt;/div&gt;
      &lt;div class="ltag__twitter-tweet__username"&gt;
        &lt;a class="comment-mentioned-user" href="https://dev.to/bentossell"&gt;@bentossell&lt;/a&gt;

      &lt;/div&gt;
      &lt;div class="ltag__twitter-tweet__twitter-logo"&gt;
        &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--P4t6ys1m--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://practicaldev-herokuapp-com.freetls.fastly.net/assets/twitter-f95605061196010f91e64806688390eb1a4dbc9e913682e043eb8b1e06ca484f.svg" alt="twitter logo"&gt;
      &lt;/div&gt;
    &lt;/div&gt;
    &lt;div class="ltag__twitter-tweet__body"&gt;
      so how do you stop members changing your channel topic on &lt;a href="https://twitter.com/SlackHQ"&gt;@SlackHQ&lt;/a&gt; ?&lt;br&gt;&lt;br&gt;&lt;a href="https://t.co/WYYpWiOVUR"&gt;get.slack.help/hc/en-gb/artic…&lt;/a&gt; seems anyone can change it...😬
    &lt;/div&gt;
    &lt;div class="ltag__twitter-tweet__date"&gt;
      07:15 AM - 18 Sep 2019
    &lt;/div&gt;


    &lt;div class="ltag__twitter-tweet__actions"&gt;
      &lt;a href="https://twitter.com/intent/tweet?in_reply_to=1174220505395732481" class="ltag__twitter-tweet__actions__button"&gt;
        &lt;img src="/assets/twitter-reply-action.svg" alt="Twitter reply action"&gt;
      &lt;/a&gt;
      &lt;a href="https://twitter.com/intent/retweet?tweet_id=1174220505395732481" class="ltag__twitter-tweet__actions__button"&gt;
        &lt;img src="/assets/twitter-retweet-action.svg" alt="Twitter retweet action"&gt;
      &lt;/a&gt;
      0
      &lt;a href="https://twitter.com/intent/like?tweet_id=1174220505395732481" class="ltag__twitter-tweet__actions__button"&gt;
        &lt;img src="/assets/twitter-like-action.svg" alt="Twitter like action"&gt;
      &lt;/a&gt;
      2
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/blockquote&gt;


&lt;p&gt;A fine question, indeed.&lt;/p&gt;

&lt;p&gt;If you’re reading this, then odds are that you use &lt;a href="https://slack.com/"&gt;Slack&lt;/a&gt; for internal communication when at work. It is likely that you also know that Slack Channel topics can set the tone for how users interact with one another in a given channel. They are a constant reminder that a channel is meant for serious business, reserved for horseplay, or falls somewhere in between. And while they are undeniably important, they are also extremely fragile, subjected to the will of the masses who make up the channel. At any moment your topic can be replaced, willy-nilly, by any member of the channel, and you are powerless to prevent it. That is, until now.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---FfN065o--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://miro.medium.com/max/1080/1%2AKTtFl5yH6qck5o63Y-Qg2Q.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---FfN065o--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://miro.medium.com/max/1080/1%2AKTtFl5yH6qck5o63Y-Qg2Q.gif" alt=""&gt;&lt;/a&gt;There is always one.&lt;/p&gt;

&lt;p&gt;Today we are going to see how you can retake control of your Slack channel topics by deploying a Slack bot on &lt;a href="https://stdlib.com/"&gt;Standard Library&lt;/a&gt; that uses &lt;a href="https://www.airtable.com/"&gt;Airtable&lt;/a&gt; to lock a channel’s topic to a stored value. So let’s dive in!&lt;/p&gt;

&lt;p&gt;&lt;em&gt;For those who just want to deploy a finished project, navigate to this &lt;a href="https://github.com/stdlib-examples/project-slack-topic-bot"&gt;Github repo&lt;/a&gt;. You will still need to set up Airtable and have a Standard Library account, but no other setup will be required on your part.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What You’ll Need Beforehand
&lt;/h2&gt;

&lt;p&gt;1x Airtable Account — &lt;a href="https://www.airtable.com"&gt;https://www.airtable.com&lt;/a&gt;&lt;br&gt;
1x Slack Account — &lt;a href="https://www.slack.com"&gt;https://www.slack.com&lt;/a&gt;&lt;br&gt;
1x Standard Library Account — &lt;a href="https://www.stdlib.com"&gt;https://www.stdlib.com&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1: Setting Up Airtable
&lt;/h2&gt;

&lt;p&gt;First thing’s first. We want to set up some way to persist our desired channel topics. Airtable, while it looks like a spreadsheet, works a lot like a database, and is simple to use and easy to set up. Get a free account by &lt;a href="https://www.airtable.com/"&gt;clicking here&lt;/a&gt;, and then click &lt;a href="https://airtable.com/addBaseFromShare/shruHRGfYKFcyU4U4"&gt;here to add our template&lt;/a&gt; to your workspace. You should end up with something like this, except yours will only have 1 row:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--9JTOAqWz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://miro.medium.com/max/3251/1%2A_liYZJ_xpbYUm-ohdqrncg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--9JTOAqWz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://miro.medium.com/max/3251/1%2A_liYZJ_xpbYUm-ohdqrncg.png" alt=""&gt;&lt;/a&gt; Highlighted: Table Name&lt;/p&gt;

&lt;p&gt;Feel free to add as many channels as you would like here! For this tutorial, I would recommend adding the #random channel and a topic of your choosing to the Base (this will be used in our test event later on). Just note that you &lt;em&gt;must&lt;/em&gt; include the &lt;em&gt;#&lt;/em&gt; before all channel names in the first columns, and that &lt;strong&gt;topics are limited to 250 characters.&lt;/strong&gt; You are now ready to move on to setting up your workflow.&lt;/p&gt;

&lt;h1&gt;
  
  
  Step 2: Set up Your Workflow &amp;amp; Link Airtable
&lt;/h1&gt;

&lt;p&gt;Head over to &lt;a href="https://build.stdlib.com/"&gt;Build on Standard Library&lt;/a&gt; and begin setting up your project. Choose the following options for your project:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Event:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Slack → messages.channels&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Actions:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Airtable → Select Rows by querying a Base&lt;/p&gt;

&lt;p&gt;Slack → Set a Channel’s Topic&lt;/p&gt;

&lt;p&gt;It should look like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--kT229RDP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://miro.medium.com/max/5778/1%2AIWtIqBII1pQKA5WbeUfTPg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--kT229RDP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://miro.medium.com/max/5778/1%2AIWtIqBII1pQKA5WbeUfTPg.png" alt=""&gt;&lt;/a&gt;You are ready to &lt;strong&gt;Create Workflow!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The next screen that you see will ask you to link your Airtable and Slack resources. We already set up an Airtable account in the previous step, so let’s start there. Click on the blue &lt;strong&gt;Link Resource&lt;/strong&gt; button next to Airtable. On the following dialog page, click &lt;strong&gt;Link New Resource&lt;/strong&gt; to select your new table. If you have used Airtable with Standard Library before, click &lt;strong&gt;Finish&lt;/strong&gt; to link your previous account. If you are new to Airtable, you will see a different dialog box asking you to &lt;strong&gt;Enter a Name for Your Account&lt;/strong&gt; (I recommend your account email) and to &lt;strong&gt;Retrieve the API Key from Your Account Page&lt;/strong&gt; (found here). The screen should look like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--0fBrbnnr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://miro.medium.com/max/2174/1%2Am6SIpjaX1pi54nU50pqpvQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--0fBrbnnr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://miro.medium.com/max/2174/1%2Am6SIpjaX1pi54nU50pqpvQ.png" alt=""&gt;&lt;/a&gt;Click on Finish to proceed!&lt;/p&gt;

&lt;p&gt;Click on &lt;strong&gt;Finish&lt;/strong&gt;, and on the next screen find and select the Base that we created earlier, &lt;strong&gt;Channel Topics&lt;/strong&gt;, and click &lt;strong&gt;Finish&lt;/strong&gt; here as well. That’s it for Airtable. Let’s move on to Slack!&lt;/p&gt;

&lt;h1&gt;
  
  
  Step 3: Set up Your Slack Bot
&lt;/h1&gt;

&lt;p&gt;To begin, click on the &lt;strong&gt;Link Resource&lt;/strong&gt; button next to Slack. If you already have a bot set up in your desired workspace, find it and select it on this first dialog screen. That’s it! You’re ready to move on to the next step. If you do not have a bot currently set up in the desired workspace, then continue along in this section.&lt;br&gt;
Once you click &lt;strong&gt;Link New Resource,&lt;/strong&gt; you will arrive at our new Slack workspace linking process. Your screen should look like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--kTom6i0a--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://miro.medium.com/max/2428/1%2AWMo3iDT4DWwR5ZgMTGaQLw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--kTom6i0a--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://miro.medium.com/max/2428/1%2AWMo3iDT4DWwR5ZgMTGaQLw.png" alt=""&gt;&lt;/a&gt;Choose Install Standard Library App to proceed.&lt;/p&gt;

&lt;p&gt;Select the Standard Library Bot option and a pop-up will ask you to install Standard Library into your Slack workspace.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--gelSrNk0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://miro.medium.com/max/1668/1%2AG2MsLOg6pGKLi-poJUjd7w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--gelSrNk0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://miro.medium.com/max/1668/1%2AG2MsLOg6pGKLi-poJUjd7w.png" alt=""&gt;&lt;/a&gt;Slack workspace OAuth page.&lt;/p&gt;

&lt;p&gt;On the following page, you will have the option to customize your bot. Feel free to be as creative as you would like here, but keep in mind that if you choose to add additional functionality to your bot down the road, other users in your channel may be exposed to the name of your bot and the thumbnail image.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Vc-WVZq6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://miro.medium.com/max/2444/1%2ApZFZsX67LCqX0MKn1WS0Ow.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Vc-WVZq6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://miro.medium.com/max/2444/1%2ApZFZsX67LCqX0MKn1WS0Ow.png" alt=""&gt;&lt;/a&gt;Our Topic Bot.&lt;/p&gt;

&lt;p&gt;Click on &lt;strong&gt;Finish&lt;/strong&gt; and you should now see a green circle with a message &lt;strong&gt;Identity Generated&lt;/strong&gt; underneath your two resources. If you do, click on the blue &lt;strong&gt;Next&lt;/strong&gt; at the bottom of the dialog box and move on to Step 4.&lt;/p&gt;

&lt;h1&gt;
  
  
  Step 4: Set up Your Workflow
&lt;/h1&gt;

&lt;p&gt;For this step, we will be using Build on Standard Library’s intuitive interface to generate Node.js code that will drive the functionality of our bot. The first order of business is setting up our Airtable query. Fill in the following details:&lt;/p&gt;

&lt;p&gt;Table → Topics&lt;/p&gt;

&lt;p&gt;Where → Channel → is equal to → #${result.step1.channel.name}&lt;/p&gt;

&lt;p&gt;We can now give this a test run. Click the &lt;strong&gt;pause&lt;/strong&gt; button next to the &lt;strong&gt;Set a Channel’s Topic&lt;/strong&gt; row in our workflow, as pictured below, and click on the green &lt;strong&gt;Run with Test Event&lt;/strong&gt; button:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--dmLGe5dW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://miro.medium.com/max/3236/1%2AomGFzqraLeB8RRqopccyEQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--dmLGe5dW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://miro.medium.com/max/3236/1%2AomGFzqraLeB8RRqopccyEQ.png" alt=""&gt;&lt;/a&gt;Finding our channel in Airtable.&lt;/p&gt;

&lt;p&gt;Scroll down to the very bottom of the test result and find the portion that includes &lt;strong&gt;“step3”.&lt;/strong&gt; It should look something like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---snan9z6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://miro.medium.com/max/1536/1%2ADCM0NvrPKv3-bkqjlooG9A.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---snan9z6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://miro.medium.com/max/1536/1%2ADCM0NvrPKv3-bkqjlooG9A.png" alt=""&gt;&lt;/a&gt; Your topic may vary.&lt;/p&gt;

&lt;p&gt;If you see this, then we are ready to move on to the next step! Unpause the row that we paused earlier, and click on the six dots next to the Set a &lt;strong&gt;Channel’s Topic&lt;/strong&gt; step in the workflow. Fill in the two fields as follows:&lt;/p&gt;

&lt;p&gt;channel → ${result.step3.selectQueryResult.rows[0].fields.Channel}&lt;/p&gt;

&lt;p&gt;topic → ${result.step3.selectQueryResult.rows[0].fields.Topic}&lt;/p&gt;

&lt;p&gt;It should look something like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--yJWndZF7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://miro.medium.com/max/3100/1%2AT-ZaH60V0k1f4Vj4tKK2gg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--yJWndZF7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://miro.medium.com/max/3100/1%2AT-ZaH60V0k1f4Vj4tKK2gg.png" alt=""&gt;&lt;/a&gt;We are ready to change some topics!&lt;/p&gt;

&lt;p&gt;Click on the &lt;strong&gt;Run with Test Event&lt;/strong&gt; button and watch your bot go! Check your Slack workspace’s #random channel and you should see a message informing you that the channel’s topic has been changed to the value you input in Airtable. Pretty neat!&lt;/p&gt;

&lt;h1&gt;
  
  
  Step 5: The Finishing Touch
&lt;/h1&gt;

&lt;p&gt;As it currently stands, our bot will attempt to change the topic in any channel that it receives any message in. But we really only want to perform this action when a user changes the channel topic in a channel that we are monitoring, not whenever Janice in accounting asks everyone to submit their expense reports. To do this, click on the &lt;strong&gt;Developer Mode&lt;/strong&gt; button under your workflow to get a behind the scenes look at the code that we have been generating.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Y0JO4gue--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://miro.medium.com/max/3272/1%2AWCBWY1eShJXgoJKS2TGd7Q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Y0JO4gue--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://miro.medium.com/max/3272/1%2AWCBWY1eShJXgoJKS2TGd7Q.png" alt=""&gt;&lt;/a&gt;Developer Mode: ON.&lt;/p&gt;

&lt;p&gt;Here you will want to replace all of the code with the following snippet to make sure that things are running smoothly.&lt;/p&gt;

&lt;p&gt;This looks like a lot, so let’s take a closer look at what it is that we are doing.&lt;/p&gt;

&lt;p&gt;-We are setting up some conditional logic to tell our project that if the message that is received is not an alert that the channel topic has been changed, then return a message to our logs (‘Status unchanged.’)&lt;/p&gt;

&lt;p&gt;-If the message is an alert that the status has been changed, then we preform our query as written and perform one more conditional check before updating the channel topic&lt;/p&gt;

&lt;p&gt;-Our conditional check looks to see if the channel is part of our Airtable Base, and then validates the topic length. If the channel is being monitored and the topic is valid, then we perform the set topic action using the value stored in Airtable for the respective channel&lt;/p&gt;

&lt;p&gt;If you &lt;strong&gt;Run with Test Event&lt;/strong&gt; now, the project should simply return a message informing you that the status was unchanged.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--xXMTmq9---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://miro.medium.com/max/3056/1%2AAUgGNz3YOenr_u7RPN-iyA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--xXMTmq9---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://miro.medium.com/max/3056/1%2AAUgGNz3YOenr_u7RPN-iyA.png" alt=""&gt;&lt;/a&gt;You should see a “Status unchanged” message.&lt;/p&gt;

&lt;p&gt;You will also notice that you received no message in your #random Slack channel regarding a topic change. This means that our checks are working as intended. Click on the blue &lt;strong&gt;Next&lt;/strong&gt; button, give your app a name, and click &lt;strong&gt;Alright, Ship it!&lt;/strong&gt; That’s all you have to do! Feel free to test it out. Happy patrolling, Topic Bot!&lt;/p&gt;

&lt;p&gt;*&lt;em&gt;Kevin Brimmerman is a Software Engineer at Standard Library. Outside of work he is an avid runner and a die-hard Chicago sports fan. Go Cubs! *&lt;/em&gt; &lt;/p&gt;

</description>
      <category>slack</category>
      <category>node</category>
      <category>productivity</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Build an App to Send SMS Surveys with Twilio + Airtable on Standard Library</title>
      <dc:creator>Standard Library</dc:creator>
      <pubDate>Tue, 24 Sep 2019 20:46:29 +0000</pubDate>
      <link>https://dev.to/stdlibhq/build-an-app-to-send-sms-surveys-with-twilio-airtable-on-standard-library-39ch</link>
      <guid>https://dev.to/stdlibhq/build-an-app-to-send-sms-surveys-with-twilio-airtable-on-standard-library-39ch</guid>
      <description>&lt;p&gt;&lt;a href="https://medium.com/@brimm_reaper/build-an-app-to-send-sms-surveys-with-twilio-airtable-on-standard-library-ef5be1cd4f0b" rel="noopener noreferrer"&gt;We live in an era of collaboration and teamwork.&lt;/a&gt; Meaning that even the most straightforward task in this day and age (think ordering lunch, for example) is often brought before a committee vote. Thankfully, ours is also an era of great technological achievement, and there is perhaps no better way to arrive at a consensus than through the use of polling and surveys. Today we are going to see how we can use &lt;a href="https://build.stdlib.com/" rel="noopener noreferrer"&gt;Build on Standard Library&lt;/a&gt; to deploy a quick and easy-to-use polling app that uses your &lt;a href="https://twilio.com/" rel="noopener noreferrer"&gt;Twilio&lt;/a&gt; number to dispatch SMS messages to your group, and then logs their replies in one convenient &lt;a href="https://airtable.com/" rel="noopener noreferrer"&gt;Airtable&lt;/a&gt; Base.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmiro.medium.com%2Fmax%2F4192%2F1%2A805LddiSsiMftzqZ3Aw0Bw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmiro.medium.com%2Fmax%2F4192%2F1%2A805LddiSsiMftzqZ3Aw0Bw.png" alt="What our Airtable Base will look like upon completion!"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  What You’ll Need Beforehand
&lt;/h1&gt;

&lt;p&gt;1x Airtable account — &lt;a href="https://www.airtable.com" rel="noopener noreferrer"&gt;https://www.airtable.com&lt;/a&gt;&lt;br&gt;
1x Twilio account — &lt;a href="https://www.twilio.com" rel="noopener noreferrer"&gt;https://www.twilio.com&lt;/a&gt;&lt;br&gt;
1x Standard Library Account — &lt;a href="https://www.stdlib.com" rel="noopener noreferrer"&gt;https://www.stdlib.com&lt;/a&gt;&lt;/p&gt;
&lt;h1&gt;
  
  
  Step 1: Setting Up Airtable
&lt;/h1&gt;

&lt;p&gt;The first thing that we want to do is set up our Airtable Base so that it is ready to begin receiving data. If you are a new user, sign up for an account by &lt;a href="https://www.airtable.com/" rel="noopener noreferrer"&gt;visiting this link&lt;/a&gt;, and then &lt;a href="https://airtable.com/addBaseFromShare/shrf3W1JpexdDzfio" rel="noopener noreferrer"&gt;click here to add our Base template to your Airtable Workspace&lt;/a&gt;. You should see a Base that looks like the above screenshot, but without the polarizing question already populated. As you can see, our base has three tables, two of which require some input from you, and one that will be entirely populated by Standard Library. Let’s take a closer look at what each of these tables is responsible for tracking.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Questions&lt;/strong&gt; —This table tracks your current and past questions. Questions go in column one, and the other columns will be handled by our application&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Contacts&lt;/strong&gt; — This will be a table of individuals who are a part of your group. The only required field here is the phone number(&lt;em&gt;country code&lt;/em&gt; + &lt;em&gt;area code&lt;/em&gt; + &lt;em&gt;phone number&lt;/em&gt;. 14155309876 for example). The name field is optional&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Replies&lt;/strong&gt; — This table will be entirely populated by our application. It stores the returned text message, along with who sent the reply, and which question the reply was meant for&lt;/p&gt;

&lt;p&gt;For the sake of this tutorial, you will need to add at least one number to the contacts table (I would recommend testing with your own cell phone number) and one question to the questions table (feel free to continue the GOAT debate if you would like). Now that the Base is set up, let’s start our workflow on Standard Library!&lt;/p&gt;
&lt;h1&gt;
  
  
  Step 2: Build Your Workflow on Standard Library
&lt;/h1&gt;

&lt;p&gt;If you haven’t done so yet, get yourself a &lt;a href="https://www.stdlib.com/" rel="noopener noreferrer"&gt;Standard Library account&lt;/a&gt; (it’s free!) and head on over to &lt;a href="https://build.stdlib.com" rel="noopener noreferrer"&gt;https://build.stdlib.com&lt;/a&gt; to begin building out your workflow. For this project we will want to trigger our survey by visiting a URL, so underneath &lt;strong&gt;When This Event Happens&lt;/strong&gt; choose &lt;strong&gt;HTTP or Webhook&lt;/strong&gt; as your event, and proceed to put in the following options:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;When This Event Happens&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;HTTP or Webhook → HTTP Request is sent to Project Endpoint → &lt;strong&gt;send-survey&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;This Workflow Will be Triggered&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Airtable → Select Rows by querying a Base&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Airtable → Select Rows by querying a Base&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Twilio → Send a message&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmiro.medium.com%2Fmax%2F6444%2F1%2AZpPd8B2sce7vTH9KISlv2Q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmiro.medium.com%2Fmax%2F6444%2F1%2AZpPd8B2sce7vTH9KISlv2Q.png" alt="You are now ready to click Create Workflow!"&gt;&lt;/a&gt;You are now ready to click Create Workflow!&lt;/p&gt;
&lt;h1&gt;
  
  
  Step 3: Link Your Resources
&lt;/h1&gt;

&lt;p&gt;The next order of business is linking your Twilio and Airtable accounts with an Identity on Standard Library. For those unfamiliar, linking a resource on Standard Library allows you to securely set up your accounts once, and then makes them available to you across all of your workflows. Let’s start by linking an Airtable account and choosing a Base. Click on the &lt;strong&gt;Link Resource&lt;/strong&gt; button to be presented with the following screen:&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmiro.medium.com%2Fmax%2F2448%2F1%2ANnpJHr00HbBHavBtMZqHfA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmiro.medium.com%2Fmax%2F2448%2F1%2ANnpJHr00HbBHavBtMZqHfA.png"&gt;&lt;/a&gt;If you have previously linked Airtable Bases, they will appear here.&lt;/p&gt;

&lt;p&gt;If this is your first time linking your Airtable account, click the &lt;strong&gt;Add New Account&lt;/strong&gt; button and input a display name on the following screen. You will also need to &lt;a href="https://www.airtable.com/account" rel="noopener noreferrer"&gt;retrieve your API key from Airtable&lt;/a&gt; and include that here as well. It should look something like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmiro.medium.com%2Fmax%2F2416%2F1%2Am6SIpjaX1pi54nU50pqpvQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmiro.medium.com%2Fmax%2F2416%2F1%2Am6SIpjaX1pi54nU50pqpvQ.png"&gt;&lt;/a&gt;Click on Finish and proceed to choose your Base!&lt;/p&gt;

&lt;p&gt;Now you will arrive at a screen presenting you with all of your Bases. Choose the one that you added earlier from our template called &lt;strong&gt;Twilio Survey&lt;/strong&gt;, and then click &lt;strong&gt;Finish [Link Base].&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmiro.medium.com%2Fmax%2F2432%2F1%2Azo3ip9A8L9bKDYYRsme0lw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmiro.medium.com%2Fmax%2F2432%2F1%2Azo3ip9A8L9bKDYYRsme0lw.png"&gt;&lt;/a&gt;An inventory of all your Airtable Bases.&lt;/p&gt;

&lt;p&gt;That takes care of Airtable, so now you can proceed to link a Twilio number to your project. The process will look very similar to the Airtable process at first, and you will see the same pop-up screen asking you to &lt;strong&gt;Add New Account&lt;/strong&gt; or &lt;strong&gt;Link New Resource,&lt;/strong&gt; depending on whether or not you have used Twilio on Standard Library in the past. If you see a number that you would like to use for this project here, click on the green &lt;strong&gt;Choose&lt;/strong&gt; button and move on to the next step.&lt;/p&gt;

&lt;p&gt;If you do not have a number linked yet, proceed to click either &lt;strong&gt;Add New Account&lt;/strong&gt; or &lt;strong&gt;Link New Resource.&lt;/strong&gt; After the loading screen finishes, you should see something like the following:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmiro.medium.com%2Fmax%2F2444%2F1%2A1QE5VVbrUAI5icBU_gWF3A.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmiro.medium.com%2Fmax%2F2444%2F1%2A1QE5VVbrUAI5icBU_gWF3A.png"&gt;&lt;/a&gt;Twilio numbers purchased on Standard Library will show up here.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; If you have numbers that you have purchased on Twilio outside of Standard Library, you will notice that they are absent from this screen. This is the result how Twilio Connect apps work. To read more about Twilio Connect apps and sub-accounts, &lt;a href="https://support.twilio.com/hc/en-us/articles/223135007-What-is-Twilio-Connect-" rel="noopener noreferrer"&gt;click here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;You can now either select a previously linked number that you have purchased through Standard Library, or purchase a new number to use for this project. Once you have done that, click on the blue &lt;strong&gt;Finish [Link Phone Number]&lt;/strong&gt; button, and you will see the following:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmiro.medium.com%2Fmax%2F3232%2F1%2AB-2ZMliAIS2qEYzT8PRlcA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmiro.medium.com%2Fmax%2F3232%2F1%2AB-2ZMliAIS2qEYzT8PRlcA.png"&gt;&lt;/a&gt; With your &lt;strong&gt;Identity Generated&lt;/strong&gt; you can now click on &lt;strong&gt;Next&lt;/strong&gt; button. &lt;/p&gt;
&lt;h1&gt;
  
  
  Part 4: Set Up Your Workflow
&lt;/h1&gt;

&lt;p&gt;The following screen is where we will configure the workflow APIs that we selected earlier. We will start with our initial query. Where the interface asks for a &lt;strong&gt;‘table’&lt;/strong&gt; fill in &lt;strong&gt;‘Contacts’&lt;/strong&gt;. Leave all other fields blank, since we want the query to return all of the numbers in the table. Your window should now look like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmiro.medium.com%2Fmax%2F3172%2F1%2ABTD2zzRDu3swURkc-0zcLg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmiro.medium.com%2Fmax%2F3172%2F1%2ABTD2zzRDu3swURkc-0zcLg.png"&gt;&lt;/a&gt; Our first query to grab all of the numbers in our Contacts table.&lt;/p&gt;

&lt;p&gt;Now click on the six dots next to the second row of our workflow, that says &lt;strong&gt;Airtable → Select Rows by querying a Base.&lt;/strong&gt; You will see a new blank query. Fill it in with the following:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;table → &lt;strong&gt;Questions&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;where → key: &lt;strong&gt;wasSent&lt;/strong&gt; → select: is &lt;strong&gt;NULL&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Click on the &lt;strong&gt;blue plus sign&lt;/strong&gt; next to &lt;strong&gt;Add a new AND clause to this KeyQL Query operation&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In this new box, enter: where → key: &lt;strong&gt;Status&lt;/strong&gt; → select: &lt;strong&gt;is equal to&lt;/strong&gt; → type in: &lt;strong&gt;Pending&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmiro.medium.com%2Fmax%2F3100%2F1%2AzkyoErVBucg7ERgD3EcLYw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmiro.medium.com%2Fmax%2F3100%2F1%2AzkyoErVBucg7ERgD3EcLYw.png"&gt;&lt;/a&gt;Searching Questions for an eligible question.&lt;/p&gt;

&lt;p&gt;Next, click on the six dots to the left of &lt;strong&gt;Twilio&lt;/strong&gt; at the top of our dialog box. We have the option to enter up to four values here, but we only need two. In the to: field enter:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;${result.step1.selectQueryResult.rows[0].fields.Number}&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Then, in the body: field enter:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;${result.step2.selectQueryResult.rows[0].fields.Question}&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmiro.medium.com%2Fmax%2F3128%2F1%2A73YuS0svGZpUDDGNPzv_rw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmiro.medium.com%2Fmax%2F3128%2F1%2A73YuS0svGZpUDDGNPzv_rw.png"&gt;&lt;/a&gt;Set up the Twilio workflow like this.&lt;/p&gt;

&lt;p&gt;Click on the green &lt;strong&gt;Run with Test Event&lt;/strong&gt; button at the bottom of the dialog box and you should receive a text with the question that you entered into Airtable. If you did, then it is working!&lt;/p&gt;

&lt;p&gt;While it is possible to do most of what we need to do in the Build interface, we will need to make some customizations to our code to store the results of multiple queries (what if our Contacts table has more than one number?). In order to do all of these things, we will need to briefly dive under the hood of Build by switching the &lt;strong&gt;Developer Mode&lt;/strong&gt; button to &lt;strong&gt;On.&lt;/strong&gt; &lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmiro.medium.com%2Fmax%2F3128%2F1%2AqyP-TxAkMlJmsCDVDw4org.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmiro.medium.com%2Fmax%2F3128%2F1%2AqyP-TxAkMlJmsCDVDw4org.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here you have a behind the scenes look at what all your hard work has been producing. This is the code that has been generated by our workflow. Replace everything inside of here with the following snippet.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Please be aware that toggling &lt;strong&gt;Developer Mode&lt;/strong&gt; to &lt;strong&gt;Off&lt;/strong&gt; will cause all of your changes to be lost, so best to keep it activated until we have shipped the project.&lt;/p&gt;

&lt;p&gt;The first half of this will allow us to grab 1. all of the numbers that we have included in the &lt;strong&gt;Contacts&lt;/strong&gt; table, and 2. the question that we want to send from the &lt;strong&gt;Questions&lt;/strong&gt; table. Note that the criteria for selecting a question is that the &lt;strong&gt;wasSent&lt;/strong&gt; column is &lt;strong&gt;unchecked&lt;/strong&gt;(null), and that the &lt;strong&gt;Status&lt;/strong&gt; column reads &lt;strong&gt;Pending.&lt;/strong&gt; In the event that there are two or more questions that match this query, only the most recently added one will be sent.&lt;/p&gt;

&lt;p&gt;This second half of this code allows us to perform the Send a message action from our linked Twilio account to every user that we have inserted into our Contacts table, and then changes the wasSent value for the question to true. Now click on the green &lt;strong&gt;Run with Test Event&lt;/strong&gt; button again, and you should receive a message with your first question!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmiro.medium.com%2Fmax%2F1440%2F1%2ATBIH_pu-wucStS88EA2HJA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmiro.medium.com%2Fmax%2F1440%2F1%2ATBIH_pu-wucStS88EA2HJA.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you received the text message, and if the &lt;strong&gt;wasSent&lt;/strong&gt; column in your table was updated to &lt;strong&gt;true&lt;/strong&gt; (that is to say, the column now has a green check!), then proceed to click on the blue &lt;strong&gt;Next&lt;/strong&gt; button. On this final page you will name your project (name it &lt;strong&gt;twilio-survey&lt;/strong&gt;) and then go ahead and click on the blue &lt;strong&gt;Alright, Ship It!&lt;/strong&gt; button. You will receive a message informing you that you are awesome. Well done!&lt;/p&gt;

&lt;p&gt;It is important to note before moving ahead to the next section that in order to conduct our survey going forward, &lt;em&gt;you will need to ping the URL that is being generated during this step&lt;/em&gt;. If you recall, when we began setting up our workflow we decided that &lt;strong&gt;HTTP Request is sent to Project Endpoint&lt;/strong&gt; would be the event that triggers these actions. Meaning that if you ever want to conduct another survey, you will need to ping the URL generated by this workflow. It will look like this:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;https://&amp;lt;Your-Username&amp;gt;.api.stdlib.com/twilio-survey@dev/send-message/&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Where  is replaced with your Standard Library account name. &lt;strong&gt;twilio-survey&lt;/strong&gt; is the name of our project, and &lt;strong&gt;send-message&lt;/strong&gt; is the name of the endpoint that we set up when we determined our event.&lt;/p&gt;

&lt;h1&gt;
  
  
  Part 5: Storing Replies
&lt;/h1&gt;

&lt;p&gt;We now need some way to track replies. This will require setting up a new event in our project to insert SMS messages to our Twilio number into our Airtable Base. Navigate back into your project by clicking on the &lt;strong&gt;dev (click to manage)&lt;/strong&gt; link on your project’s homepage:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmiro.medium.com%2Fmax%2F6248%2F1%2ARb2iTPszw9P1lJfvwbZP6g.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmiro.medium.com%2Fmax%2F6248%2F1%2ARb2iTPszw9P1lJfvwbZP6g.png"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;Find the box that enables you to add new events. It will be located just under the previous workflow that you created. You will see greyed out text that reads &lt;strong&gt;Event Source&lt;/strong&gt; and &lt;strong&gt;When this Event happens…&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;For this workflow, we want to choose:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Twilio → sms.received&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Your &lt;strong&gt;Integrations&lt;/strong&gt; section should now look like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmiro.medium.com%2Fmax%2F6248%2F1%2A35rRmxYGiLHPv4mxrYYs-Q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmiro.medium.com%2Fmax%2F6248%2F1%2A35rRmxYGiLHPv4mxrYYs-Q.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After you have clicked on [+] Add New Workflow, set your workflow up as follows on the dialog page:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Airtable → Select Rows by querying a Base&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Airtable → Select Rows by querying a Base&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Airtable → Insert a row into a Base&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Proceed by clicking &lt;strong&gt;Next&lt;/strong&gt;, and you should see the previously linked resources. Feel free to simply click &lt;strong&gt;Next&lt;/strong&gt;. Here, we will once again be taking the plunge into &lt;strong&gt;Developer Mode&lt;/strong&gt;. Toggle this to &lt;strong&gt;On&lt;/strong&gt;, and paste the following snippet into the editable portion of the box:&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;Let’s cover quickly what we are doing here.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;We are querying the Base to determine which question is currently active&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;We are finding the user associated with the responding phone number&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;We are creating a new record in the &lt;strong&gt;Replies&lt;/strong&gt; table, and linking this reply to the previously selected question and user, respectively&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Testing this code will result in an error, however, so we need to make one change to the test event.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmiro.medium.com%2Fmax%2F3044%2F1%2Ajl5TmP292K2vvEZh5OPPGA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmiro.medium.com%2Fmax%2F3044%2F1%2Ajl5TmP292K2vvEZh5OPPGA.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you click the gear icon next to the Run with Test Environment button, you will see something that looks like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmiro.medium.com%2Fmax%2F3024%2F1%2AN3RPW3eTAmX2bBUh5_wE1g.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmiro.medium.com%2Fmax%2F3024%2F1%2AN3RPW3eTAmX2bBUh5_wE1g.png"&gt;&lt;/a&gt; Here, we need to update our From phone number.&lt;/p&gt;

&lt;p&gt;Our workflow is attempting to find a user that has the number associated with the &lt;strong&gt;‘From’&lt;/strong&gt; key inside this event. Change this value &lt;strong&gt;(“+15555555555”)&lt;/strong&gt;, to a number that is present in your &lt;strong&gt;Contacts&lt;/strong&gt; table (i.e. your phone number with a preceding “+”, like so: &lt;strong&gt;“+18155451993”.&lt;/strong&gt; The “+” and the country code are required here). Leave all the other values as they are, and attempt to run the test again. If you now see the message &lt;strong&gt;“Hello from Twilio!”&lt;/strong&gt; in your &lt;strong&gt;Replies&lt;/strong&gt; table, then congrats! You’re all finished. Proceed to click on &lt;strong&gt;Next&lt;/strong&gt;, and finally &lt;strong&gt;Ship It!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmiro.medium.com%2Fmax%2F1432%2F1%2Atf1ANObCwLloqNsoR2hoUA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmiro.medium.com%2Fmax%2F1432%2F1%2Atf1ANObCwLloqNsoR2hoUA.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  You’re All Set!
&lt;/h1&gt;

&lt;p&gt;That is it! Sit back and watch the replies come rolling in. As we mentioned earlier in this tutorial, ensure that there is only one question that carries a Status of Pending, with a wasSent value of true, as the first question to meet both of these criteria will be the one that replies are logged to. When you feel that a question has ample replies, simply change the Status field for that question to Finished, and then proceed to add a new question. Navigate to your URL endpoint to deliver the new question. Happy polling!&lt;/p&gt;

&lt;p&gt;Kevin Brimmerman is a Software Engineer at Standard Library. Outside of work he is an avid runner and a die-hard Chicago sports fan. Go Cubs!&lt;/p&gt;

</description>
      <category>twilio</category>
      <category>node</category>
      <category>webdev</category>
      <category>javascript</category>
    </item>
  </channel>
</rss>
