Creating a Daily Comic Slack Bot

Ilya Kaminsky
The Academy
Published in
1 min readDec 18, 2016

--

When it comes to task automation, few tools are as powerful as bots. Yet, not all bots have to solve serious business problems. Some can be fun. In this article, I am going to show you how to deploy a simple bot that posts a daily Dilbert comic to a Slack channel. The source code is available on GitHub.

Slack Integration

  1. Create a new Incoming WebHook on the Custom Integrations page
  2. Copy and save the Webhook URL
    It should start with https://hooks.slack.com
    You’ll need it for the commands below

Deploy Bot with Zeit’s Now

  1. Download “Δ now” from Zeit.co
    Alternatively, install it with npm (npm install now -g)
  2. Deploy the application with the environment flag
    now -e SLACK_WEBHOOK_URL=<URL from #2 above>
And that’s it!

If you want to deploy my version of the bot, so that it posts to the #dilbert channel every day at 15:00 UTC (7am PST / 10am EST), you can do it with one simple command:

now deploy \
-e SLACK_WEBHOOK_URL=[CHANGE ME] \
https://github.com/ilyakam/dilbertbot

Remember to substitute [CHANGE ME] with your SLACK_WEBHOOK_URL in the command above.

--

--