<?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[Stories by Jacob Lee on Medium]]></title>
        <description><![CDATA[Stories by Jacob Lee on Medium]]></description>
        <link>https://medium.com/@jacoblee93?source=rss-aa2b84f0afce------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*NHvMyjZptLuVIJYIODy9eg.jpeg</url>
            <title>Stories by Jacob Lee on Medium</title>
            <link>https://medium.com/@jacoblee93?source=rss-aa2b84f0afce------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 05:57:43 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@jacoblee93/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Build and Share API Integrations as OSS with Autocode Sources]]></title>
            <link>https://medium.com/@jacoblee93/build-and-share-api-integrations-as-oss-with-autocode-sources-b8e578563593?source=rss-aa2b84f0afce------2</link>
            <guid isPermaLink="false">https://medium.com/p/b8e578563593</guid>
            <category><![CDATA[autocode]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[nodejs]]></category>
            <dc:creator><![CDATA[Jacob Lee]]></dc:creator>
            <pubDate>Wed, 19 Aug 2020 15:31:26 GMT</pubDate>
            <atom:updated>2020-09-11T16:28:42.074Z</atom:updated>
            <content:encoded><![CDATA[<h3>Build and Share API Integrations as OSS with Autocode Apps</h3><p>One question I often get when talking to members of the <a href="https://autocode.com/">Autocode</a> community is, “what is the best way to share or open source my project?”. Many Autocode users are passionate about what they’ve been able to build (with good reason!), and they want to help other developers solve problems they’ve overcome.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1PUf3yYw_DQoPvOvWdu5yg.png" /><figcaption>Apps can also be great starting points for others</figcaption></figure><p>With this problem in mind, we’ve launched <a href="https://autocode.com/app/">Autocode Apps</a> –– a new side of Autocode that allows you to share your existing projects (sans sensitive environment variables) as <strong>apps</strong>. Other community members will be able to view, fork, and deploy the code you share with ease. If your app uses any linked resources (e.g. <a href="https://slack.com/">Slack</a> workspaces or <a href="https://airtable.com/">Airtable</a> bases), users forking your app will be prompted to link their own resources before deploying.</p><p>Creating an app is so easy, you can do it in three clicks! Here’s how:</p><h3>Click 1: Open a Project</h3><p>Simple enough. Head to <a href="https://autocode.com,/">https://autocode.com,</a> log in, and click on one of your projects.</p><figure><img alt="An existing Autocode project" src="https://cdn-images-1.medium.com/max/1024/1*1rMSWJ6d0mN62jy39xHwvQ.png" /><figcaption>Why not this one?</figcaption></figure><p>If you don’t have any projects, or you don’t want to share any of your existing ones, click the blue <strong>Create New Project</strong> button above and create a new one.</p><h3>Click 2: Press a Button</h3><p>In the top left part of the editor above your project files, you’ll see a white button that says <strong>Publish App</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/526/1*UlCUntCwVQzsb8jp1OP-jw.png" /><figcaption>It’s got a pencil next to it</figcaption></figure><p>Press it and you’ll see a modal window appear. Just one more step!</p><h3>Click 3: Review and Publish</h3><p>In the modal, you can see a preview of what the title of your app will be:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V1Pxr1YDfe3tm1VTpLXLXw.png" /><figcaption>This will appear at the top of your app’s page</figcaption></figure><p>We parse this automatically from the first line of your project&#39;s README.md. If you’d like to change this, you’ll have to spend some extra clicks, but it’s simple — exit the modal, modify your README file, and press <strong>Save</strong>. If your project requires any environment variables, you can add descriptions here for other users as well.</p><p><strong>Note:</strong> Your env.json and the secrets within are not made public when creating an app, but take care to remove sensitive keys from other parts of your project before turning it into an app!</p><p>When you’re ready, press <strong>Publish App</strong> and in a few moments, you’ll be redirected to your new app’s documentation page. You’re done!</p><h3>Whoa, Really?</h3><p>Yes, really! Your project is now available to everyone. Now, let’s walk through a few points of interest, from top to bottom:</p><p>At the top of the page is the title and, if you’re making any calls to any of the APIs in the <a href="https://autocode.com/lib/">Autocode Standard Library</a> (you can type await lib. in your project to see a sample of what’s available) or responding to events, you’ll see a list of tags matching the ecosystems you’re using.</p><figure><img alt="The source’s title with API tags" src="https://cdn-images-1.medium.com/max/1024/1*nJ0SEvhEDJPhZHRe-Adfnw.png" /><figcaption>The published app’s title with API tags</figcaption></figure><p>You can click <strong>Install </strong>yourself to get a sense of what others deploying their own version of your app will see.</p><p>Pressing <strong>View Source </strong>shows a quick summary of all the accessible endpoints in your app, as well as a list of all the folders and files at each level of your project. Try clicking a file, and you’ll see the contents of it below!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*H9OC8Of23cijqzrvN0vNFA.png" /><figcaption>You can conveniently browse all of your app’s files! Note that your env.json is not present</figcaption></figure><p>Navigate back to your app’s main page and scroll down. There, in styled markdown, you’ll see the contents of your README.md file!</p><h3>Making Changes</h3><p>At this point, if you just picked a random project you had, you’re probably wishing you could go back and edit your project –– maybe spruce up the README.md file or actually make it do something beyond just return &#39;Hello from Autocode!&#39;;.</p><p>This is actually really easy too –– just go back to the main <a href="https://autocode.com/manage">Autocode</a> project management page, find your project in the list, and open the <strong>Sandbox</strong> (not the App section). Make whatever changes you’d like, save them, then press <strong>Publish App</strong> again to publish a new version of your app!</p><h3>Embedding Images Into Your README</h3><p>One neat thing you can do with your apps is embed images into your README.md file natively within Autocode. This can make setup and guides far simpler to follow.</p><p>First, create a folder called readme/gallery/ by right clicking in the tree view on the left:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/688/1*kEN_ENzj079OkyjJak9ZnQ.png" /><figcaption>Right click and select “New Directory”</figcaption></figure><p>Right click again, select <strong>Upload Files</strong>, and upload some image files you’d like to add to your README.md file. Then, as you write your README, you can embed images like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/668/1*stYzoDnKejlsVUdhYDlmdA.png" /><figcaption>Either syntax works</figcaption></figure><p>You can use the markdown preview in the bottom right corner of the screen to see what embedded images will look like before publishing your app.</p><h3>Removing Your App</h3><p>If you’d like to take down your app, you can do so from the project management page. Find your project in the list, and hover over the pencil in the <strong>Apps</strong> section.</p><p>Select <strong>Delete App</strong> and your app will be gone.</p><h3>How Do I Show Up In Search Results?</h3><p>We personally vet top rated apps which appear in search results and the <a href="https://autocode.com/src/">main app page</a>. If you’d like to be featured like this, join our community Slack channel via the option under the <strong>Community </strong>tab at the top of the <a href="https://autocode.com/">main Autocode page</a> and let us know!</p><h3>Thanks for Reading!</h3><p>Hopefully this inspired you to build something neat! If you’re especially proud of an app you’ve created, we encourage you to share it. Post its URL on Twitter and tag us <a href="https://twitter.com/AutocodeHQ">@AutocodeHQ</a> and you’ll make our day!</p><p>If you enjoyed reading this, follow us on Twitter <a href="https://twitter.com/AutocodeHQ">@AutocodeHQ</a>, or join our vibrant Slack community channel using the directions above. You can also follow me or reach out to me directly <a href="https://twitter.com/hacubu">@hacubu</a> — I’ll be doing plenty more writing in the coming months.</p><p><em>Jacob Lee is the co-founder of Standard Library. He enjoys marquee HTML tags and talking about himself in the third person. Follow him on Twitter </em><a href="https://twitter.com/hacubu"><em>@hacubu</em></a><em>!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b8e578563593" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Distributing Slack Apps Built on Standard Library]]></title>
            <link>https://medium.com/@jacoblee93/distributing-slack-apps-built-on-standard-library-c4f0972d51b5?source=rss-aa2b84f0afce------2</link>
            <guid isPermaLink="false">https://medium.com/p/c4f0972d51b5</guid>
            <category><![CDATA[node]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[slack]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[slackbot]]></category>
            <dc:creator><![CDATA[Jacob Lee]]></dc:creator>
            <pubDate>Tue, 02 Jun 2020 03:59:35 GMT</pubDate>
            <atom:updated>2020-07-28T21:39:02.166Z</atom:updated>
            <content:encoded><![CDATA[<h3>Distributing Slack Apps Built on Autocode</h3><p>Over the past few years, thousands of developers have deployed Slack apps on Standard Library. With the release of <a href="https://autocode.stdlib.com/">Autocode</a>, creating apps for internal business use cases is easier than ever — you can prototype using the official Standard Library Slack app, then seamlessly switch to a personally managed custom app for finer-grained control.</p><p>Some users want to take this further, however, and distribute the apps they create across multiple workspaces or publish them to the Slack App Directory. In this guide, I’ll show you exactly how to do exactly this, starting from a Slack app built on Standard Library using the “<strong>Custom App</strong>” flow.</p><p>We will be making four major changes to your existing custom app:</p><ol><li>Creating a custom OAuth endpoint for your app to handle authentication across multiple workspaces.</li><li>Adding your custom Slack app’s <strong>Client ID</strong> and <strong>Client Secret</strong> as environment variables to your Standard Library project.</li><li>Implementing a simple way to store and retrieve tokens that the OAuth endpoint receives from different workspaces.</li><li>Enabling <strong>Distribution</strong> in your Slack app dashboard.</li></ol><p>Let’s get started!</p><h3>Step 1: Creating a Custom OAuth Handler</h3><p>The first change you’ll need to make is to add a custom OAuth endpoint to your project. Name this endpoint functions/slack/custom_oauth.js. Paste the following code into your new handler:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8315adf3a37f31d2a0b7b7cdc02b6024/href">https://medium.com/media/8315adf3a37f31d2a0b7b7cdc02b6024/href</a></iframe><p>Note that this code contains calls like lib.utils.kv. These calls invoke the <a href="https://stdlib.com/@utils/lib/kv">utils/kv</a> API, a simple key-value storage API offered on Standard Library that we’ll be using to store the incoming OAuth tokens by team_id.</p><p>Next, navigate to your app’s page in the Slack dashboard. Open the “OAuth and Permissions” tab, and change the Redirect URL from https://&lt;username&gt;.events.stdlib.com/slack/auth to a URL corresponding to the handler you just created — it should be something like: https://&lt;username&gt;.api.stdlib.com/&lt;project-name&gt;/slack/custom_oauth/ (don’t forget the trailing slash!).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/466/1*GEILdt_ssNCwA5V7PFIARw.png" /><figcaption>Under the OAuth &amp; Permissions tab…</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*X5De48B_6ghrAFOYH78GNg.png" /><figcaption>Paste the new OAuth URL!</figcaption></figure><p><strong>Note: </strong>If you are using our command line interface, you will need to run the following two commands to add dependencies to your project:</p><pre>$ npm install axios --save<br>$ npm install qs --save</pre><h3>Step 2: Adding Slack App Environment Variables</h3><p>Next, we need to add three variables to your project’s env.json file: SLACK_CLIENT_SECRET, SLACK_CLIENT_ID, and SLACK_APP_NAME. You can retrieve the first two of these from the <strong>Basic Information</strong> pane of your Slack app’s dashboard page under <strong>App Credentials</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S6n8TWWctvJGHoysddwY8w.png" /><figcaption>You’ll need the Client ID and Client Secret from this screen</figcaption></figure><p>Paste these variables into your project’s env.json file, along with the name of your Slack app as SLACK_APP_NAME:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/954/1*CO5q-bYQNbiiWmSeujOIMQ.png" /><figcaption>If you are using different Slack apps for dev vs. prod, paste keys accordingly</figcaption></figure><h3>Step 3: Modifying Event Handlers to Retrieve Workspace Tokens</h3><p>When incoming events come in from Slack, we will use the <strong>team_id</strong> parameter passed in via the event to determine which of the workspaces your app has been installed into, retrieve the proper OAuth token for that workspace, and use that token when making Slack API calls.</p><p>To do this, update the beginning of all of your Slack event handlers like this:</p><pre>let lib = require(&#39;lib&#39;); // Note no STDLIB_SECRET_TOKEN here</pre><pre>module.exports = async (event) =&gt; {<br>  <br>  // Note that team_id may be passed in differently for some events,<br>  // for example, &quot;event.team.id&quot;<br>  let workspaceData = await lib({<br>    token: process.env.STDLIB_SECRET_TOKEN<br>  }).utils.kv.get({<br>    key: `__SLACK_${process.env.SLACK_APP_NAME}__:${event.team_id}`<br>  });</pre><pre>  let workspaceToken = workspaceData &amp;&amp; workspaceData.access_token;<br>  <br>  let slackLib = lib({<br>    keys: {<br>      BOT_TOKEN: workspaceToken<br>    }<br>  });<br>  <br>  lib = lib({token: process.env.STDLIB_SECRET_TOKEN});</pre><pre>  // The rest of your handler code below, using &quot;slackLib&quot; in place<br>  // of &quot;lib&quot; for all of your Slack API calls</pre><pre>  // Use the familiar &quot;lib&quot; package for non-Slack API calls<br>  // await lib.airtable.query[&#39;<a href="http://twitter.com/0">@0</a>.5.3&#39;].select({<br>  //   table: `Test`<br>  // });<br>   </pre><pre>  // Use the custom initialized &quot;slackLib&quot; when dealing with<br>  // distributed Slack auth<br>  // await slackLib.slack.channels[&#39;<a href="http://twitter.com/0">@0</a>.6.7&#39;].messages.create({<br>  //   channel: `#general`,<br>  //   text: `This uses the custom distributed auth`<br>  // });</pre><p><strong>Important:</strong> This will set up slackLib to use workspaceToken in any API calls we make to Slack — do not pass in your actual STDLIB_SECRET_TOKEN to any of the Slack API calls because that will use whatever Slack Linked Resource you attached to your project! Continue to use lib for all of your other API calls.</p><p>After this, you’re done! Run lib up dev if you’re on the command line, or if you’re on <a href="https://autocode.stdlib.com/">Autocode</a>, press <strong>Save Endpoint</strong> and D<strong>eploy</strong> to deploy your API.</p><p><strong>Note:</strong> We recommend updating all of your Slack API calls here to the latest active versions — you can do this by removing the version tag entirely from all of your calls (e.g., the [‘@0.0.1’]), which will make them default to the latest deployed version.</p><p><strong>Note #2: </strong>Some Slack events may pass in team_id slightly differently (for example, event.team.id). Check the logs if something doesn’t appear to be working correctly.</p><h3>Step 4: Enabling Distribution</h3><p>The final step is to enable distribution of your app. From the Slack app dashboard, navigate to the <strong>Manage Distribution</strong> pane:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/504/1*tuPErY0oT7-MApqhHdxVVw.png" /><figcaption>The <strong>Manage Distribution</strong> pane in the sidebar</figcaption></figure><p>Then, scroll down to <strong>Share Your App with Other Workspaces</strong> and follow the checklist (most of the items should be satisfied already). Then, press <strong>Activate Public Distribution</strong> and you’re done!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LxuS4W1iIyyX0bCo8kYu_A.png" /><figcaption>Follow the checklist and click <strong>Activate Public Distribution</strong> when you’re done!</figcaption></figure><p>You can now use the <strong>Embeddable Slack Button </strong>or the<strong> Sharable URL</strong> to add your Slack app to other workspaces.</p><h3>That’s It!</h3><p>We hope this was helpful! We can’t wait to see what you’ll build.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c4f0972d51b5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Build a Slack App to Create and Apply Stripe Coupons in 4 Steps with Standard Library and Node.js]]></title>
            <link>https://javascript.plainenglish.io/build-a-slack-app-to-create-and-apply-stripe-coupons-in-4-steps-with-standard-library-and-node-js-b8a658328e8c?source=rss-aa2b84f0afce------2</link>
            <guid isPermaLink="false">https://medium.com/p/b8a658328e8c</guid>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[slack]]></category>
            <category><![CDATA[stripe]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Jacob Lee]]></dc:creator>
            <pubDate>Wed, 14 Aug 2019 06:59:28 GMT</pubDate>
            <atom:updated>2019-09-13T19:52:21.185Z</atom:updated>
            <content:encoded><![CDATA[<h4>Subscriptions are everywhere –– think Netflix, Blue Apron, Xbox Live, etc.–– and are a great way to capture value from your customers.</h4><h4>These days, it’s easier than ever to set up subscriptions thanks to products like <a href="https://stripe.com/billing">Stripe Billing</a> that drastically simplify the process.</h4><p>Though Stripe offers tons of utility, managing subscriptions requires granting access and navigating to secure dashboards, which can be overkill for more common administrative tasks.</p><p>In this article, we’ll walk through how to create your own <a href="https://slack.com/">Slack</a>-based Stripe coupon management app using <a href="https://build.stdlib.com/">Build on Standard Library</a>. Your app will be able to:</p><ul><li>Create coupon codes for all occasions (new subscribers, promos, etc.)</li><li>Apply coupons to existing subscribers</li><li>Solve world hunger and the energy crisis (just kidding)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lRUSzx7ORCmNEfH7oS2z7A.png" /><figcaption>Creating a coupon</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*08NLnFNpjeolI8R-ad0qdA.png" /><figcaption>Thanks, Coupon Bot!</figcaption></figure><p>Excited? Let’s get started!</p><h3>Prerequisites</h3><ul><li>1x <a href="https://stripe.com/">Stripe</a> Account</li><li>1x <a href="https://slack.com/">Slack</a> workspace (we recommend you start with a new “test” workspace –– you can painlessly release your app to an active workspace after testing)</li></ul><h3>Step 1: Opening the Project Template</h3><p>We’ll be building this product from an existing template in a GitHub repo. This repo has been configured to automatically create event subscriptions and trigger APIs using <a href="https://build.stdlib.com/">Build</a>! But don’t worry coders, you’ll be able to edit the code, add new handlers to other events, and otherwise customize it to your heart’s content after you deploy.</p><p>You can view the code on <a href="https://github.com/stdlib-examples/project-stripe-coupon-slack-app">GitHub here</a>. To get your personal version up and running, click the “<strong>Deploy</strong>” button in the README of the repository. You can also follow <a href="https://build.stdlib.com/from-github/?repo=stdlib-examples/project-stripe-coupon-slack-app">this link</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/352/1*UgKj9RQpc5MWg-hClriz4A.png" /><figcaption>You can’t miss it</figcaption></figure><p>You’ll be greeted by a page like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fYiBoIICDFpv-ApOtFWE7Q.png" /><figcaption>The five endpoints in our coupon bot</figcaption></figure><p>Our app has five endpoints:</p><ol><li>events/slack/command/apply-coupon.js, the handler that is triggered by a <strong>Slack slash command</strong>/apply-coupon. It opens a dialog with the callback id apply-coupon that, as you would expect, allows you to apply coupons to existing subscribers.</li><li>events/slack/command/create-coupon.js, the handler that is triggered by a <strong>slash command</strong> /create-coupon. It opens a dialog with the callback id create-coupon that allows you to create new coupons.</li><li>events/slack/dialog_submission/apply-coupon.js, the handler that gets called when you submit a dialog with callback id apply-coupon. It calls the Stripe API to update the appropriate subscription.</li><li>events/slack/dialog_submission/create-coupon.js, the handler that gets called when you submit a dialog with callback id create-coupon. It calls the Stripe API to create a coupon with the parameters from the coupon creation dialog.</li><li>message-menu.js, the endpoint that retrieves coupon and subscription data from Stripe and populates the menus in the dialog. It acts as a data source for the menus within the dialogs.</li></ol><p>Scroll down and you’ll see that we need to link Stripe and Slack accounts:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*r_6eBZsr46SsMi6XM3EaRg.png" /><figcaption>The accounts we need to link</figcaption></figure><h3>Step 2: Setting Up Stripe</h3><p>Let’s start with Stripe! Linking your Stripe account is very simple. Just click the <strong>Link Resource</strong> button in the Stripe row, select <strong>Link New Resource</strong> in the resulting dialog, and select your Stripe account in the following OAuth popup. Since you’re in testmode, just click <strong>Skip this account form </strong>to avoid unnecessary setup.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/840/1*3Xa0B-8AS8deodeTEgbYQA.png" /><figcaption>The Stripe OAuth popup</figcaption></figure><h3>Step 3: Setting Up Slack</h3><p>Setting up Slack requires a few more steps. For this app, we’ll need to:</p><ol><li>Create a Slack app</li><li>Create a <strong>Bot User</strong> for that app</li><li>Paste our <strong>Authentication Redirect URL</strong></li><li>Paste our <strong>Interactive Components URL</strong></li><li>Retrieve the credentials for your app and link it to your project’s <strong>Identity</strong></li><li>Register the /create-coupon <strong>Slash Command</strong></li><li>Register the /apply-coupon <strong>Slash Command</strong></li><li>Paste our <strong>Message Menu URL </strong>to populate the dropdowns in our dialogs</li></ol><p>Fortunately, each step only takes a minute! To get started, click the <strong>Link Resource</strong> button in the Slack row. This will bring up a built-in guide that will walk you through the first five steps:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HXZbIR-cVVQmNCV2cTTUYQ.png" /><figcaption>Screenshots included!</figcaption></figure><p>Carefully read through and follow each section of the guide before clicking <strong>Next Step</strong>, pasting the URLs it supplies into the appropriate places in your <a href="https://api.slack.com/apps">Slack app dashboard</a>. After you’ve done this, you’ll need to set up three additional URLs: two slash commands (/create-coupon and /apply-coupon) as well as the data source for the dropdowns in the dialogs.</p><p>Navigate to your <a href="https://api.slack.com/apps">Slack app dashboard</a>, and select the app you just created. Next, select <strong>Slash Commands</strong> from the left sidebar and press <strong>Create New Command</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VAUHAuLGXGrAOz1Br2vOiQ.png" /><figcaption>Creating a new command</figcaption></figure><p>Name the command create-coupon. Use https://&lt;your Standard Library username&gt;.events.stdlib.com for the <strong>Request URL</strong>. Click <strong>Save</strong> in the bottom right once you’re done, and repeat this process to create a second slash command named apply-coupon.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8JUoNVIIPwLMvgtRjQnxbw.png" /></figure><p>Almost done! Select <strong>Interactive Components</strong> in the left sidebar, scroll down, and populate <strong>Message Menus</strong> with this URL: https://&lt;your Standard Library username&gt;.api.stdlib.com/coupon-bot@dev/message-menu/.</p><p><strong>Note:</strong> The trailing slash is important –– don’t forget it!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*w-gpTa0ZCf1yrXaizFpkbg.png" /><figcaption>Setting up the data source for the dropdowns in the dialogs. Don’t forget the trailing slash!</figcaption></figure><h3>Step 4: Ship It!</h3><p>We’re ready to go! Now we can click the “<strong>Deploy Project</strong>” button at the button of the page on <a href="http://build.stdlib.com/">Build</a>. Once it’s finished, open up the Slack workspace you installed the app in. Try running /create-coupon and creating a coupon from the resulting dialog!</p><p>If you have existing infrastructure to handle coupon codes, you can give them directly to your customers. Otherwise, you can use /apply-coupon to apply coupons you create with /create-coupon directly to a subscriber. If you don’t have any existing testmode subscribers, you can create one from your <a href="https://dashboard.stripe.com/">Stripe dashboard</a> by creating a test customer, payment source, product, and finally, subscription.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UESsR-dk4ARs_lNYqB1Nkg.png" /><figcaption>Applying a coupon</figcaption></figure><h3>Making More Modifications: It’s Just Code!</h3><p>Although we didn’t write any code during this tutorial, we imported directly from a GitHub template –– which means we have complete control over all the code that powers our workflow(s) and app. To edit and iterate on the code, select the <strong>dev </strong>environment from the list in project management screen, scroll down, and click the <strong>Edit Code</strong> button in front of any of the endpoints.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*J06Vjs2JqN9pzJf1-EKxyg.png" /><figcaption>Click “Edit Code” to open your code in code.stdlib.com</figcaption></figure><p>This will open your app’s code in <a href="https://code.stdlib.com/">code.stdlib.com</a>, our online code editor. You can also use our <a href="https://github.com/stdlib/lib">command line tools</a> to download and redeploy your app if you’d prefer to work locally.</p><h3>When You’re Ready: Shipping to Production</h3><p>Once you’ve deployed and iterated on your app and tested it with your test workspace and testmode Stripe account, switching to use production data is simple. From the project management screen in Build, simply click the <strong>Ship Release</strong> button. You’ll be prompted to link the live version of your Stripe account and a new Slack workspace, which should be the workspace you actually intend to use the app in. You’ll have to repeat the process of setting up the slash commands and message menu data source as well.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NnqjBXlFCX8aikyu7N11dg.png" /><figcaption>Click “Ship Release”</figcaption></figure><h3>That’s it! Thank you!</h3><p>We hope you and your customers enjoy using your new coupon management app! If you have any ideas or improvements, feel free to open up a pull request in <a href="https://github.com/stdlib-examples/project-stripe-coupon-slack-app">the template’s repository</a>.</p><p>For additional help <a href="https://docs.stdlib.com/">see our documentation</a>, or join our Slack workspace by visiting <a href="https://docs.stdlib.com/">https://docs.stdlib.com/</a> and clicking <strong>Request Slack Community Invitation</strong> on the right.</p><p>Thanks again! Please follow Standard Library on Twitter, <a href="https://twitter.com/stdlibhq">@StdLibHQ</a>, or me personally (<a href="https://twitter.com/hacubu">@hacubu</a>) for product updates! We’ve got a lot more exciting things coming.</p><p><em>Jacob Lee is the co-founder of Standard Library. He enjoys Super Smash Bros., playing squash, and talking about himself in the third person. Follow him on Twitter </em><a href="https://twitter.com/hacubu"><em>@hacubu</em></a><em>!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b8a658328e8c" width="1" height="1" alt=""><hr><p><a href="https://javascript.plainenglish.io/build-a-slack-app-to-create-and-apply-stripe-coupons-in-4-steps-with-standard-library-and-node-js-b8a658328e8c">Build a Slack App to Create and Apply Stripe Coupons in 4 Steps with Standard Library and Node.js</a> was originally published in <a href="https://javascript.plainenglish.io/">JavaScript in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Build a “Serverless” SMS Crypto Price Checker in 6 Minutes with MessageBird and StdLib]]></title>
            <link>https://medium.com/@jacoblee93/build-a-serverless-sms-crypto-price-checker-in-6-minutes-with-messagebird-and-stdlib-a96e826e29aa?source=rss-aa2b84f0afce------2</link>
            <guid isPermaLink="false">https://medium.com/p/a96e826e29aa</guid>
            <category><![CDATA[stdlib]]></category>
            <category><![CDATA[serverless]]></category>
            <category><![CDATA[bots]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[cryptocurrency]]></category>
            <dc:creator><![CDATA[Jacob Lee]]></dc:creator>
            <pubDate>Tue, 01 May 2018 07:58:40 GMT</pubDate>
            <atom:updated>2019-05-18T23:40:37.936Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Update: </strong>The MessageBird API on Standard Library has been deprecated. Your existing SMS hubs will continue to function, but we recommend using our <a href="https://stdlib.com/@utils/lib/sms">utils.sms API</a> instead.</p><p>Investing in cryptocurrency is not for the faint of heart. Prices swing wildly from day to day, or even minute to minute:</p><blockquote>A kid asks his dad for $10 worth of Bitcoin. His dad responds: $8.32? What do you need $15.58 for?</blockquote><p>How can anyone keep up? One solution, which I’ll show you how to build in this article, is to create an SMS bot that can look up prices via text! No data, no problem!</p><p>I’ll walk you through setting up <a href="https://messagebird.com/">MessageBird</a> telephony on <a href="https://stdlib.com/">StdLib</a>, claiming your first free phone number, and finally, creating and setting an SMS response handler to retrieve cryptocurrency data and text back a result. It’ll also be easy to tweak the end result to support additional functionality.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ov2te_LbaD0SXKLlBiWkSQ.png" /><figcaption>Example results from querying for cryptocurrency prices</figcaption></figure><p><em>If you’re not familiar with </em><a href="https://stdlib.com/"><em>StdLib</em></a><em> yet, you’re in for a treat! We’re a serverless API development and publishing platform that can help you build and ship custom logic in record time.</em></p><h3>What You’ll Need Beforehand</h3><ul><li>1x Command Line Terminal With <a href="https://nodejs.org/en/">Node.js</a> Installed</li><li>6x Minutes (or 360x Seconds)</li><li>A US Cell Phone Number</li><li>1x Nerves of Steel</li></ul><h3>Minute 1: Initialize MessageBird on StdLib</h3><p>The first step is to get started with MessageBird on StdLib by claiming your first phone number. We’re going to be using a service called messagebird.numbers to interface with MessageBird’s API.</p><p>Navigate to the <a href="https://stdlib.com/@messagebird/lib/numbers/">messagebird.numbers service page on StdLib</a> and accept the terms of service by clicking the link underneath the service description. You’ll be prompted to create an account or log in.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OjElSMhK9ykzYLqe2M1QIw.png" /><figcaption>Accept the MessageBird terms of service to get started</figcaption></figure><p>After you’ve done that, you can claim your first number directly from the browser! Scroll down the page to the available method on the numbers API:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gv7uFVW02UQ7T0iWBBGWQQ.png" /><figcaption>The “available” method in the messagebird.numbers API</figcaption></figure><p>Currently, only Canadian and US numbers are available — choose the appropriate country code based on your location. Select one of your StdLib tokens from the dropdown and press the “Run Function” button to see a list of available numbers.</p><p>Copy one from the list, then scroll down a bit farther to the initialize method.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ujT68Cr-3yQihNsGG5TUnQ.png" /><figcaption>The “initialize” method in the messagebird.numbers API</figcaption></figure><p>The initialize function will claim an initial phone number for personal use, and is free. Enter the number you copied above into the number parameter input, and press “Run Function” to claim your number.</p><p>Congratulations! You’ve successfully initialized MessageBird on StdLib! You can test this by sending a text message using the messagebird.sms service. Navigate to the <a href="https://stdlib.com/@messagebird/lib/sms">API page</a> and try the create function with your personal phone number as a recipient — you should receive a text message from the number you’ve just claimed!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-NHpESWMUudhwKX-0N9MaQ.png" /><figcaption>The “create” method in the messagebird.sms API</figcaption></figure><h3>Minute 2: Set Up the StdLib Command Line Tools</h3><p>To create and manage your own StdLib services, you’ll have to install the StdLib CLI. Open up a terminal and run:</p><pre>$ npm install lib.cli -g</pre><p>Next, we’re going to create a workspace for your StdLib functions. Create a new folder and initialize it with the following commands:</p><pre>$ mkdir stdlib-workspace<br>$ cd stdlib-workspace<br>$ lib init</pre><p>Log in with the StdLib credentials you created earlier.</p><h3>Minute 3: Fork the SMS Handler Sourcecode</h3><p>Now that you’ve claimed your first MessageBird phone number and set up the CLI, we’ll walk you through the process of creating a handler that will respond to incoming SMS messages. From your main StdLib workspace in your terminal, fork the starter sourcecode by running:</p><pre>$ lib create -s @messagebird/messagehub</pre><p>You can name your service whatever you’d like — the remainder of the tutorial will assume you’ve called your service “messagebirdCryptoHandler”.</p><p>The code will appear in the folder &lt;username&gt;/messagebirdCryptoHandler. Run $ cd &lt;username&gt;/messagebirdCryptoHandler and run $ code . or something similar to open the directory in your favorite text editor.</p><p>Your handler service contains three endpoints within the functionsdirectory:</p><ol><li>__main__.js, the main endpoint of your handler. This function will receive events triggered by incoming SMS messages to your MessageBird number and will call other handlers appropriately</li><li>messaging/more.js, a handler for incoming messages that contain the word “more” as their sole contents</li><li>messaging/__notfound__.js, a “not found” handler. If the incoming message can not be mapped to a named function (like more), this handler will be triggered</li></ol><p>For this application we will be modifying messaging/__notfound__.js.</p><p>Copy the code below and replace the contents of messaging/__notfound__.js</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/aa3c58aad3a658eeb13164df5c1cfa43/href">https://medium.com/media/aa3c58aad3a658eeb13164df5c1cfa43/href</a></iframe><p>A quick explanation of how it works: MessageBird passes in four parameters to an SMS handler. These are the MessageBird number receiving the message, which will be the number you claimed earlier, the outside number that sent the incoming message, the contents of the message, and the time the message was sent.</p><p>The handler above takes the contents of the message and attempts to match it to info retrieved from <a href="https://stdlib.com/@jacoblee/lib/cryptoInfo">jacoblee.cryptoInfo</a>, a different published service on StdLib that wraps the <a href="https://coinmarketcap.com/">CoinMarketCap API</a>, using the name or symbol of the cryptocurrency. It then calls <a href="https://stdlib.com/@messagebird/lib/sms">messagebird.sms.create</a> to send a reply text with currency info back to the sender of the original message. You can make whatever changes you want though!</p><h3>Minute 4: Setting Your StdLib Token</h3><p>You may have noticed that the definition of lib in the above code contains a process.env.STDLIB_TOKEN environment variable. We’ll have to add this to our service’s env.json file.</p><p>First, fetch your StdLib Token from the <a href="https://dashboard.stdlib.com/dashboard/">StdLib Dashboard</a>. You’ll be asked to log in again — once you’ve done so, click on <strong>Library Tokens</strong> on the left and you’ll see this page:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yJHYIq8SkyAIKM6hb_-X5w.png" /><figcaption>Click “Show Token” to see your library token</figcaption></figure><p>This is your StdLib auth token, click <strong>Show token</strong> to see its value and copy and paste it to your env.json file under STDLIB_TOKEN for &quot;local&quot; and &quot;dev&quot; environments.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/518/1*xKX5nUt9HhiPZAiT9K5Ymg.png" /><figcaption>Default contents of the env.json file</figcaption></figure><h3>Minute 5: Deploying Your Handler</h3><p>When you’re ready, run the following command from your service directory:</p><pre>$ lib up dev</pre><p>This will release your service to a mutable development environment. Your service will be available at https://&lt;username&gt;.api.stdlib.com/messagebirdCryptoHandler@dev, but you won’t need to call it directly.</p><h3>Minute 6: Setting Your Handler</h3><p>The final step is setting the service you just deployed as a handler. Run the following command from your command line:</p><pre>$ lib messagebird.handlers.sms.set \<br>  --number &lt;your previously claimed phone number&gt; \<br>  --identifier &lt;username&gt;.messagebirdCryptoHandler[@dev]</pre><p>You can see your claimed numbers by running $ lib messagebird.numbers.list if you need to see your claimed number again.</p><p>Then, simply send an SMS message matching either the name or symbol of a cryptocurrency (for example, “Dogecoin” or “ETH”) to your claimed number to see the current price!</p><p>And that’s it! You now have a personal SMS-based crypto price checker!</p><h3>Customizing Your Handler</h3><p>You can customize the handler to run any kind of code you’d like — text back responses from other APIs, use message contents to query a database, forward incoming messages to Slack using Slack’s API — the sky is the limit! Just install whatever npm packages you need and modify the functions/messaging/__notfound__.js handler with whatever logic you want.</p><p>Thanks for reading! For more content, features, and announcements, stay tuned by following us on Twitter <a href="https://twitter.com/stdlibhq">@StdLibHQ</a> or me <a href="https://twitter.com/hacubu">@hacubu</a>. You can also join our Slack channel by going to our <a href="https://stdlib.com/">homepage</a> and requesting an invite under the “Community” tab. Reach out anytime.</p><p>I can’t wait to see what you build!</p><p><em>Jacob Lee is one of the co-founders of </em><a href="https://stdlib.com/"><em>StdLib</em></a><em> and firm believer in the FaaS future. He’s an east-coast transplant and ex-Googler who loves skiing, playing squash, and traveling. Follow him on Twitter </em><a href="https://twitter.com/hacubu"><em>@hacubu</em></a><em>!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a96e826e29aa" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Build a “Serverless” SMS Hub in Under 7 Minutes with Node.js, StdLib, and MessageBird]]></title>
            <link>https://medium.com/stdlibhq/build-a-serverless-sms-hub-in-under-7-minutes-with-node-js-stdlib-and-messagebird-7d2d41ecaea6?source=rss-aa2b84f0afce------2</link>
            <guid isPermaLink="false">https://medium.com/p/7d2d41ecaea6</guid>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[messaging-apps]]></category>
            <category><![CDATA[stdlib]]></category>
            <category><![CDATA[serverless]]></category>
            <category><![CDATA[api-integration]]></category>
            <dc:creator><![CDATA[Jacob Lee]]></dc:creator>
            <pubDate>Thu, 01 Mar 2018 03:23:36 GMT</pubDate>
            <atom:updated>2019-05-18T23:40:53.534Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Update: </strong>The MessageBird API on Standard Library has been deprecated. Your existing SMS hubs will continue to function, but we recommend using our <a href="https://stdlib.com/@utils/lib/sms">utils.sms API</a> instead.</p><p>With giants such as Uber and Domino’s among their customers, <a href="https://messagebird.com/">MessageBird</a> has dominated the international programmatic telecommunications market by enabling developers to seamlessly build powerful SMS functionality into their apps.</p><p>We at StdLib are now extremely excited to announce an <a href="https://medium.com/stdlibhq/announcing-messagebird-api-on-stdlib-add-sms-to-your-application-in-one-line-of-code-5eb5a01e4344">official partnership with MessageBird</a>! The <a href="https://stdlib.com/@messagebird">MessageBird API on StdLib</a> allows users to not only <a href="https://stdlib.com/@messagebird/lib/sms">send text messages</a>, but set StdLib functions as handlers that trigger <a href="https://stdlib.com/@messagebird/lib/handlers">in response to incoming SMS messages</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*jOG3eZaCgM_QdQSYbMnlDA.png" /></figure><p>In this guide, we’ll walk through a simple example here of creating a StdLib service that responds to incoming messages. The end result will be fully customizable to support whatever SMS messaging functionality you require. Let’s get started!</p><h3>What You’ll Need Beforehand</h3><ul><li>1x Command Line Terminal</li><li>A Cell Phone</li><li>7x Minutes (or 420x Seconds)</li></ul><h3>Minute 1: Claim Your StdLib Namespace</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5U3GTxfSxPil1jTlLDn0Xg.png" /><figcaption>Start by claiming your StdLib namespace</figcaption></figure><p>Getting started with StdLib is easy — head over to our <a href="https://stdlib.com/">website</a>, choose a username and hit “<strong>Claim Namespace</strong>”. Your namespace, or username, is where all your services get published. For instance, your SMS handler will be called lib.&lt;username&gt;.messagehub.</p><p>In order to deploy services to StdLib, you’ll need to install our <a href="https://github.com/stdlib/lib">open source command line tools</a>. If you don’t have at least <strong>Node.js version 8.x </strong>installed, you can download the latest version, along with npm, <a href="https://nodejs.org/en/download/">here</a>.</p><p>With Node installed, install the StdLib CLI by opening up a terminal and running:</p><pre>$ npm install lib.cli -g</pre><p><strong>Note: Even if you’ve previously installed the CLI, you’ll still need to update to the latest version for this tutorial using the above command.</strong></p><p>Next, we’re going to create a workspace for your StdLib functions. Create a new folder and initialize it with the following commands:</p><pre>$ mkdir stdlib-workspace<br>$ cd stdlib-workspace<br>$ lib init</pre><p>Enter the credentials you created earlier.</p><h3>Minute 2: Initialize MessageBird on StdLib</h3><p>Next, we’ll get started with MessageBird on StdLib by claiming your first phone number. We’re going to be using a service called messagebird.numbers to interact with MessageBird numbers.</p><p>Navigate to the <a href="https://stdlib.com/@messagebird/lib/numbers">messagebird.numbers service page on StdLib</a> and accept the terms of service by clicking the link underneath the service description.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rFbasXqXVI39rDeqD3q31g.png" /><figcaption>Click the link under the description to view and accept the terms of service</figcaption></figure><p>The same terms of service applies to the other MessageBird functions as well.</p><p>After you’ve done that, return to your terminal and call the available function like this:</p><pre>$ lib messagebird.numbers.available --country &lt;CA or US&gt;</pre><p>Currently, only Canadian and US numbers are available — choose the appropriate country code based on your location. You should see a list of available, unclaimed telephone numbers.</p><p>Choose one from the list, then run:</p><pre>$ lib messagebird.numbers.initialize --number &lt;chosen phone number&gt;</pre><p>The initialize function will claim an initial number, and is free.</p><p>Once you have successfully initialized MessageBird on StdLib, you can test it by sending a text message with the <a href="https://stdlib.com/@messagebird/lib/sms">messagebird.sms.create</a> function. Run the following command from your terminal:</p><pre>$ lib messagebird.sms.create \<br>  --recipient &lt;your personal phone number&gt; \<br>  --body Hello from StdLib!</pre><p>And you should receive a text message from the number you’ve just claimed!</p><p>The messagebird.sms.create function will choose one of your claimed numbers by default, but you can also choose a specific number to send a message from using the originator parameter like this: --originator &lt;your claimed phone number&gt;.</p><h3>Minute 3: Fork the SMS Handler Sourcecode</h3><p>Now that you’ve claimed your first MessageBird phone number, we’ll walk you through the process of creating a handler that will respond to incoming SMS messages. From your main StdLib workspace in your terminal, fork the starter sourcecode by running:</p><pre>$ lib create -s @messagebird/messagehub</pre><p>You’ll be prompted to give your service a name — you can call it whatever yu want, but the rest of the tutorial will assume you call your service “messagehub”.</p><p>The code will appear in the folder &lt;your username&gt;/messagehub. Run $ cd &lt;your username&gt;/messagehub and run $ atom . or something similar to open the directory in your favorite text editor. Your handler service contains three endpoints within the functions directory:</p><ol><li>__main__.js, the main endpoint of your handler. This function will receive events triggered by incoming SMS messages to your MessageBird number and will call other handlers appropriately</li><li>messaging/more.js, a handler for incoming messages that contain the word “more” as their sole contents</li><li>messaging/__notfound__.js, a “not found” handler. If the incoming message can not be mapped to a named function (like more) this handler will be triggered</li></ol><p>You can test the outputs of your MessageBird hub for given input messages from your command line by running:</p><p>$ lib . --message more</p><p>This will route to your messaging/more.js handler, and you’ll see a simulated output of what someone texting your phone number would receive in reply. Try some other messages as well!</p><h3>Minute 4: Setting Your StdLib Token</h3><p>Looking through your hub’s code, you may have noticed that the definition of lib contains a process.env.STDLIB_TOKEN environment variable. We’ll have to add this to our service’s env.json file to get our hub working.</p><p>First, fetch your StdLib Token from the <a href="https://dashboard.stdlib.com/dashboard/">StdLib Dashboard</a>. You’ll be asked to log in again — once you’ve done so, click on <strong>Library Tokens</strong> on the left and you’ll see this page:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yJHYIq8SkyAIKM6hb_-X5w.png" /><figcaption>Click “Show Token” to See Your Library Token</figcaption></figure><p>This is your StdLib auth token, click <strong>Show token</strong> to see its value and copy and paste it to your env.json file under STDLIB_TOKEN for &quot;local&quot; and &quot;dev&quot; environments.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/518/1*xKX5nUt9HhiPZAiT9K5Ymg.png" /><figcaption>Default contents of the env.json file</figcaption></figure><h3>Minute 5: Deploying Your Handler</h3><p>When you’re ready, run the following command from your service directory:</p><pre>$ lib up dev</pre><p>This will release your service to a mutable development environment. Your service will be available at https://&lt;username&gt;.api.stdlib.com/messagehub@dev/, but you won’t need to call it directly.</p><h3>Minute 6: Setting Your Handler</h3><p>The final step is setting the service you just deployed as a handler. Run the following command from your command line:</p><pre>$ lib messagebird.handlers.sms.set \<br>  --number &lt;your previously claimed phone number&gt; \<br>  --identifier &lt;username&gt;.messagehub[@dev]</pre><p>You can see a list of your claimed numbers by running $ lib messagebird.numbers.list if you need to see your claimed number again.</p><h3>Minute 7: Testing Your Hub</h3><p>To test your new hub, simply send an SMS message to your claimed MessageBird number:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vJgQ0qtsCkFFs8TzHzeriw.png" /><figcaption>Some sample texts you can send to your new message hub</figcaption></figure><p>And that’s it! You now have an SMS message hub built on MessageBird!</p><h3>Customizing Your Handler</h3><p>You can customize the handler to run any kind of code you’d like — text back responses from other APIs, use message contents to query a database, forward incoming messages to Slack using Slack’s API — the sky is the limit! Just install whatever npm packages you need and add new handlers within the functions directory with whatever logic you want.</p><p>Thanks for reading! For more content, features, and announcements, stay tuned by following us on Twitter <a href="https://twitter.com/stdlibhq">@StdLibHQ</a>, MessageBird <a href="https://twitter.com/messagebird">@messagebird</a>, or me <a href="https://twitter.com/hacubu">@hacubu</a>. You can also join our Slack channel by going to our <a href="https://stdlib.com/">homepage</a> and requesting an invite under the “Community” tab. Reach out anytime.</p><p>I can’t wait to see what you build!</p><p><em>Jacob Lee is one of the co-founders of </em><a href="https://stdlib.com/"><em>StdLib</em></a><em> and firm believer in the FaaS future. He’s an east-coast transplant and ex-Googler who loves skiing, playing squash, and traveling. Follow him on Twitter </em><a href="https://twitter.com/hacubu"><em>@hacubu</em></a><em>!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7d2d41ecaea6" width="1" height="1" alt=""><hr><p><a href="https://medium.com/stdlibhq/build-a-serverless-sms-hub-in-under-7-minutes-with-node-js-stdlib-and-messagebird-7d2d41ecaea6">Build a “Serverless” SMS Hub in Under 7 Minutes with Node.js, StdLib, and MessageBird</a> was originally published in <a href="https://medium.com/stdlibhq">Standard Library</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[StdLib Platform Updates: Functions Run on Node 8.9.4, Automatic Error Logging]]></title>
            <link>https://medium.com/stdlibhq/stdlib-platform-updates-functions-run-on-node-8-9-4-automatic-error-logging-16c9668efb65?source=rss-aa2b84f0afce------2</link>
            <guid isPermaLink="false">https://medium.com/p/16c9668efb65</guid>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[serverless]]></category>
            <category><![CDATA[stdlib]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Jacob Lee]]></dc:creator>
            <pubDate>Thu, 25 Jan 2018 08:08:15 GMT</pubDate>
            <atom:updated>2018-01-25T08:10:14.233Z</atom:updated>
            <content:encoded><![CDATA[<p>Hey everyone! I’m excited to announce some <a href="https://stdlib.com/">StdLib</a> platform updates. We’ve added support for automatic logging of uncaught errors within a function — including mistakes like typos within live functions. We’ve also updated the default Node engine to <strong>Node 8.9.4</strong>.</p><p>If you’re not familiar with StdLib, we’re a function as a service (FaaS) library that allows users to rapidly create, discover, and consume APIs as web functions. We’re the fastest way for developers to turn their code into a live, infinitely-scalable, production-ready endpoint. <a href="https://github.com/stdlib/lib">This tutorial</a> on our Github page will walk you through the process of signing up and creating your first service. You can also check out our most recent product, <a href="https://stdlib.com/sourcecode">StdLib Sourcecode</a>, which makes creating a wide variety of production-ready projects dead simple.</p><h3>Automatic Error Logging</h3><p>Have you ever built a <a href="https://stdlib.com/@slack/src/app">Slack bot</a> or other webhook reliant project where you don’t directly see the response of your function execution? Even a simple uncaught syntax error can cause your service to mysteriously fail.</p><p>With today’s update, StdLib now automatically logs uncaught exceptions, giving you greater insight into these cases. As an example, the following StdLib function contains some invalid values:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/83e6f3f9191905aec77e93d5b72ecc92/href">https://medium.com/media/83e6f3f9191905aec77e93d5b72ecc92/href</a></iframe><p>If you run $ lib up dev, then attempt to execute the function and check your service logs by running:</p><pre>$ lib logs &lt;username&gt;.&lt;service name&gt;[@dev] -t stderr</pre><p>(Note the -t stderr in the above command) You should see:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ePxWqFp4NY4gHpSMBiIQDw.png" /></figure><p>This functionality should make debugging various services and projects far easier, even when you can’t directly see the response!</p><h3>Node 8.9.4 Support</h3><p>StdLib now ships with Node 8.9.4 as the default engine for functions. To use the previous engine version, you should manually set &quot;engine&quot;: &quot;nodejs-8.9.1&quot;in the &quot;stdlib&quot; field of your package.json. You can check out the release notes for Node 8.9.4 <a href="https://nodejs.org/en/blog/release/v8.9.4/">here</a>.</p><h3>That’s it!</h3><p>We’ve got more exciting features and announcements coming up in the next few weeks, so stay tuned by following us on Twitter <a href="https://twitter.com/stdlibhq">@StdLibHQ</a>. You can also join our Slack channel by going to our <a href="https://stdlib.com/">homepage</a> and requesting an invite under the “Community” tab. Feel free to reach out anytime!</p><p><em>Jacob Lee is one of the co-founders of </em><a href="https://stdlib.com/"><em>StdLib</em></a><em> and firm believer in the FaaS future. He’s an east-coast transplant and ex-Googler who loves skiing, playing squash, and traveling. Follow him on Twitter </em><a href="https://twitter.com/hacubu"><em>@hacubu</em></a><em>!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=16c9668efb65" width="1" height="1" alt=""><hr><p><a href="https://medium.com/stdlibhq/stdlib-platform-updates-functions-run-on-node-8-9-4-automatic-error-logging-16c9668efb65">StdLib Platform Updates: Functions Run on Node 8.9.4, Automatic Error Logging</a> was originally published in <a href="https://medium.com/stdlibhq">Standard Library</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Build Custom “Serverless” Push Notifications for Any Website in 6 Minutes with StdLib and PhantomJS]]></title>
            <link>https://medium.com/@jacoblee93/build-custom-serverless-push-notifications-for-any-website-in-6-minutes-with-stdlib-and-phantomjs-ea67c988801f?source=rss-aa2b84f0afce------2</link>
            <guid isPermaLink="false">https://medium.com/p/ea67c988801f</guid>
            <category><![CDATA[serverless]]></category>
            <category><![CDATA[push-notification]]></category>
            <category><![CDATA[npm]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[stdlib]]></category>
            <dc:creator><![CDATA[Jacob Lee]]></dc:creator>
            <pubDate>Thu, 28 Dec 2017 07:05:32 GMT</pubDate>
            <atom:updated>2017-12-28T07:24:18.016Z</atom:updated>
            <content:encoded><![CDATA[<p>Push notifications are a great way to stay informed on content you’re interested in. However, not every website supports them. For example, have you ever wanted to know when one of your favorite npm packages updates? How about when your favorite author on Medium publishes a new story?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/991/1*zbcKieQxtnLLwlxs49WcpA.png" /><figcaption>Example of a custom push notification with StdLib + PhantomJS</figcaption></figure><p>I’ll here show you how you can create custom push notifications that trigger when a website changes. We’ll use a <a href="https://github.com/ariya/phantomjs">Node binding</a> for <a href="http://phantomjs.org/">PhantomJS</a> to get the contents of a webpage, then use a <a href="https://docs.stdlib.com/main/#/scheduled-tasks">StdLib scheduled task</a> to look for the changes we’re interested in and send a text message alert when appropriate.</p><p>The initial version of the service will trigger when a new version of an npm package is released, but you’ll be able to adapt it to any website that you want!</p><p>If you haven’t heard of <a href="https://stdlib.com/">StdLib</a> before, we’re the fastest way to build backend web services and ship real business value. Built on “serverless” architecture, you never have to worry about managing servers or allocating resources for scale. Write a function, deploy, and you’re ready to go! We also have a growing ecosystem of easy-to-use <a href="http://www.stdlib.com/sourcecode">integrations</a> created by our developers.</p><h3>Minute 1: Claim Your StdLib Namespace</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5U3GTxfSxPil1jTlLDn0Xg.png" /><figcaption>Start by claiming your StdLib namespace</figcaption></figure><p>Getting started with StdLib is easy — head over to our <a href="https://stdlib.com/">website</a>, choose a username and hit “<strong>Claim Namespace</strong>”. Your namespace, or username, is where all your services get published. For instance, your push notification service will be called lib.&lt;username&gt;.custom-push-notifications.</p><h3>Minute 2: Fork the Push Notification Sourcecode</h3><p>In order to deploy services to StdLib, you’ll need to install our <a href="https://github.com/stdlib/lib">open source command line tools</a>. If you don’t have at least Node.js version 8.x installed, you can download the latest version, along with npm, <a href="https://nodejs.org/en/download/">here</a>.</p><p>With Node installed, you can install the StdLib CLI by opening up a terminal and running:</p><pre>$ npm install lib.cli -g</pre><p>Next, we’re going to create a workspace for your StdLib functions. Create a new folder and initialize it with the following commands:</p><pre>$ mkdir stdlib-workspace<br>$ cd stdlib-workspace<br>$ lib init</pre><p>You’ll be prompted to enter the credentials you just created earlier. Next, let’s get the starter code for your push notification service. Run the following command from your terminal:</p><pre>$ lib create -s @jacoblee/custom-push-notifications</pre><p>You’ll be prompted for a service name. You can name it whatever you’d like, but the rest of this tutorial will assume it’s custom-push-notifcations.</p><p>The previous command created a directory containing your service. You’ll do all management for your service from that directory. Navigate there with:</p><pre>$ cd &lt;username&gt;/custom-push-notifications</pre><h3>Minute 3: Create Your Environment Variables</h3><p>The logic for your service is contained entirely in the __main__.js file in the functions directory of the service. It retrieves the contents of a webpage at the url parameter you pass in, searches for a value (the npm version string in the default example) using a regex, then compares it to a <a href="https://stdlib.com/@utils/lib/storage">stored</a> value. If the value has changed, it sends an alert using the <a href="https://stdlib.com/@utils/lib/sms">utils.sms</a> function and updates the stored value. Pretty simple!</p><p>Before we deploy our service, we have to fill in some environment variables. Open the env.json file found in the root of the service directory you just created. There are two fields: STDLIB_TOKEN and ACCESS_KEY.</p><p>The STDLIB_TOKEN you supply is used to authorize the utils.storage StdLib function call. You can find a token in your StdLib <a href="https://dashboard.stdlib.com/dashboard/#/tokens">dashboard</a> under the “Library Tokens” tab. Paste it into all three fields of your env.json file: local, dev, and release.</p><p>ACCESS_KEY functions much like a password — it’s a token that you’ll generate ahead of time, then pass to your function so that only you can call it. You can use the following token generation service by opening your terminal and running:</p><pre>$ lib steve.generateToken</pre><p>You can also use this code snippet locally:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/42c2574ad7bb665e3bd2b22f5b5d9dfc/href">https://medium.com/media/42c2574ad7bb665e3bd2b22f5b5d9dfc/href</a></iframe><p>Or any other method you’d like. Paste the generated access key into the appropriate field in your service’s env.json file, again in all three places. Keep it handy, we’ll need it to test and run your service!</p><h3>Minute 4: Test Your Service</h3><p>As mentioned earlier, the default version of your service will check for updates to an npm package. To test this, we recommend publishing a new, test npm package so that you can publish new versions with no consequences.</p><p>From a new terminal window, create a directory using mkdir, then cd into it. If you haven’t signed up for npm, you can follow <a href="https://docs.npmjs.com/getting-started/publishing-npm-packages#creating-a-user">these directions</a> to sign up.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/360/1*4NfCwy5lr3PBCYJ4qxfxFQ.png" /><figcaption>To test your service, create a test npm package and point your service towards it</figcaption></figure><p>Once you’ve logged into your created npm account, run $ npm init and name your package (it must be globally unique in npm’s registry). The defaults will do for the other prompted fields. This will create a package.json file in the directory. Finally, run $ npm publish to push your test package live.</p><p>Then, go back to the directory containing your StdLib service (stdlib-workspace/&lt;username&gt;/custom-push-notifications) and run the following command to test your service locally:</p><pre>$ lib . \<br>--url <a href="https://www.npmjs.com/package/custom-push-notification-test">https://npmjs.com/package/</a>&lt;your package name&gt; \<br>--tel &lt;your phone number&gt; \<br>--accessKey &lt;the ACCESS_KEY env variable you set earlier&gt;</pre><p>This will set the initial value of the npm package that your service will check against. Run the command again — you should not get a notification because the version number has not changed, and the service will return false.</p><p>Go back to your other terminal window and open the package.json file of the npm package you just created. Increment the version number of the package. Run npm publish again to republish your service.</p><p>Finally, run the above lib command again. The service will return true and you should get a text message notifying you that the website has changed!</p><h3>Minute 5: Release The Kraken!</h3><p>When you’re ready, run the following command from your service directory:</p><pre>$ lib release</pre><p>This will release your service to the StdLib registry, and will allow you to create a scheduled task with it. This task will run on a specified time interval, and will run your service to check for changes.</p><h3>Minute 6: Run Your Service With a Scheduled Task</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Kc1QWsLgEphTzH8yt-N0_A.png" /><figcaption>Creating a StdLib Scheduled Task from the command line</figcaption></figure><p>Now that you’ve tested and released your service, let’s set up a scheduled task to check for changes. Run the following from your terminal:</p><pre>$ lib tasks:create &lt;username&gt;/custom-push-notifications</pre><p>The resulting prompt will ask you for a URL. Type in the URL for the page of the actual npm package you want notifications for. Don’t forget to use quotes!</p><p>Then, supply your desired phone number and the access key you set earlier. Choose one of your StdLib library tokens and choose how often you want to check for changes. We recommend once every hour, but if you want to check more frequently, you can set your task to run more often. You can type lib tasks:list to see the created task.</p><p>And that’s it! You now have a custom push notification when an npm package updates.</p><h3>Extending to Other Notifications</h3><p>You can customize the code to match other parts of a website and release it as another scheduled task by repeating the process in the article. Just modify the logic within the evaluate method in functions/__main__.js to use different logic tailored to the site you want to set up a push alert for. You can use something like <a href="https://developer.chrome.com/devtools">Chrome’s devtools</a> to inspect the DOM for a page and help you craft your query. Then test locally, release it as a new service with $ lib release, and create a new scheduled task with $ lib tasks:create.</p><p>You can also replace the lib.utils.sms function call to use any notification channel you want —for example, <a href="https://api.slack.com/web">Slack</a> is a great choice.</p><p>And that’s it! Thanks for reading! For more content, features, and announcements, stay tuned by following us on Twitter <a href="https://twitter.com/stdlibhq">@StdLibHQ</a> or me <a href="https://twitter.com/hacubu">@hacubu</a>. You can also join our Slack channel by going to our <a href="https://stdlib.com/">homepage</a> and requesting an invite under the “Community” tab. Reach out anytime.</p><p>I can’t wait to see what you build!</p><p><em>Jacob Lee is one of the co-founders of </em><a href="https://stdlib.com/"><em>StdLib</em></a><em> and firm believer in the FaaS future. He’s an east-coast transplant and ex-Googler who loves skiing, playing squash, and traveling. Follow him on Twitter </em><a href="https://twitter.com/hacubu"><em>@hacubu</em></a><em>!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ea67c988801f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[StdLib Platform Updates: Functions Run on Node 8.9.1, Static Binary Support]]></title>
            <link>https://medium.com/@jacoblee93/stdlib-updates-functions-run-on-node-8-9-1-static-binary-support-bf8290a7291f?source=rss-aa2b84f0afce------2</link>
            <guid isPermaLink="false">https://medium.com/p/bf8290a7291f</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[serverless]]></category>
            <category><![CDATA[functions-as-a-service]]></category>
            <category><![CDATA[stdlib]]></category>
            <category><![CDATA[node]]></category>
            <dc:creator><![CDATA[Jacob Lee]]></dc:creator>
            <pubDate>Tue, 28 Nov 2017 07:15:23 GMT</pubDate>
            <atom:updated>2017-11-28T07:18:25.084Z</atom:updated>
            <content:encoded><![CDATA[<p>Hey everyone! The <a href="https://stdlib.com/">StdLib</a> team is in Las Vegas for this year’s <a href="https://reinvent.awsevents.com/">AWS:reInvent</a> conference (give us a shout <a href="https://twitter.com/stdlibhq">@StdLibHQ</a> if you’re here too!), but we’re still hard at work improving the platform.</p><p>I’m therefore excited to announce some platform updates! We’ve increased the number of npm packages we support in our functions by adding support for packages that depend on <strong>static binaries</strong> — this includes useful ones such as SDKs for <a href="https://github.com/firebase/firebase-admin-node">Firebase administration</a>, <a href="https://github.com/googlecloudplatform/google-cloud-node">Google Datastore</a>, and <a href="https://github.com/amir20/phantomjs-node">PhantomJS</a>. We’ve also updated the default Node engine to <strong>Node 8.9.1</strong>.</p><p>If you’re not familiar with StdLib, we’re a function as a service (FaaS) library that allows users to rapidly create, discover, and consume APIs as web functions. We’re the fastest way for developers to turn their code into a live, infinitely-scalable, production-ready endpoint. <a href="https://github.com/stdlib/lib">This tutorial</a> on our Github page will walk you through the process of signing up and creating your first service. You can also check out our most recent product, <a href="https://stdlib.com/sourcecode">StdLib Sourcecode</a>, which makes creating a wide variety of production-ready projects dead simple.</p><h3>Static Binary Support</h3><p>We’re happy to announce today that <a href="https://stdlib.com/">StdLib</a> now supports packages with static binary dependencies! You can now use them just like any other npm package. For example, to use PhantomJS in your project, you could run npm install phantom --save from your StdLib service directory, then use it within your function. For example, if you wanted a function that spins up an instance of Phantom JS and returns the content of a website, you could do something like this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ca39952ecd19522b636801724a658fa8/href">https://medium.com/media/ca39952ecd19522b636801724a658fa8/href</a></iframe><p>In this example, we also log the urls of the sites we visit. You can see these logs using our <a href="https://docs.stdlib.com/main/#/creating-services/logging">CLI</a>.</p><h3>Node 8.9.1 Support</h3><p>StdLib now ships with Node 8.9.1 as the default engine for functions. To use the previous engine version, you should manually set &quot;engine&quot;: &quot;nodejs-8.8.0&quot;in the &quot;stdlib&quot; field of your package.json. You can check out the release notes for Node 8.9.1 <a href="https://nodejs.org/en/blog/release/v8.9.1/">here</a>.</p><h3>That’s it!</h3><p>We’ve got more exciting features and announcements coming up in the next few weeks, so stay tuned by following us on Twitter <a href="https://twitter.com/stdlibhq">@StdLibHQ</a>. You can also join our Slack channel by going to our <a href="https://stdlib.com/">homepage</a> and requesting an invite under the “Community” tab. Feel free to reach out anytime!</p><p><em>Jacob Lee is one of the co-founders of </em><a href="https://stdlib.com/"><em>StdLib</em></a><em> and firm believer in the FaaS future. He’s an east-coast transplant and ex-Googler who loves skiing, playing squash, and traveling. Follow him on Twitter </em><a href="https://twitter.com/hacubu"><em>@hacubu</em></a><em>!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bf8290a7291f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[StdLib Updates: Functions Run on Node 8.8.0, Access Control List Support]]></title>
            <link>https://medium.com/@jacoblee93/stdlib-updates-functions-run-on-node-8-8-0-access-control-list-support-e013bf194219?source=rss-aa2b84f0afce------2</link>
            <guid isPermaLink="false">https://medium.com/p/e013bf194219</guid>
            <category><![CDATA[stdlib]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[serverless]]></category>
            <dc:creator><![CDATA[Jacob Lee]]></dc:creator>
            <pubDate>Thu, 26 Oct 2017 06:00:48 GMT</pubDate>
            <atom:updated>2017-10-26T08:03:57.513Z</atom:updated>
            <content:encoded><![CDATA[<p>Hey everyone! I’m excited to announce some more great platform updates to <a href="https://stdlib.com/">StdLib</a>. We’ve added <strong>access control list </strong>(ACL) support, allowing you to restrict access to your deployed functions, and have also updated the default Node engine to <strong>Node 8.8.0</strong>.</p><p>If you’re not familiar with StdLib, we’re a function as a service (FaaS) library that allows users to rapidly create, discover, and consume APIs as web functions. We’re the fastest way for developers to turn their code into a live, infinitely-scalable, production-ready endpoint. <a href="https://github.com/stdlib/lib">This tutorial</a> on our Github page will walk you through the process of signing up and creating your first service. You can also check out our most recent product, <a href="https://stdlib.com/sourcecode">StdLib Sourcecode</a>, which makes creating a wide variety of production-ready projects dead simple.</p><h3>ACL Support</h3><p>We’re happy to announce today that <a href="https://stdlib.com/">StdLib</a> now supports ACLs! Function definitions support a new @acl field that you can use to whitelist or blacklist users by username. The default for StdLib functions (when an ACL isn’t specified) is “allow all” and the equivalent of @acl *.</p><p>If you want to deny access to specific users, you can add @acl * to your function definition, then include users by username with user__username &lt;username&gt; deny.</p><p>For example, if you wanted to deny access to two specific users, let’s say with usernames <em>haliax</em> and <em>cinder</em>, you could do so with a definition that looks like this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/83fa8963085f3a1a5db8ed8518673c0c/href">https://medium.com/media/83fa8963085f3a1a5db8ed8518673c0c/href</a></iframe><p>The ACL for this function would allow any user to call the function except for those who pass in a token belonging to the users <em>haliax</em> or <em>cinder</em>. The “*” (asterisk) immediately following the @acl field signifies that all other users should be allowed to access the function.</p><p>On the other hand, if you would like to deny access to everyone except for specific users, you would declare @acl with no asterisk following, then specify individual users as user__username &lt;username&gt; allow.</p><p>For example, if you wanted your function to allow access to only users with the usernames <em>kvothe </em>and<em> denna, </em>your function definition might look something like this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3c485a87e02f773e5a7940268dca85a5/href">https://medium.com/media/3c485a87e02f773e5a7940268dca85a5/href</a></iframe><p>The ACL will deny access to everyone who calls the function without one of either <em>kvothe</em> or <em>denna</em>’s library tokens. You can read more about StdLib library tokens <a href="http://docs.stdlib.com/main/#/calling-services/authentication">here</a>.</p><p><strong>Note that the order of fields in the comments is important.</strong></p><p>For full documentation on ACLs, check out our <a href="http://docs.stdlib.com/main/#/access-control">docs page</a>.</p><h3>Node 8.8.0 Support</h3><p>StdLib now ships with Node 8.8.0 as the default engine for functions. To use the previous engine version, you should manually set &quot;engine&quot;: &quot;nodejs-8.6.0&quot;in the &quot;stdlib&quot; field of your package.json. You can check out the release notes for Node 8.8.0 <a href="https://nodejs.org/en/blog/release/v8.8.0/">here</a>.</p><h3>That’s it!</h3><p>We’ve got more exciting features and announcements coming up in the next few weeks, so stay tuned by following us on Twitter <a href="https://twitter.com/stdlibhq">@StdLibHQ</a>. You can also join our Slack channel by going to our <a href="https://stdlib.com/">homepage</a> and requesting an invite under the “Community” tab. Feel free to reach out anytime!</p><p><em>Jacob Lee is one of the co-founders of </em><a href="https://stdlib.com/"><em>StdLib</em></a><em> and firm believer in the FaaS future. He’s an east-coast transplant and ex-Googler who loves skiing, playing squash, and traveling. Follow him on Twitter </em><a href="https://twitter.com/hacubu"><em>@hacubu</em></a><em>!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e013bf194219" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[StdLib Updates: Node.js 8.4.0 Support, Use Custom Hostnames For Your Services With Cloudflare]]></title>
            <link>https://medium.com/stdlibhq/stdlib-updates-node-js-8-4-0-support-use-custom-hostnames-for-your-services-with-cloudflare-23db0a082000?source=rss-aa2b84f0afce------2</link>
            <guid isPermaLink="false">https://medium.com/p/23db0a082000</guid>
            <category><![CDATA[stdlib]]></category>
            <category><![CDATA[faa]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[custom-domain]]></category>
            <category><![CDATA[serverless]]></category>
            <dc:creator><![CDATA[Jacob Lee]]></dc:creator>
            <pubDate>Thu, 24 Aug 2017 04:14:20 GMT</pubDate>
            <atom:updated>2019-02-06T02:44:53.396Z</atom:updated>
            <content:encoded><![CDATA[<p>Hey everyone! We’re thrilled to announce some great additions to <a href="https://stdlib.com/">StdLib</a> here. We’ve added <strong>hostname route </strong>support, allowing you to redirect custom domains to your StdLib services using Cloudflare. We’ve also updated the default Node engine to <strong>Node 8.4.0</strong>, which includes some <a href="https://medium.com/the-node-js-collection/get-ready-a-new-v8-is-coming-node-js-performance-is-changing-46a63d6da4de">nifty performance updates</a> to the V8 engine.</p><p>If you’re not familiar with StdLib, we’re a function as a service (FaaS) library that allows users to rapidly create, discover, and consume APIs as web functions. We’re the fastest way for developers to turn their code into a live, infinitely-scalable, production-ready endpoint. <a href="https://github.com/stdlib/lib">This tutorial</a> on our Github page will walk you through the process of signing up and creating your first service.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DRSqEtvAF-fZdFERGTsbUQ.png" /><figcaption>StdLib + Cloudflare</figcaption></figure><h3>Hostname Routing Support</h3><p>We’re happy to announce today that <a href="https://stdlib.com/">StdLib</a> now supports custom hostnames! You can now route your personal domains to your released StdLib services, allowing you to use them as the entry point to your <a href="https://medium.com/slack-developer-blog/build-a-serverless-slack-bot-in-9-minutes-with-node-js-and-stdlib-b993cfa15358">Slack bots</a>, <a href="https://hackernoon.com/build-a-serverless-twilio-sms-call-forwarding-bot-in-7-minutes-using-node-js-stdlib-411697c3cc1b">Twilio hubs</a>, <a href="http://docs.stdlib.com/main/#/templates/vue">Vue single-page apps</a>, <a href="https://hackernoon.com/build-a-serverless-stripe-store-in-5-minutes-with-node-js-and-stdlib-d90352c89227">Stripe stores</a>, and other functions built on StdLib. The only things you’ll need are a StdLib account, a <a href="https://cloudflare.com/">Cloudflare</a> account, and a domain name.</p><h3>Step 1: Set Up Cloudflare With Your Domain</h3><p>If you haven’t already, follow the steps <a href="https://support.cloudflare.com/hc/en-us/articles/201720164-Step-2-Create-a-Cloudflare-account-and-add-a-website">here</a> to set up Cloudflare with your hosting provider. It may take a few minutes to allow for changes to propagate.</p><h3>Step 2: Redirect Your Cloudflare Domain to StdLib</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WBitYS1Tum4ALJfeJgqGSw.png" /><figcaption>The DNS tab in your Cloudflare dashboard</figcaption></figure><p>From your Cloudflare dashboard, you should select the DNS tab, then create a new CNAME record from whatever hostname you’d like (we use “test” in the example below), to the domain name functions.api.stdlib.com.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*W1Zs8KydCBp8htpf8GvVMQ.png" /><figcaption>Creating a CNAME DNS record in your Cloudflare dashboard</figcaption></figure><p>If you would like to make your root domain redirect to a Standard Library API (e.g. google.com, simply use the “@” symbol as the name. Once you have done that, try navigating to &lt;hostname&gt;.&lt;your domain name&gt;.&lt;your TLD&gt;. You should see the following error message in your browser:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9p2MpPv7kCb-BNSbM5zskA.png" /><figcaption>Error message from StdLib before adding a StdLib route</figcaption></figure><p>This is normal — we still have to let StdLib know where to route your function. We’ll do this in the next step.</p><p>If you don’t see the above message right away, it may be because Cloudflare can take time to propagate your route, so try checking again in a minute or two.</p><h3>Step 3: Add a StdLib Route</h3><p>First, install the latest version of the lib CLI using npm install lib.cli -g. Then, navigate to your StdLib directory and run lib hosts. You should see an empty table:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/942/1*lz3aO4zU5M5hsQX4eikrZA.png" /><figcaption>Result from running “lib hosts” with no created hostname routes</figcaption></figure><p>Some terminology: <em>hostname</em> in this table is the custom domain you want to route from. You should avoid using <em>http://</em> or <em>https://</em> in front of your domain (i.e. test.stdlib.com rather than <a href="https://test.stdlib.com/">https://test.stdlib.com</a>). <em>Target</em> is the specific StdLib service you want to route your custom domain to.</p><p>Once you’re ready, run lib hosts:add &lt;hostname&gt; &lt;service name&gt;, where service name is in the form &lt;username&gt;.&lt;service name&gt;[@&lt;version/environment&gt;]. If you do not specify a version, StdLib will automatically route to the latest release.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Io-0ZY-_OVwpGqMTOrawIg.png" /><figcaption>Successfully creating a route from a custom domain to a StdLib service</figcaption></figure><p>Run lib hosts again to see your successfully created route!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yn4Ldv3I3B-hae1CDQuBGQ.png" /><figcaption>The updated hostname routes table</figcaption></figure><p>If you navigate to your custom hostname, you should see the output from your StdLib function! You should also be able to use <em>https://</em> in front of your URL to encrypt your traffic — Cloudflare has settings to automatically enforce this if that’s your preference.</p><p>For more information on the lib CLI and other features we support, check out our <a href="https://docs.stdlib.com/main">docs page</a>.</p><h3>Node 8.4.0 Support</h3><p>Our main Node engine is now Node 8.4.0, complete with the V8 6.0 engine + Turbofan and the <a href="https://medium.com/the-node-js-collection/get-ready-a-new-v8-is-coming-node-js-performance-is-changing-46a63d6da4de">performance benefits</a> that go along with it. To use the previous engine version, you should manually set &quot;engine&quot;: &quot;nodejs-8.2.1&quot; in the &quot;stdlib&quot; field of your package.json.</p><h3>That’s it!</h3><p>You’ve successfully created a route from a custom domain to a StdLib service. We’ve got more exciting features and announcements coming up in the next few weeks, so stay tuned by following us on Twitter <a href="https://twitter.com/stdlibhq">@StdLibHQ</a>. You can also join our Slack channel by going to our <a href="https://stdlib.com/">homepage</a> and requesting an invite under the “Community” tab. Feel free to reach out anytime!</p><p><em>Jacob Lee is a co-founder of </em><a href="https://stdlib.com/"><em>StdLib</em></a><em> and firm believer in the FaaS future. He’s an east-coast transplant and ex-Googler who loves skiing, playing squash, and traveling. Follow him on Twitter </em><a href="https://twitter.com/hacubu/"><em>@hacubu</em></a><em>!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=23db0a082000" width="1" height="1" alt=""><hr><p><a href="https://medium.com/stdlibhq/stdlib-updates-node-js-8-4-0-support-use-custom-hostnames-for-your-services-with-cloudflare-23db0a082000">StdLib Updates: Node.js 8.4.0 Support, Use Custom Hostnames For Your Services With Cloudflare</a> was originally published in <a href="https://medium.com/stdlibhq">Standard Library</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>