Kamal Nasser

Dropin ChatOps: turning existing workflows and scripts into Slack Commands

September 09 2018 post

Dropin is a minimalist Slack slash command integration with one purpose: bridging the gap between Slack and existing shell scripts and programs.

Dropin runs specific commands and sends their output back to Slack. This allows you to add your existing scripts to Slack without having to build a specific integration around them—for most kinds of use-cases, Dropin will Just Work™ out of the box.

Dropin supports basic authorization in the form of whitelisted channels and user IDs.

How to Add Dropin to your Slack Team


  • A Linux server (I hear DigitalOcean have some good cloud servers 😉)
  • A domain name. A subdomain will work too. (required by Slack)

Configuring Slack

Start by creating a new Slack slash command here. Fill out these fields:

  • Command
  • URL: https://yourdomain.com
  • Method: POST
  • Token: Slack will auto-generate one for you
  • Tick Show this command in the autocomplete list if you like

Installing Dropin

Dropin is released as a static binary. You can download the latest release from the releases page on GitHub. Once you've done so, place the binary wherever you want: /usr/local/bin, /opt/dropin, etc. Set proper permissions by running:

sudo chown root:root /path/to/dropin
sudo chmod 755 /path/to/dropin

Configuring Dropin

Dropin uses a config file to store the Slack connection info and other settings as well as the chatops commands. Start by setting the global settings:

team = "Slack Team ID"
token = "Slack Token"
listenaddress = ""
timeout = "3m"

timeout is the global timeout value for chatops commands. Commands that exceed the timeout limit will be canceled. This default value can be overriden per individual command.

Set up authorization:

    name = "user name"
    id = "user ID"

    name = "channel name"
    id = "channel ID"

Helpful links:

Add a Command

To add a command, add a section like this to the config file:

    name = "test"
    description = "This is a test command"
    executable = "/bin/echo"
    chdir = "/tmp"
    args = ["test"]

With this command, running /chatops test will return test—the output of running /bin/echo test.

Available options are:

  • name name, passed to the slash command. No spaces allowed
  • description description
  • executable = "/bin/sleep"
  • chdir the working directory to run the command in
  • args an array of arguments passed to the command
  • takesArguments boolean. if true, any arguments passed to the slash command will be appended to the original command
  • timeout an optional override of the global timeout limit

Another example command:

    name = "sleep"
    description = "This command should fail"
    executable = "/bin/sleep"
    chdir = "/tmp"
    args = ["5"]
    takesArguments = false
    timeout = "2s"


It's always recommended for web services to communicate over HTTPS instead of plain HTTP. While Slack allows you to run slash commands over HTTP, Dropin can easily be put behind an HTTPS proxy. We'll use Caddy but you can use whichever web server you like (Nginx, traefik, etc.).

First, set Dropin to listen locally, e.g. localhost:4000. You can use any port you like as long as it's not used by another process and is over 1024.

Add the following to your Caddyfile and Caddy will take care of the rest.

yourdomain.com {
    tls your-email-address-here
    proxy / http://localhost:4000

Set Slack to use https://yourdomain.com/ as the slash command URL and you'll be all set.

Running Dropin as a System Service

You can use the following Systemd service unit file to run Dropin as a service. All chatops commands will be run as the same user that is running Dropin so pick one that works for you. If your commands don't need any special privileges, you can always use nouser as the user and nogroup as the group.

Description=dropin-chatops for Slack



ExecStart=/opt/dropin/dropin -config /opt/dropin/dropin.toml


Replace /opt/dropin/dropin with the path to the Dropin binary, and /opt/dropin/dropin.toml with the path to config file.

Save the file in /etc/systemd/system/dropin.service and enable it:

sudo systemctl daemon-reload
sudo systemctl start dropin
sudo systemctl enable dropin