From Day One to Slack: Automating Your Daily Standup

At Reaktiv Studios, we do our daily standup in Slack, rather than a meeting due to the remote nature of our team. There’s a separate channel #standup where we use a Slack post to outline what we accomplished yesterday, what we plan to accomplish on today and any blockers we’ve encountered.

I was already keeping a daily work log in Day One, a fantastic journaling app for OS X, and wanted to sync up my workflow so I didn’t have to spend more time formatting a post in Slack, or deal with copying and pasting between the two apps to share my standup.

Enter the Slack API and OS X Services…

I figured there had to be a way to integrate the two and after a few fits and starts with attempting to pull data out of Day One with a script I settled on an OS X service that operates on selected text with a keyboard shortcut. My workflow now is to write my daily standup in Day One like I always have, select it, and hit ⌘⌥S to immediately share in Slack. Easy peasy. The details, if you’d like to implement a similar workflow, are below:

First, Get a Slack Token

It seems Slack has changed to use Oauth for all apps, but I have heard that creating a “test token” on this page still works.

Get the channel ID from the Slack API using your new token. You can do this with curl or Slack’s API tester:

2016-07-27 at 10.02 AM

Pull the list of channels in the tester and search until you find your channel name, above it will be the channel ID.

Create a file in your home directory: ~/.slack which contains your slack credentials:

SLACK_TOKEN_RS=<Your Slack Token>

You can name these however you want, just be sure to change them in the script below as well.

Open Automator, and create a new “Service”.

2016-07-27 at 9.41 AM

Choose the “Run shell script” action.

2016-07-27 at 9.42 AM

The action should be configured as: “The service receives selected text in Day” Choose your shell (mine is /bin/zsh) and pass input to stdin. Then paste the script below into the script field:

source ~/.slack
curl -F file=@- -F token=$SLACK_TOKEN_RS -F filetype=post -F channels=$SLACK_CHANNEL_STANDUP -F title="Daily Standup `date '+%Y-%m-%d'`"

Let’s break down what this is doing.

  1. First, we source our Slack credentials file. This makes the SLACK_TOKEN_RS and SLACK_CHANNEL_STANDUP variables available to our script.
  2. We then make a curl request to Slack’s files.upload endpoint. We are submitting this as a multipart/form using the -F flag.
  3. -F file=@- Instead of providing a file to upload, we are passing stdin as the “file” with @-
  4. -F token=$SLACK_TOKEN_RS sets our API token from the credentials file.
  5. -F filetype=post this is what creates a Slack “post” rather than a media file upload.
  6. -F channels=$SLACK_CHANNEL_STANDUP sets the Slack channel to share the post to.
  7. -F title="Daily Standup `date '+%Y-%m-%d'`" sets a dynamic title based on today’s date.

Save the service, and then open Preferences > Keyboard > Shortcuts to assign a keyboard shortcut. I have assigned ⌘⌥S as the shortcut.

2016-07-27 at 10.05 AM

That’s it! Now you can test your Slack integration by selecting some text and hitting your keyboard shortcut.

2016-07-27 at 10.12 AM

Your post should appear in Slack.

2016-07-27 at 10.12 AM

You could use this from any app, not just Day One. Let me know if you’ve found this helpful or what other interesting Slack integrations you’ve made!