Building a low-cost Slack welcome bot with Zapier

When someone joins the Code Corps Slack, I really want to be there to give them a warm hello. I also want to help direct them to the right place. But it’s hard to be a greeter and a traffic cop once you get to a certain size.

Lots of hellos!

We’re at 103 members in our Slack group at the time of this writing, and we get around ten new members each week. Introducing them to our Slack sounds like a perfect job for a bot.

But I also didn’t have much time to spend trying to write custom code or decide between the many GitHub Slack bot projects. I wanted something relatively low-cost.

If you haven’t seen it yet, Zapier has a pretty powerful user interface for interacting with APIs like Slack’s. Here’s an overview of how our welcome-bot works.

Slack bot UI

All this says is that whenever a new user joins the Code Corps Slack, we should send them a direct message.

The template of the Slack message itself is where the real magic happens. Here we can use the username from the last step – our new user – and start filling out our message text for what we’d like to greet them with.

Zapier's Slack message text UI

The hardest part of this was pulling values of out of the Slack API for my own username and the channels I wanted to tell people about. You can list your channels in Slack’s API tester.

You should get a JSON response that looks something like this, where the id of the channel is the value you’ll use in the template I showed above.

    "ok": true,
    "channels": [
            "id": "C0BDJEZ14",
            "name": "announcements",
            "is_channel": true,

To render something like @joshsmith simply requires you to write <@U07BMEDSA|joshsmith>. If we want to tell them to check out the #code-corps-api channel, then we just write <#C07L27S3Y|code-corps-api>.

We can give our bot a nice name and a friendly face by choosing an emoji icon. Since our bot’s a welcome bot, I went with :wave:.

Naming our bot and giving it an icon

Now when new users get greeted to our Slack, they get a nice welcome message like this:

Code Corps Slack welcome-bot says hello

Want our welcome-bot to wave hello to you? Get an invite to the Code Corps Slack and the bot will see you there.

Enjoyed this post?

Our best content on open source, social good, and building products. Delievered each week for free.