<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[46 thoughts - Medium]]></title>
        <description><![CDATA[Technical guides and other noteworthy articles from 46elks. - Medium]]></description>
        <link>https://medium.com/46-thoughts?source=rss----df693b8389cc---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>46 thoughts - Medium</title>
            <link>https://medium.com/46-thoughts?source=rss----df693b8389cc---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 06:14:13 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/46-thoughts" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Receive SMS to a Next.js application]]></title>
            <link>https://medium.com/46-thoughts/receive-sms-to-next-js-application-a3e4d16bf93d?source=rss----df693b8389cc---4</link>
            <guid isPermaLink="false">https://medium.com/p/a3e4d16bf93d</guid>
            <category><![CDATA[nextjs]]></category>
            <category><![CDATA[sms]]></category>
            <category><![CDATA[sms-api]]></category>
            <category><![CDATA[serverless-functions]]></category>
            <category><![CDATA[vercel]]></category>
            <dc:creator><![CDATA[Anton Myrberg]]></dc:creator>
            <pubDate>Fri, 04 Feb 2022 10:55:33 GMT</pubDate>
            <atom:updated>2022-02-07T07:55:49.620Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UizBP6UO_qyULMtc-6wo4g.png" /></figure><h3>Receive SMS to Next.js application</h3><p><strong>After this walk-through you will be able to:</strong></p><ol><li>Send an SMS to a virtual number</li><li>Receive the SMS to your Next.js API</li><li>Send an e-mail from your API, containing the SMS message</li></ol><p><strong>The services we’re using:</strong></p><ul><li><a href="https://46elks.com/">46elks</a> to receive SMS</li><li><a href="https://vercel.com/">Vercel</a> to host your webhook and your Next.js application</li><li><a href="https://mailjet.com/">Mailjet</a> to send e-mails</li></ul><p><strong>Prerequisites:</strong></p><ul><li>Next.js application setup with Typescript</li><li>A 46elks account (free) and a 46elks virtual number (not free)</li><li>A Mailjet account (free)</li><li>A Vercel account (free)</li></ul><h3>First step, get the API keys</h3><p>We need the API keys from 46elks and Mailjet.</p><h4>46elks</h4><p>Go to 46elks.com. Your API keys will be found under “<em>Account</em>”.</p><figure><img alt="Screenshot of where to find API keys at 46elks.com" src="https://cdn-images-1.medium.com/max/1024/1*odsF0jZDDMK3X97Z30L_cg.png" /></figure><h4>Mailjet</h4><p>Go to “<em>Account settings</em>”:</p><figure><img alt="Screenshot of arrow pointing at “Account settings”" src="https://cdn-images-1.medium.com/max/1024/1*gx6Jzo-zfvSOitN3Ycr4mw.png" /></figure><p>Press “<em>Master API-Key &amp; Sub API key managemen</em>t”</p><figure><img alt="Screenshot of arrow pointing at where to click." src="https://cdn-images-1.medium.com/max/1024/1*R0U_uRIoHGQjHfWtr_mWSQ.png" /></figure><p>And there you go :)</p><figure><img alt="Screenshot showing API credentials" src="https://cdn-images-1.medium.com/max/1024/1*6jG1_NVsTq3zBO0IwMTf6A.png" /></figure><h3><strong>Create an api route</strong></h3><p>To create an API route in Next.js you simply add a file under the /api directory. I want my route to be /api/sms so I’ll add a sms.tsx file in the /api directory.</p><p>Copy and paste this code to your new file:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/279f4d5c1f38c3b5c26a3f074b6b620e/href">https://medium.com/media/279f4d5c1f38c3b5c26a3f074b6b620e/href</a></iframe><p>In order to make it run, you need to install two packages:</p><ol><li>npm install node-mailjet</li><li>npm install --save-dev @types/node-mailjet (if you’re using TypeScript)</li></ol><p>Change &lt;your email&gt;, &lt;your recipients email&gt; and &lt;your recipients name&gt; to your needs.</p><p>Also create a file called .env.local in your project’s root directory, with the following contents:</p><pre>MAILJET_UID=&lt;your mailjet api key&gt;<br>MAILJET_PWD=&lt;your mailjet secret key&gt;</pre><h3>Deploy your code to Vercel</h3><p>In my personal experience, I’ve found that the easiest way to deploy to Vercel is to push everything to Github and then connect your Github account to Vercel.</p><p>Use this command to push your Next.js project to a Github repo.</p><pre># Push an existing repository from the command line <br>git remote add origin <a href="https://github.com/c0ldlimit/vimcolors.git">&lt;</a>your git repo url&gt;<br>git push -u origin master</pre><p>Go to Vercel, “<em>New project</em>” and press “<em>Import Git repository</em>”:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZBu9r2MmVWqWsCLKI3CgZQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oxiKpT4GYR95jn_f743oTA.png" /></figure><p>When you see this page you need to enter your environment variables:</p><figure><img alt="Screenshot showing what it looks at when setting up Next.js project at vercel" src="https://cdn-images-1.medium.com/max/1024/1*Vs3Bh8TFLE87D2FKgXDSjQ.png" /></figure><h4>Environment variables</h4><p>We need environment variables. Both in Vercel and also locally. We already have them locally so what’s left is to enter them into Vercel.</p><p>Enter them in Vercel like this:</p><figure><img alt="Screenshot showing how you can add environment variables" src="https://cdn-images-1.medium.com/max/1024/1*14mCsfBFQ2kCb6iQf81UjA.png" /></figure><p>Go ahead and press “<em>Deploy</em>” after you’ve added these variables.</p><h3>Enter your URL in 46elks</h3><p>When Vercel is done deploying you should see something like this:</p><figure><img alt="Screenshot showing what a successful setup at Vercel looks like." src="https://cdn-images-1.medium.com/max/1024/1*YKBV7k4NfJKDGDZepGDoAw.png" /></figure><p>Press “<em>Visit</em>” to get your public URL to your serverless function.</p><h4>Go to your 46elks account</h4><p>And go to “<em>Numbers</em>”, buy a number if you don’t have one already, and click “<em>edit</em>”. You should see this page:</p><figure><img alt="Screenshot showing where to enter serverless function url" src="https://cdn-images-1.medium.com/max/1024/1*yJ0BtJ9A0AdjnNYhDBd6EQ.png" /></figure><p>Enter &lt;your vercel url&gt;/api/sms into sms_url. This will tell 46elks that when someone sends a SMS to your 46elks number, they should send a request to your Vercel serverless function.</p><h3>Test it</h3><p>When this is done, you can try to send a SMS to your 46elks number and see if you get an E-mail. Mine looks like this:</p><figure><img alt="Screenshot showing successful result" src="https://cdn-images-1.medium.com/max/1024/1*u6MKkCM4IQu_dUouW81P1g.png" /></figure><h3>Concepts</h3><p>We’ve covered how to receive a SMS to your Next.js application using a webhook. And also how to send an e-mail containing the SMS message from your Next.js application.</p><p>I would like to point out that this code works well in most situations, for example, instead of sending an e-mail you could save the SMS to a database.</p><h3>Thank you for reading!</h3><p>I hope this walk-through was helpful, comment if you want more in-depth tutorials on example apps or explanation of how something works etc.</p><p>Find the final code snippet <a href="https://gist.github.com/AntonMyr/e47efbf0b951b070d5e1de6a92ecc443">here</a>.</p><p>I also welcome you to join me for other tutorials.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a3e4d16bf93d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/46-thoughts/receive-sms-to-next-js-application-a3e4d16bf93d">Receive SMS to a Next.js application</a> was originally published in <a href="https://medium.com/46-thoughts">46 thoughts</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Schedule Sending SMS from Google Sheet]]></title>
            <link>https://medium.com/46-thoughts/schedule-sending-sms-from-google-sheet-2fe0ed80bfc3?source=rss----df693b8389cc---4</link>
            <guid isPermaLink="false">https://medium.com/p/2fe0ed80bfc3</guid>
            <category><![CDATA[api]]></category>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[google-sheets]]></category>
            <category><![CDATA[scheduling]]></category>
            <category><![CDATA[sms]]></category>
            <dc:creator><![CDATA[46elks]]></dc:creator>
            <pubDate>Tue, 22 Dec 2020 14:30:04 GMT</pubDate>
            <atom:updated>2021-12-17T10:10:47.926Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jhP5DfMkBtFAakcymen6hg.png" /></figure><p>Previously we have written about <a href="https://medium.com/46-thoughts/receive-sms-into-google-spreadsheet-435b51393493">how to receive SMS and store them in a Google Sheet</a> as well as <a href="https://medium.com/46-thoughts/send-sms-from-google-spreadsheet-71f11d358361">how to send SMS from a Google Spreadsheet</a>. In this third part of the SMS &amp; Google Sheets mini series we will cover how to schedule sending SMS from Google Spreadsheets.</p><h3>Preparations</h3><p>Set everything up according to the <a href="https://medium.com/46-thoughts/send-sms-from-google-spreadsheet-71f11d358361">send SMS from Google Spreadsheet</a> tutorial. What you will do there is <a href="https://www.46elks.com/create-account">create a 46elks account</a>, create a Google Spreadsheet and copy/paste some code to send SMS. Once that is done you are ready to start scheduling SMS. To do that you need to define when each SMS should be sent and set up the schedule.</p><p>Let’s get into the details!</p><h3>Define when each SMS should be sent</h3><p>To be able to define when an SMS should be sent you first need to specify how you prefer to write dates. Do this by going into <strong>File &gt; Project Properties</strong> in your script. Go to the <strong>Script properties</strong> tab and add a Property named <em>DateFormat</em> (written exactly like that, not <em>dateformat</em> or <em>Dateformat</em>). Set the value to your preferred date format, for example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*U0iXBKdy-jHcmx9vr6Odfg.jpeg" /></figure><ul><li>YYYY-MM-DD HH:mm (if you prefer 2017–12–25 13:37)</li><li>MM/DD/YYYY HH:mm (12/25/2017 13:37)</li><li>DD/MM/YYYY HH:mm (25/12/2017 13:37)</li></ul><p>Save the Project Properties and return to your Google Sheet. Add a new column called <em>When </em>after the <em>Info</em> column. For each row write the date and time you want to send the message, use the date format you specified earlier.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OSAsL3skNpBlyhtSIf6h_w.jpeg" /></figure><h3>Add Time Zone support</h3><p>The time zone of your Google Sheet that will be used for all the dates and times. You can check your spreadsheets time zone in the Spreadsheet Settings (available via the File menu).</p><p>To be able to deal with time zones in the correct you need to use a library called <a href="https://momentjs.com/">Moment</a>. Go back to the script and go to <strong>Resources &gt; Libraries</strong>. Enter this key into “Add a library”:</p><p><em>Mcun7NPepfBJFDW-iuQnbdo147xIduJpS</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kCEsO7W8OEN0Y6UhWL6d9A.jpeg" /></figure><p>Click <strong>add</strong>, pick version 2 and <strong>save</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QXPUCVGCqcGRjadPWg09yQ.jpeg" /></figure><h3>Time for some code</h3><p>Replace the code you have in your script with the following and save it:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8fd02ee43072fe9b1e5d881bbf4b40e8/href">https://medium.com/media/8fd02ee43072fe9b1e5d881bbf4b40e8/href</a></iframe><p>This code gets the date format you specified, the spreadsheets time zone and when to send each SMS. It then sends the SMS if the date and time to send the message has already passed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/504/1*kU9bg_y5gYkjqfFDkQLksg.jpeg" /></figure><p>Try it yourself by changing the script to sendElksSMS and click Run.. If you have any rows in the spreadsheet where <em>When</em> is set to the past you should be receiving an SMS.</p><h3>Schedule sending messages</h3><p>Finally it is time to set it up so that the script runs on a schedule. Go to <strong>Edit &gt; Current project’s triggers</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/347/1*QV2O7YgX8Ens6xc_YwVufQ.png" /></figure><p>Select “Add Trigger”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hOoPtYsg10EH6Agq8lEk5g.png" /></figure><p>Ensure the following settings are selected:</p><ul><li>Choose which function to run : sendElksSMS</li><li>Choose which deployment should run : Head</li><li>Select event source : Time-driven</li><li>Select type of time based trigger : Minutes timer</li><li>Select minute interval : Every 15 minutes (or as you wish 🚀)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/826/1*c1TVwKA6xEGFGrWn2oynrA.png" /></figure><p>Finally click <strong>Save. </strong>Every 15 minutes your script will run and check for SMS to send. To schedule new SMS just add a new row in your Spreadsheet and set the time you want it to be sent.</p><p><strong>Let us know (help@46elks.com) if we can help you</strong>, if perhaps there is anything unclear in this tutorial, or if you’d like for us to write another one.</p><p>Please be advised that Google has a limitation on how long a script is allowed to run: <strong>“maximum execution time”</strong>. It depends on which kind of Google account you use, the lowest time allows a script to run for 6 minutes. If you plan to send or receive a large amount of SMS at the same time, <strong>please contact 46elks support on +46766861004 or </strong><a href="/service/mailto:help@46elks.com"><strong>help@46elks.com</strong></a>.</p><p>Also check out the previous parts of this a mini series on Google Spreadsheets and SMS:<br><a href="https://medium.com/46-thoughts/receive-sms-into-google-spreadsheet-435b51393493">Part 1: Receive SMS from Google Spreadsheet</a><br><a href="https://medium.com/46-thoughts/send-sms-from-google-spreadsheet-71f11d358361">Part 2: Send SMS from Google Spreadsheet</a></p><p>// 46elks team</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2fe0ed80bfc3" width="1" height="1" alt=""><hr><p><a href="https://medium.com/46-thoughts/schedule-sending-sms-from-google-sheet-2fe0ed80bfc3">Schedule Sending SMS from Google Sheet</a> was originally published in <a href="https://medium.com/46-thoughts">46 thoughts</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Schedule SMS updates with PHP and cronjobs]]></title>
            <link>https://medium.com/46-thoughts/schedule-sms-updates-with-php-and-cronjobs-7d1e5242e90?source=rss----df693b8389cc---4</link>
            <guid isPermaLink="false">https://medium.com/p/7d1e5242e90</guid>
            <category><![CDATA[php]]></category>
            <category><![CDATA[sms-api]]></category>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[cron]]></category>
            <category><![CDATA[sms]]></category>
            <dc:creator><![CDATA[46elks]]></dc:creator>
            <pubDate>Tue, 22 Dec 2020 13:54:40 GMT</pubDate>
            <atom:updated>2020-12-22T14:40:26.637Z</atom:updated>
            <content:encoded><![CDATA[<h3>Schedule SMS with PHP and cron</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xK5S35wxklqH-MCUbpxCJA.png" /></figure><p>This quick guide will demonstrate how to create a simple PHP script to automate weekly SMS send-outs.</p><h3>What you will accomplish…</h3><p>Every Saturday at 8 am an SMS is automatically sent to all gym members with a link to a schedule of the coming week’s class schedule.</p><h4>What you need to follow this guide…</h4><ul><li>A <a href="https://46elks.com/register">46elks account</a>.</li><li>Ability to <strong>SSH</strong> into a <strong>Linux server</strong>.</li></ul><p>Let’s get started🚀</p><h3>Create a PHP file that sends SMS</h3><p>This PHP file sends a preset message to a defined list of recipients. In your code editor, create a PHP file and copy the code so it looks like the example below, except with your 46elks authorization details where indicated by comments.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7dce13864af4b3bfe1cc3c939135611f/href">https://medium.com/media/7dce13864af4b3bfe1cc3c939135611f/href</a></iframe><h3>Parts of a cron command</h3><p>It is good to have an overview of cron before we dive into our example. Below is a brief overview of cron commands and how they work. Here is a simple cron job example:</p><pre>10 * * * * /usr/bin/php /www/virtual/username/cron.php &gt; /dev/null 2&gt;&amp;1</pre><p><strong>There are two main components of a cron job:</strong></p><p>First, the timing: 10 * * * * - here you set the minutes, hours, days, months, and weekday settings (more below).</p><p>Second, the command itself:</p><pre>/usr/bin/php /www/virtual/username/cron.php &gt; /dev/null 2&gt;&amp;1</pre><p>The command itself in this example has three parts:</p><p>/usr/bin/php - PHP scripts are usually are executable by themselves which is why we need to run it through the PHP parser. You can use the command which php to check the correct path.</p><p>/www/virtual/username/cron.php - This is just the path to the script.</p><p>&gt; /dev/null 2&gt;&amp;1 - (optional) This part is handling the output of the script.</p><p>In the above example, the cron job is set to send every 10 minutes — or more specifically, every 10th minute of every hour of every day of every month, every day of the week. An asterisk is a wildcard that stands for “all”.</p><p>Here is a break down of the timing elements:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/652/1*P9KmM449QxCJa3Pd0irlqg.png" /><figcaption>Timing of a cronjob</figcaption></figure><h3>Setting up our cronjob</h3><p>Below is all the information you need to create a cron job that runs every Saturday at 8 am. Once you have access to your server, you can check if any current jobs are running with the following command to list all crontabs:</p><pre>crontab -l</pre><p>This will list the crontab contents.<br>(<strong>NOTE:</strong> There may be none.)</p><p>Now, we’ll edit the crontab:</p><pre>crontab -e</pre><p>At this point, assuming you’ve never changed the default editor for your server, you may find yourself in the vim editor. It can be a little confusing and scary the first time you use it, so here’s what to do:</p><ol><li>Press ESC.</li><li>Type “i” (for “insert”) to begin editing the file.</li><li>Paste the cron command into the file.</li><li>Press ESC</li><li>Type “:wq” (for “write and quit”) to save and exit.</li></ol><p><strong>That’s it! 🥳 Now you can sit back and your gym members will be happy to receive their updates.</strong></p><h3>Some other potential use-cases for cron jobs</h3><ul><li>Sending our reminders and updates to your staff or customers</li><li>Checking the status of your servers and website and notifying your support team</li><li>Requesting monthly feedback from your team</li><li>Checking your database for unpaid bills and sending notices</li><li>Sending yourself weekly SMS updates on your investments</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7d1e5242e90" width="1" height="1" alt=""><hr><p><a href="https://medium.com/46-thoughts/schedule-sms-updates-with-php-and-cronjobs-7d1e5242e90">Schedule SMS updates with PHP and cronjobs</a> was originally published in <a href="https://medium.com/46-thoughts">46 thoughts</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is SMS two-factor authentication (2FA) and why you should add it to your mobile app in 2021]]></title>
            <link>https://medium.com/46-thoughts/what-is-sms-two-factor-authentication-2fa-and-why-you-should-add-it-to-your-mobile-app-in-2021-288ed3ba8f7b?source=rss----df693b8389cc---4</link>
            <guid isPermaLink="false">https://medium.com/p/288ed3ba8f7b</guid>
            <category><![CDATA[app-development]]></category>
            <category><![CDATA[authentication]]></category>
            <category><![CDATA[sms-api]]></category>
            <category><![CDATA[mobile-app-development]]></category>
            <category><![CDATA[sms]]></category>
            <dc:creator><![CDATA[46elks]]></dc:creator>
            <pubDate>Fri, 18 Dec 2020 10:59:51 GMT</pubDate>
            <atom:updated>2020-12-20T02:44:40.779Z</atom:updated>
            <content:encoded><![CDATA[<p>App and data security have been a big issue for developers for a while now and it’s only getting more important. With millions of applications available online and millions more through the Apple and Google app marketplaces, the opportunity for individuals engaged in cybercrime is massive. If there was a time to add two-factor authentication (2FA) to your applications, it is now.</p><p>Two-factor authentication (2FA) is an essential first step to securing your mobile application and if you are not doing this in 2020, you need to start. Using the 46elks API to send one-time passwords to your users is a simple and effective way to increase the security of your IOS, Android and web-based applications. As a developer, it provides you with a smooth way to integrate improved security without needing operator connections or third party software. As a consumer, SMS 2FA is familiar and something we all have ready access to.</p><h3>What is two-factor SMS authentication (2FA)?</h3><p>SMS Two Factor Authentication (2FA) is a security verification procedure that allows a company to more safely identify their users. The company usually triggers the authentication process when users of their service are logging into their website, software, or mobile application. During the log-in process, the user provides their mobile number so they can receive a one-time password (OTP), token or other identifier and an SMS is sent to that number. When an OTP is time-limited it is known as TOTP and this type of password offers increased levels of security as it decreases the chance that brute force attacks are successful.</p><p>Once the user has received their OTP, they can then use this code to log into the service of the company. This process significantly reduces the ability for online data to be compromised as only the user with the linked phone number will be able to access the account at the time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/824/1*_Fp7YYd030bQ8FS6u5qBGw.png" /><figcaption>Flowchart of the technical process to authorise a user with an SMS one-time password</figcaption></figure><h3>What are the benefits of SMS 2FA to your mobile app?</h3><p>The primary reason we want to use 2FA is to confirm that the person requesting to use our service is that person in reality and not someone attempting to gain access to that person’s account. We need to match information a person may have with the information we have in our system. There are several types of information a person may have that we can use to identify them. Three common ways to view these different types of information:</p><ol><li><strong>Something the user knows (password, PIN, pattern, etc.)</strong></li><li><strong>Something the user has (SIM card, one-time password generator, or hardware token)</strong></li><li><strong>A biometric property of the user (fingerprint, retina, voice)</strong></li></ol><p>By sending an OTP to your users via SMS or a phone call you are verifying something the user has (well, has now been given 😊). If this is done in combination with a username and password, you have successfully implemented two-factor authentication.</p><h3>Verifying with SMS provides a good customer experience</h3><p>SMS and phone call authentication provide your users with an experience they are familiar with and most people have a phone within arms reach. Unique mobile phone usage in Europe was above 85% in 2020. If you are not sending SMS to your customers for authentication or anything else for the matter, you should be.</p><p>But aside from the fact that nearly everyone has a mobile phone, SMS is a technology that we are all familiar with, behaves similarly on all devices and doesn’t require any extra applications to be installed. Whilst the way you trigger sending SMS and Phone calls from IOS and Android might differ, the outcome will be identical. This ease of use and familiarity is making your customers lives easier and thus improving their experience with your products and services.</p><p>Flarie is a 46elks customer that has over 800,000 active users in their mobile gaming service. Given that users can win real prizes with Flarie, fraudulent accounts and scammers are a real financial concern. Flarie decided to use 46elks to send OTP SMS to their customers and found that not only did it decrease fraud but it also improved their user experience. Read more about Flarie <a href="https://46elks.com/customer-stories/flarie">here</a>.</p><h3>Automate SMS authentication integration with 46elks</h3><p>Using the 46elks API to add OTP means you can implement authentication processes in the way your team wants them to. Here are the basic building blocks to adding SMS OTP authentication to your mobile app:</p><ol><li>A 46elks account (<a href="https://46elks.com/register/medium">Get one here</a>)</li><li>Create a database to record the expected OTPs and user information</li><li>Create a trigger in your application that does two things:</li></ol><ul><li>Generate an OTP and add it to the database along with the appropriate user information (and time if necessary)</li><li>Sends an SMS to the customer with the same OTP using the 46elks API</li></ul><pre><strong>import</strong> requests</pre><pre>response = requests.post( <br>&quot;https://api.46elks.com/a1/sms&quot;, <br>auth = (&quot;u3498dfu93unf934&quot;, &quot;dlgfkmfiouvber430834&quot;), <br>data = { <br>&quot;from&quot;: &quot;AuthElk&quot;, <br>&quot;to&quot;: &quot;+46766861004&quot;, <br>&quot;message&quot;: &quot;Your one-time password is 28364&quot; <br>})</pre><p>4. Once the user has attempted to enter the password in your application you can assess this entry attempt against the expected OTP in your database</p><ul><li><strong>If it matches</strong> then you can allow entry</li><li><strong>If it does not match</strong> then you can offer reattempts or simply deny the service</li></ul><p>These are the broad building blocks and depending on your application you may need to tweak this flow slightly to provide your users with a great experience and secure your applications.</p><p><strong>Key Takeaways</strong></p><ul><li><strong>Data and application security becoming increasingly important and adding SMS authentication improves your application’s resilience to attacks</strong></li><li><strong>Adding SMS OTP is familiar, simple and effective which means the experience your customers have is positively impacted. It is the small details of applications that make the biggest difference in many cases</strong></li><li><strong>Adding SMS authentication to your application is simple and straightforward with the 46elks SMS and Phone calls API</strong></li></ul><p>If you are looking for more ways to use SMS and phone calls make sure you check out our tutorials and guides on our website <a href="https://46elks.com/tutorials">www.46elks.com/tutorials</a> 🚀</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=288ed3ba8f7b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/46-thoughts/what-is-sms-two-factor-authentication-2fa-and-why-you-should-add-it-to-your-mobile-app-in-2021-288ed3ba8f7b">What is SMS two-factor authentication (2FA) and why you should add it to your mobile app in 2021</a> was originally published in <a href="https://medium.com/46-thoughts">46 thoughts</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Send SMS from Google Spreadsheets]]></title>
            <link>https://medium.com/46-thoughts/send-sms-from-google-spreadsheet-71f11d358361?source=rss----df693b8389cc---4</link>
            <guid isPermaLink="false">https://medium.com/p/71f11d358361</guid>
            <category><![CDATA[api]]></category>
            <category><![CDATA[google-sheets]]></category>
            <category><![CDATA[sms]]></category>
            <category><![CDATA[google-spreadsheets]]></category>
            <dc:creator><![CDATA[46elks]]></dc:creator>
            <pubDate>Tue, 04 Apr 2017 12:31:03 GMT</pubDate>
            <atom:updated>2023-10-19T11:19:20.079Z</atom:updated>
            <content:encoded><![CDATA[<p>You have a Google spreadsheet containing the names and phone numbers of people and would like to send them a text message (SMS).</p><p>This tutorial assumes no prior knowledge of programming or custom telephony. If you like to code we highly recommend that you check out our <a href="https://www.46elks.com/">API over at 46elks.com</a>.</p><h4>1. Create a 46elks account</h4><p>First off, you’re going to <a href="https://46elks.com/">register an account at</a> 46elks. 46elks lets your applications send and receive SMS, MMS and voice calls over the internet . We’ll be using the SMS features in this tutorial.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/802/1*Em62yLHNTXOhZtdDy-REfw.png" /></figure><p>Once you’ve created your account you’ll be sent to the Dashboard. Leave it open, you’ll need it later.</p><h4>2. Create a Google spreadsheet</h4><p>Now go ahead and <a href="https://drive.google.com/">create a new Google spreadsheet</a>. Name it <strong>sms_contacts </strong>and add headings <em>Name</em>, <em>Number, Message, State</em> and <em>Info</em> to the first five columns.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5pqcAz82kIE2g5rorggV5w.png" /></figure><h4>3. Add some contacts</h4><p>Now let’s populate it with a few people we want to send messages to. Note that the phone number needs to be in international format. This is easy enough to fix if you have your numbers in a local format, just:</p><ul><li>Remove any spaces and parenthesis</li><li>Remove any leading zeros</li><li>Prepend your <a href="https://countrycode.org/">country code</a> to the number</li></ul><p>For example, a local US number such as (216) 208–0459 would be written as 12162080459. A Swedish mobile number such as 076 686 1004 would be formatted as 46766861004.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e6IbD-7q3rKANbaAJXgmgw.jpeg" /></figure><p><strong>The message</strong><br>You can set this to anything you want, of course, but since we have the names it would be nice to include them in the message. One way of doing that is to paste the code below into all of your “Message” cells:</p><pre>=CONCATENATE(&quot;Hi &quot;, INDIRECT(&quot;R[0]C[-2]&quot;, false), &quot;! Thanks for coming to the event last night!&quot;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*d9P6hs3Ky2bRIcbY9jYxbA.jpeg" /><figcaption>All messages are generated by the same formula but interpolate different names</figcaption></figure><h4>4. Add a Google script to the spreadsheet</h4><p>Now we’re going to connect the spreadsheet to your 46elks account via Google Scripts. Create a new script from your spreadsheet by selecting <strong>Extensions</strong> <strong>&gt; App script…</strong> in the toolbar. You should be met with a new page that looks something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aaTypEo9PLCg6aAJaV6QMQ.png" /></figure><p>Replace everything in the editor with the following code:</p><pre>function sendElksSMS() {<br>  // Get the properties <br>  var prop = PropertiesService.getScriptProperties();<br>  var username = prop.getProperty(&#39;46elksUsername&#39;);<br>  var password = prop.getProperty(&#39;46elksPassword&#39;);<br>  var spreadsheetUrl = prop.getProperty(&#39;spreadsheetUrl&#39;);<br>  var sender = prop.getProperty(&#39;46elksSender&#39;);<br>  var auth = Utilities.base64Encode(username + &quot;:&quot; + password);<br>  <br>  // Open the requested SpreadSheet and Sheet<br>  var spreadSheet = SpreadsheetApp.openByUrl(spreadsheetUrl);<br>  var sheet = spreadSheet.getSheets()[0];<br>  var range = sheet.getRange(2, 1, sheet.getLastRow() - 1, 5).getValues();<br>  <br>  // Loop over all rows in the range and send the SMS<br>  for (var i in range) {<br>    if (range[i][1] == &#39;&#39; || range[i][3] == &#39;SENT&#39;) continue;<br>    var state = sheet.getRange(2+Number(i), 4);<br>    var info = sheet.getRange(2+Number(i), 5);<br>    try {<br>      UrlFetchApp.fetch(&quot;https://api.46elks.com/a1/SMS&quot;, {<br>        &quot;method&quot;: &quot;post&quot;,<br>        &quot;headers&quot;: { &quot;Authorization&quot;: &quot;Basic &quot; + auth },<br>        &quot;payload&quot;: {<br>          &quot;from&quot; : sender,<br>          &quot;to&quot; : &#39;+&#39; + range[i][1],<br>          &quot;message&quot; : range[i][2]<br>        }<br>      });<br>      state.setValue(&#39;SENT&#39;).setBackground(&#39;#93c47d&#39;);<br>      info.setValue(&#39;Sent on &#39; + new Date());<br>    } catch (err) {<br>      state.setValue(&#39;FAILED&#39;).setBackground(&#39;#e06666&#39;);<br>      info.setValue(String(err).replace(&#39;\n&#39;, &#39;&#39;));<br>    }<br>  }<br>}</pre><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c876c44707113c45d33692e8c430aa28/href">https://medium.com/media/c876c44707113c45d33692e8c430aa28/href</a></iframe><p>We now need to tell the script which spreadsheet it should work with. Open your spreadsheet again and find out what the spreadsheet is called and copy it (In a new spreadsheet it’s called “Sheet1”).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/672/1*vjys3gWAJdSZellpik5qHw.png" /></figure><p>Switch back to the script editor. Go to <strong>Extensions &gt; App script</strong>. If you’re asked to choose a project name, call it anything you like. Next, choose the “Project settings” tab in the menu to the left. Scroll down until you find “Script Properties” Add this script property: 46elksSender to the property to be and the name of who is sending the SMS. For my case its going to be 46elks.</p><p>Next you’re going to need to enter your 46elks details into the same script properties settings. Go to 46elks.com and open the <a href="https://dashboard.46elks.com/">Dashboard</a>. On the right of the page there’s a box containing your API username and password. The password is blurred out but reveals itself if you hover over it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e2pbrx6Vw1WKmzc5dwgfoA.png" /></figure><p>Now you’re going to enter two new rows into the “Script properties” box: One for your API username, one for your API password. The keys <strong>must</strong> be called exactly <strong>46elksUsername, 46elksPassword</strong>.</p><p>For United States, you need to write <strong>noreply</strong> as the Value for <strong>46elksSender </strong>instead of the phone number you registered your account with.</p><p>It should look something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mibWFvCiWTqqSzQLeTfXHQ.png" /></figure><p>Save the script properties and go back to the editor and click save project.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9nOQTRd9jGl8-9kpxSCNqQ.png" /></figure><p>Change script to sendElksSMS and click Run.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FRD8glzEsy9JvTyzqyHQfA.png" /></figure><p>You’ve now sent text messages from inside Google Spreadsheets!</p><p><strong>Let us know (help@46elks.com) if we can help you</strong>, if perhaps there is anything unclear in this tutorial, or if you’d like for us to write another one.</p><p>Please be advised that Google has a limitation on how long a script is allowed to run: <strong>“maximum execution time”</strong>. It depends on which kind of Google account you use, the lowest time allows a script to run for 6 minutes. If you plan to send or receive a large amount of SMS at the same time, <strong>please contact 46elks support on +46766861004 or </strong><a href="/service/mailto:help@46elks.com"><strong>help@46elks.com</strong></a>.</p><p>More parts of this mini series on Google Spreadsheets and SMS:<br><a href="https://medium.com/46-thoughts/receive-sms-into-google-spreadsheet-435b51393493">Part 1: Receive SMS from Google Spreadsheet</a><br><a href="https://medium.com/@46elks/schedule-sending-sms-from-google-sheet-2fe0ed80bfc3">Part 3: Schedule SMS in Google Spreadsheet</a></p><p>// 46elks team</p><p>P.S. This post was updated in the fall of 2023 to keep up with changes in Google Sheets and to make it easier to use.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=71f11d358361" width="1" height="1" alt=""><hr><p><a href="https://medium.com/46-thoughts/send-sms-from-google-spreadsheet-71f11d358361">Send SMS from Google Spreadsheets</a> was originally published in <a href="https://medium.com/46-thoughts">46 thoughts</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Forwarding Incoming SMS to Google Sheets]]></title>
            <link>https://medium.com/46-thoughts/receive-sms-into-google-spreadsheet-435b51393493?source=rss----df693b8389cc---4</link>
            <guid isPermaLink="false">https://medium.com/p/435b51393493</guid>
            <category><![CDATA[google-spreadsheets]]></category>
            <category><![CDATA[sms-api]]></category>
            <category><![CDATA[sms]]></category>
            <category><![CDATA[lifehacks]]></category>
            <category><![CDATA[tutorial]]></category>
            <dc:creator><![CDATA[46elks]]></dc:creator>
            <pubDate>Tue, 04 Apr 2017 12:29:57 GMT</pubDate>
            <atom:updated>2021-12-17T10:11:07.386Z</atom:updated>
            <content:encoded><![CDATA[<p>You want a phone number that can receive sms and forward them into a Google Sheet. You’re in the right place! This tutorial assumes no prior knowledge of programming or custom telephony. If you like to code we highly recommend that you check out our API over at <a href="https://46elks.com/">46elks.com</a>.</p><p>Let’s get started, shall we?</p><h4>1. Setup a 46elks phone number</h4><p>First off, you’re going to register an account at 46elks and get yourself one of our phone numbers. Go <a href="https://www.46elks.com/create-account">here</a> to create an account. Once you’ve registered and logged in you’ll be taken to the Dashboard. Click “Numbers”, choose your country and click “Choose”. You will be given some more information about the number and then you can click “Buy Number”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/815/1*_NbgM5ibyFtuJrImkWR7ag.png" /></figure><h4>2. Create a Google Sheet</h4><p>Now go ahead and create a new Google Sheet. Rename it as <strong>sms_feedback </strong>and add headings <em>D</em>ate, <em>From</em> &amp; <em>Message</em>, to the three first columns:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1006/1*Sys29V8dTVzFfT9VLm_hYQ.png" /></figure><p>It’s important for the sake of this tutorial that the spreadsheet is called precisely <strong>sms_feedback</strong> (not smsfeedback, SMSFeedback or myspreadsheet).</p><h4>3. Add a Google script to the spreadsheet</h4><p>Now, we have our 46elks virtual phone number, we have the Google Sheet, now all we need is the “glue” to get them talking to each other. That glue is Google Scripts. Create a new script from your spreadsheet by selecting <strong>Tools &gt; Script editor…</strong> in the toolbar. You should be met with a new page that looks something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/572/1*Wzw_mLWAlVhzDf17_WR6uw.png" /></figure><p>Replace everything in the editor with the following snippet:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5dccbe89ea5f456bef2f9c333bc7de29/href">https://medium.com/media/5dccbe89ea5f456bef2f9c333bc7de29/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aJ5OiBhkzL85lvkSYsKOuA.png" /></figure><p>We now need to tell the script which spreadsheet it should work with. Open your spreadsheet again and click on the address bar.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UhspBlzdkuCUC46mqOa_hw.jpeg" /><figcaption>The address bar</figcaption></figure><p>The highlighted text in the image below is theURL of your spreadsheet. This is what the script needs in order to figure out which spreadsheet to work with. Copy everything up until <em>#gid</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YxhUKtz4Q7jZkOSINksbVw.jpeg" /><figcaption>The spreadsheet URL. Every spreadsheet has a unique URL so yours will be different.</figcaption></figure><p>Now switch back to the script editor. Go to <strong>File &gt; Project Properties</strong>. If you’re asked to choose a project name, call it anything you like. Next, choose the “Script properties” tab in the pop-up menu. Add a new row. Set the property to be spreadsheetUrl and the value to be the URL you copied from the address bar. You should end up with something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SX9vR8O-r0rCzVvo-dfUVg.jpeg" /></figure><p>Again, it’s important that the property is called precisely spreadsheetUrl and not SpreadSheetURL,spreadsheet_url etc. Your URL will be different than the one in the above image but everything else should be the same. If all looks well then click “Save”.</p><h4>4. Deploy the script and add it to your 46elks number</h4><p>This is the final step so let’s just get to it. First, you’re going to deploy your script. Open the script editor and choose <strong>Publish &gt; Deploy as web app…</strong> in the toolbar. You should see a popup like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/435/1*qCmj5JRhZz8abUzDwXefqQ.png" /></figure><p>When deploying on the dropdown below “<em>Project version</em>” always select <strong>New</strong>. This will ensure the latest changes are applied to the new app.</p><p>It’s important to make sure that <em>“Execute the app as”</em> is set to <strong>Me</strong> and <em>“Who has access to the app”</em> is set to <strong>Anyone, even anonymous</strong>. This allows external services (like 46elks) to trigger the script. The actual spreadsheet is still private, of course.</p><p>Click <strong>Deploy</strong><em>. </em>Google will prompt you to inform you that authorization is required. Click <strong>Review Permissions</strong> and then <strong>Allow</strong>. You should see a confirmation dialogue with a URL (as the picture below). Copy this URL and login to your <a href="https://dashboard.46elks.com/">46elks dashboard</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/493/1*Nu39NKTodIeedqDFmfgV7g.png" /></figure><p>Navigate to your new virtual phone number by clicking <em>“Numbers” </em>and then <em>“Edit” </em>next to the number you want to use for this tutorial. You should see a window similar to the one below. Paste your google scripts URL into the <em>“sms_url” </em>section and click “<em>Save changes”</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/886/1*Ss3w-6l3s24VgtbeqUXDPw.png" /></figure><p><strong><em>Some helpful tips sometimes necessary in this section …</em></strong></p><p>If your script URL contains something like /u/0/ or /u/1/ (the number varies) you need to remove that part of the URL before setting the <strong>sms_url</strong>. For example in this URL you remove /u/0:</p><p><em>https://script.google.com/macros/</em><strong>u/0/</strong><em>s/AK…wvC/exec</em></p><p>And get:</p><p><em>https://script.google.com/macros/s/AK…wvC/exec</em></p><p>That’s it! You’re done! Send an SMS to your 46elks number and it will magically appear in your Google Sheet.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/962/1*aXirrqG2iwGaUB7uPGOjrg.png" /></figure><h3>Troubleshooting</h3><p>If you make changes to the script, you need to <strong>publish it again</strong> as a new version number. Don’t forget to update the <a href="https://dashboard.46elks.com/numbers"><em>sms_url</em></a> on 46elks to the updated URL.</p><p>Please be advised that Google has a limitation on how long a script is allowed to run: <strong>“maximum execution time”</strong>. It depends on which kind of Google account you use, the lowest time allows a script to run for 6 minutes. If you plan to send or receive a large amount of SMS at the same time, <strong>please contact 46elks support on +46766861004 or </strong><a href="/service/mailto:help@46elks.com"><strong>help@46elks.com</strong></a>.</p><p>That’s it for now, thanks for reading!</p><p>P.S. This post was updated September 2020 to keep up with changes in Google Sheets and to make it easier to use.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=435b51393493" width="1" height="1" alt=""><hr><p><a href="https://medium.com/46-thoughts/receive-sms-into-google-spreadsheet-435b51393493">Forwarding Incoming SMS to Google Sheets</a> was originally published in <a href="https://medium.com/46-thoughts">46 thoughts</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>