poltdatabase.blogg.se

Slack workflow google sheet
Slack workflow google sheet




slack workflow google sheet
  1. #SLACK WORKFLOW GOOGLE SHEET INSTALL#
  2. #SLACK WORKFLOW GOOGLE SHEET UPDATE#
  3. #SLACK WORKFLOW GOOGLE SHEET CODE#

#SLACK WORKFLOW GOOGLE SHEET UPDATE#

Return ContentService.createTextOutput(':books::nerd_face: Thank you for your book recommendation! :tada:') ĭon’t forget to create a new version and update your web app through the Publish > Deploy as a web app… menu. Sheet.getRange(1, 1).setValue(JSON.stringify(e)) You can also customize this return message with some helpful text. You want to send a confirmation back to Slack to avoid this. The user is served an ugly looking bunch of HTML with an error message. who posted the recommendation and what it was)Īt the moment, the script does not send a reply back to Slack to confirm receipt of the data.

  • Parse the JSON packet to extract the relevant data (e.g.
  • Send a confirmation message back to Slack.
  • (But as we know, the devil is in the detail, right?) You should see a long string of data in cell A1, with information about your Slack channel and the book title buried in there. We’ll fix that in a moment.īut look back at your Google Sheet. Hopefully you’ll get an ugly looking garbled mess of HTML right back in your Slack message box. In your Slack app workspace, enter the Slash Command and a book title, e.g.:

    slack workflow google sheet

    Let’s test it! Sending Data From Slack to Google Sheets When that’s done you’ll see two green tick marks under the Basic Information of your App:

    #SLACK WORKFLOW GOOGLE SHEET INSTALL#

    The last step is to “ Install your app to your workspace”, which is under the Settings > Basic Information menu in the sidebar.Ĭlick Install App and on the subsequent screen you’ll need to Authorize the App. book) and paste in your Google App URL as the Request URL: In the new window, set your Slash Command (e.g. When your app has been created, you’ll want to choose “Slash Commands” under the Features menu, and then Create New Command In the “Create a Slack App” popup, give your app a name and choose the Slack Workspace it’s attached to. (You’ll have to login if you’re not already.) Head to the Slack API homepage and click “Start Building”. Let’s head back over to Slack and create a new app. Ok, that’s the Google Sheet setup (for now). Later, as you make changes to the script code, you need to come back to Publish > Deploy as web app… to create a new version and Update it: Copy this as you’ll need it later in the Slack App. When this is complete, you see a confirmation popup with the Current web app URL. When you click Deploy, you’re prompted to authorize your app. You need to set the access to “ Anyone, even anonymous” otherwise you’ll see a 401_client_error message in Slack when you try to use the Slash Command. When your Slack app sends your Google Apps Script app an HTTP POST request, the Apps Script runs this doPost(e) function, which pastes the data as a string in cell A1 of Sheet 1 of your Google Sheet.īefore it can do that though, you’ll need to publish this Apps Script project as a Web App.įrom the Script Editor window, choose Publish > Deploy as web app…

    slack workflow google sheet

    Sheet.getRange(1,1).setValue(JSON.stringify(e)) Var ss = SpreadsheetApp.getActiveSpreadsheet()

    #SLACK WORKFLOW GOOGLE SHEET CODE#

    Then open the Apps Script editor from the Tools menu: Tools > Script editorĭelete the boilerplate myFunction() code and replace it with the following few lines: We’ll use Apps Script, the Javascript-based scripting language, to add functionality to this Google Sheet. Obviously for this to work, you need a Google Sheet to act as the data store, so first step is to create a new Google Sheet. Using Slack Slash Commands to send data to Google Sheets Initial Setup with Google Sheets and Apps Script active, /away, /archive, /invite, /mute, /shrugĪre all examples of Slack Slash Commands.īy the end of this tutorial, you’ll have created your own Slash Command, which will show up in this list too:Ĭheck out the Slack documentation for more on Slash Commands. Type the forward slash into your Slack message box and you’ll see the list of default slash commands:Į.g. Slack Slash Commands let users trigger an interaction with your app directly from the message box in Slack. So I built a little Slack app to send book recommendation data directly into a Google Sheet, using Google Apps Script.īy the end of this tutorial, you’ll have created your own Slack App to log data in a Google Sheet. I needed a way to log the books people recommended. People share books all the time, but they disappear quickly, lost in a sea of messages. I’m part of a book recommendations channel. A place to hang out and discuss ideas with friends. Since I work from home, most of my daily work interactions happen through Slack.






    Slack workflow google sheet