<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Scott Gamble</title>
    <description>The latest articles on DEV Community by Scott Gamble (@threesided).</description>
    <link>https://dev.to/threesided</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F455507%2F3ecc6a62-5186-408b-a0aa-84aa188b6b1e.jpg</url>
      <title>DEV Community: Scott Gamble</title>
      <link>https://dev.to/threesided</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/threesided"/>
    <language>en</language>
    <item>
      <title>Create a QR Code Generator for Slack in 7 Lines of Code</title>
      <dc:creator>Scott Gamble</dc:creator>
      <pubDate>Thu, 20 Aug 2020 12:38:27 +0000</pubDate>
      <link>https://dev.to/threesided/create-a-qr-code-generator-for-slack-in-7-lines-of-code-3a5f</link>
      <guid>https://dev.to/threesided/create-a-qr-code-generator-for-slack-in-7-lines-of-code-3a5f</guid>
      <description>&lt;p&gt;Hey, remember QR Codes?&lt;/p&gt;

&lt;p&gt;Those weird, glitchy little blocks that you can scan with your phone seem to be more popular than ever these days. Given our need for a more "hands off" approach to sharing information, some might even argue they're now an &lt;a href="https://www.wired.co.uk/article/qr-codes-coronavirus" rel="noopener noreferrer"&gt;everyday essential&lt;/a&gt;!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fc7323nr7yiacs8mba8qw.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fc7323nr7yiacs8mba8qw.gif" alt="Slack Command Final Result"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Well, thanks to services like &lt;a href="https://autocode.com/" rel="noopener noreferrer"&gt;Autocode&lt;/a&gt;, you can set up a super simple Slack app that can generate QR codes for you and automatically upload them to your Slack channel.&lt;/p&gt;

&lt;h1&gt;
  
  
  TL;DR (30 seconds)
&lt;/h1&gt;

&lt;p&gt;In just 30 seconds you could have this QR code generator up and running. There's admittedly a little hand-waving; &lt;a href="https://autocode.com/" rel="noopener noreferrer"&gt;Autocode&lt;/a&gt; as a platform will automatically handle authentication and deployment for you. But that's kinda the point! You get to focus on the API to API code that matters and leave the undifferentiated heavy-lifting of app-to-app authentication to the platform — the same way we once gave up server towers for cloud-based VM and container management.  &lt;/p&gt;

&lt;h1&gt;
  
  
  How it Works
&lt;/h1&gt;

&lt;p&gt;This Source is set up to respond to the &lt;code&gt;/cmd qr&lt;/code&gt; command in Slack, followed by the URL you want to convert. For example, in any channel you can write &lt;code&gt;/cmd qr http://www.threesided.ca/&lt;/code&gt; to automatically generate a QR &lt;br&gt;
code from the link.&lt;/p&gt;

&lt;p&gt;This command uses the &lt;a href="https://autocode.com/lib/qrcode/generate" rel="noopener noreferrer"&gt;qrcode.generate&lt;/a&gt; API Connector, &lt;br&gt;
making the whole process a breeze!&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Convert temporary URL to QR Code&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;qrCode&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;lib&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;qrcode&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;generate&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@0.0.3&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]({&lt;/span&gt;
  &lt;span class="na"&gt;text&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;tempURL&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;link_url&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This QR code image is then directly uploaded to your Slack channel using the &lt;a href="https://autocode.com/lib/slack/channels/0.7.2/#files-create" rel="noopener noreferrer"&gt;slack.channels.files.create&lt;/a&gt; method&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Upload the QR Code image to Slack&lt;/span&gt;
&lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;upload&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;lib&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;slack&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;channels&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@0.7.2&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nx"&gt;files&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;filename&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;`qr-code.png`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;channels&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;channel_id&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;],&lt;/span&gt;
  &lt;span class="na"&gt;content&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;qrCode&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;title&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;`QR Code`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Getting Started
&lt;/h1&gt;

&lt;p&gt;There are two really easy steps to get started with this.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 1: Fork the Source in Autocode
&lt;/h3&gt;

&lt;p&gt;Click on &lt;a href="https://autocode.com/src/slack/slack-qr-code/" rel="noopener noreferrer"&gt;this link&lt;/a&gt; to view and fork the Source Code for this project.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 2: Link your Slack Account
&lt;/h3&gt;

&lt;p&gt;Once the project is forked you'll be brought to the &lt;a href="https://autocode.com/" rel="noopener noreferrer"&gt;Autocode&lt;/a&gt; editor. In the bottom right of the editor is a red button, indicating that you need to connect your slack account.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fby2g6qdzdmtb74f5w0qh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fby2g6qdzdmtb74f5w0qh.png" alt="Link Account Button"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;There are two possible ways (simple, using the Autocode app, or more involved using your own app). I recommend you use the simple slack app account linking flow for the Source.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fdkw4lg0sn91uu78jldh6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fdkw4lg0sn91uu78jldh6.png" alt="Link Slack Account Modal"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The link account modal will provide you a detailed walkthrough on linking your Slack account. Once you've finished with those&lt;br&gt;
instructions, the last step is to deploy your project!&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 3: Deploy your Forked Project
&lt;/h3&gt;

&lt;p&gt;On the bottom left of the Autocode editor screen is a &lt;strong&gt;Deploy&lt;/strong&gt; button.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F7jo9mnl77z7phv8k5bxy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F7jo9mnl77z7phv8k5bxy.png" alt="Deploy Button"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Clicking that will bring up a deployment progress modal. Once that's complete, your new Slack command app is live! Now you too can rick roll your friends in style. 😎&lt;/p&gt;

&lt;p&gt;Once you're happy with how everything is working, you can &lt;strong&gt;create a release&lt;/strong&gt; from your Autocode &lt;a href="https://www.autocode.com/manage" rel="noopener noreferrer"&gt;Manage Dashboard&lt;/a&gt;.&lt;br&gt;
You'll be prompted to link a production slack account and give your release a version via the release modal.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fc7323nr7yiacs8mba8qw.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fc7323nr7yiacs8mba8qw.gif" alt="Slack Command Final Result"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  That's it!
&lt;/h1&gt;

&lt;p&gt;Thanks for checking out this Source! Follow the Autocode team on Twitter &lt;a href="https://www.twitter.com/autocodehq" rel="noopener noreferrer"&gt;@AutocodeHQ&lt;/a&gt; for updates. If you have any questions, feel free to reach out to me directly at &lt;a href="mailto:scott@autocode.com"&gt;&lt;/a&gt;&lt;a href="mailto:scott@autocode.com"&gt;scott@autocode.com&lt;/a&gt;&lt;/p&gt;

</description>
      <category>slack</category>
      <category>node</category>
      <category>qrcode</category>
      <category>api</category>
    </item>
  </channel>
</rss>
