<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Just some thoughts from Akash</title>
    <atom:link href="https://akash1810.github.io/feed.xml" rel="self" type="application/rss+xml"/>
    <link>https://akash1810.github.io/</link>
    <description>Just some thoughts from Akash (akash1810)</description>
    <pubDate>Thu, 19 Nov 2015 20:58:10 +0000</pubDate>
    
      <item>
        <title>Getting Google Forms to talk to Slack</title>
        <link>https://akash1810.github.io/2015/08/02/getting-google-forms-to-talk-to-slack.html</link>
        <guid isPermaLink="true">https://akash1810.github.io/2015/08/02/getting-google-forms-to-talk-to-slack.html</guid>
        <description>&lt;p&gt;When you want to get feedback from a site you’re developing, a &lt;a href=&quot;https://www.google.co.uk/forms/about/&quot;&gt;Google Form&lt;/a&gt; is a quick and cheap solution. In the simplest case, all you need is a form with a single free text field to allow people to write freely.&lt;/p&gt;

&lt;p&gt;Once you’ve got your form, add a link to it on your site and you’re done. But wait, how do you know when someone has completed the form? Well, you could set up an email trigger, so that you’ll get an email once a new response has been made. The trouble with that though is you can’t create a trigger to email a group - the recipient will be the email address of the account creating the trigger.&lt;/p&gt;

&lt;p&gt;So if you’re developing the site in a group, you’ll either need to get everyone to create their own trigger, or setup an email forwarding rule.&lt;/p&gt;

&lt;p&gt;This is all going on the assumption that you read and respond to your email in real time - I know I certainly don’t! If only there were other ways to be informed…&lt;/p&gt;

&lt;p&gt;Well, how about posting to a Slack channel?&lt;/p&gt;

&lt;p&gt;Turns out this is actually really simple and is a one off process. You’ll need to add a &lt;a href=&quot;https://developers.google.com/apps-script/quickstart/forms-add-on&quot;&gt;Google Apps Script&lt;/a&gt; to your form, then configure a trigger. Then, using an &lt;a href=&quot;https://api.slack.com/incoming-webhooks&quot;&gt;Incoming Webhook&lt;/a&gt; to post to Slack, we’ll format the Form response as an attachment to make the message a bit richer, resulting in a message that looks like:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/2015-08-02/slack-message.png&quot; alt=&quot;Slack message&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Much better! We now post to Slack, with an &lt;code&gt;@channel&lt;/code&gt; mention so that everyone on the channel is alerted to the message. We also show all the information in the message: who completed the form, when and what they said.&lt;/p&gt;

&lt;p&gt;There are also two links in the message too - one to view the Google Sheets that holds all the Form’s responses and another to email the sender using a simple &lt;code&gt;mailto&lt;/code&gt; link.&lt;/p&gt;

&lt;h1 id=&quot;open-mailto-in-gmail-compose&quot;&gt;Open &lt;code&gt;mailto&lt;/code&gt; in GMail Compose&lt;/h1&gt;

&lt;p&gt;I’m not sure about you, but I’m not the biggest fan of &lt;code&gt;mailto&lt;/code&gt; links as it requires you to have set up something to handle that protocol - on a mac, its the Mail App, which I don’t actually use. I’d much prefer to just use the GMail web client to compose the message. Well, you can!&lt;/p&gt;

&lt;p&gt;Just replace &lt;code&gt;responseAttachment&lt;/code&gt; in the below snippet with:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-js&quot; data-lang=&quot;js&quot;&gt;&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;responseAttachment&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;s2&quot;&gt;&amp;quot;fallback&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;FormApp&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;getActiveForm&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;().&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;getTitle&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(),&lt;/span&gt;
    &lt;span class=&quot;s2&quot;&gt;&amp;quot;title&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;Respond via email?&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;s2&quot;&gt;&amp;quot;title_link&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;https://mail.google.com/mail/u/0/?view=cm&amp;amp;fs=1&amp;amp;tf=1&amp;amp;source=mailto&amp;amp;to=&amp;quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;response&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;getRespondentEmail&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;All this does is replace &lt;code&gt;mailto&lt;/code&gt; with &lt;code&gt;https://mail.google.com/mail/u/0/?view=cm&amp;amp;fs=1&amp;amp;tf=1&amp;amp;source=mailto&amp;amp;to=&lt;/code&gt; which will open a new tab to compose an email to the address of the &lt;code&gt;to&lt;/code&gt; query value.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://mail.google.com/mail/u/0/?view=cm&amp;amp;fs=1&amp;amp;tf=1&amp;amp;source=mailto&amp;amp;to=person@email.com&quot;&gt;Test it yourself&lt;/a&gt;.&lt;/p&gt;

&lt;h1 id=&quot;the-code&quot;&gt;The Code&lt;/h1&gt;

&lt;p&gt;Grab the full code below.&lt;/p&gt;

&lt;script src=&quot;https://gist.github.com/640a45d5997de1d95f4a.js&quot;&gt; &lt;/script&gt;

&lt;h1 id=&quot;screencast&quot;&gt;Screencast&lt;/h1&gt;
&lt;p&gt;&lt;a href=&quot;http://www.youtube.com/watch?v=bBkXdagMGaw&quot;&gt;&lt;img src=&quot;http://img.youtube.com/vi/bBkXdagMGaw/0.jpg&quot; alt=&quot;screencast&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
</description>
        <pubDate>Sun, 02 Aug 2015 00:00:00 +0000</pubDate>
      </item>
    
  </channel>
</rss>
