Syncing your Slack status with Google Calendar because nothing is sacred anymore
Summer 2019: I’ve made a few updates. Scroll to the bottom to learn more.
I wrote some code that mirrors Google Calendar to my Slack status. I did this because I’m lazy, and I don’t want to manually broadcast what I’m up to in my team’s Slack channel. If you want to know what I’m doing at any point in the day, just hover over the emoji next to my name:
Along with updating my status, the code also automatically sets me to “Do Not Disturb” for the duration of any event that includes the string “[DND]” in the title. I told some of my co-workers and friends about this code, and they demanded that I share it with the world. So here we are.
What you’ll need
You’ll only need two things to get this up and running:
How this whole thing is gonna go down
Here’s the basic gist of how this works:
- You’re gonna set up an account on IFTTT and tell it to monitor Google Calendar.
- Whenever a new event starts, IFTTT will grab all the details and send them to a Node server (running on Heroku) via JSON.
- Your Node server will parse the JSON and update your Slack status via Slack’s API.
Part 1: Setting up your Node server on Heroku
- Pop over to my google-calendar-slack-status Github repo and click the big button that says “Deploy to Heroku.”
- Give your app a unique name. This will be part of your server’s URL, so make it memorable!
- Slack has recently made it harder to interact with their API, so follow the instructions at the bottom (in the updates section) to find your SLACK_TOKEN.
- Put a secret word or phrase in the SECRET_TOKEN field. You might even sprinkle in some emoji if you’re feeling particularly 😏.
- Finally, specify which time zone you’re working from in the TIME_ZONE field. This value will be appended to your status to avoid any schedule confusion.
- Click the “Deploy App” button and wait for Heroku to do its thing.
- When everything is finished, you should see “Your app was successfully deployed.” and a button to view your newly provisioned app. Click that button.
Part 2: Setting up IFTTT
- Head over to IFTTT and make sure you’re logged in.
- Click the “My Applets” link at the top of the page.
- Click the “New Applet” button.
- Click the “+ This” and type “Google Calendar.”
- Click on the Google Calendar button.
- If you haven’t already, you’ll be prompted to connect your calendar to IFTTT, so go ahead and do that.
- For your action, click on “Any event starts.”
- Choose the calendar you want to monitor, leave the “Time before event starts” at “0 minutes,” and click the “Create trigger” button.
- Click the “+ That” and type “Webhooks.”
- Click the Webhooks button and connect (if needed).
- Choose the “Make a web request” action.
- In the URL field, paste your Heroku server’s URL. In the example above, it would be
- Set the method to “POST” and the content type to “application/json.”
- Finally, for the body field, paste the JSON object that was listed on your server’s home page. In our case, it’s this:
"token": "👻 bjork is so cool 🍄"
15. Click the “Create Action” button.
16. Smash the “Finish” button on the next page, and you’re all set!
Tips and tricks
If you haven’t already, start filling every available minute of your calendar with events. Whenever you need some extra focus, simply append “[DND]” to the title of your event and let the code take care of the rest.
If you ever need to turn this damn thing off, you can do that by either deactivating the applet in IFTTT or deleting the app from your Heroku dashboard.
I think, in general, we all share too much, and this little dollop of code isn’t helping the problem. Even still, I hope it can scratch an itch for you. Thanks for reading.
I made a few changes to address feedback and comments from users.
- Statuses will now automatically expire, so long as you set the appropriate timezone on your heroku server.
- Along with “[DND],” you can also add “[AWAY]” to automatically set yourself as away for the duration of an event.
- If you use an emoji in your event name on Google calendar, Slack will use it as your status icon (if no emoji is found, it defaults to 🗓).
- It takes a bit more work to find your SLACK_TOKEN now. Follow the directions on the Github README to learn more.