Skip to content

crazyoptimist/slack-rails-bot-starter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

deb640a Â· Mar 11, 2024

History

63 Commits
Oct 29, 2023
Sep 28, 2020
Dec 22, 2022
Oct 29, 2023
Dec 22, 2022
Sep 17, 2020
Sep 17, 2020
Nov 16, 2020
Sep 17, 2020
Sep 17, 2020
Oct 29, 2023
Oct 29, 2023
Oct 29, 2023
Oct 29, 2023
Oct 29, 2023
Oct 29, 2023
Oct 29, 2023
Mar 11, 2024
Mar 11, 2024
Sep 17, 2020
Dec 23, 2022
Oct 29, 2023

Repository files navigation

Slack Rails Bot Starter

This is a boilerplate for building slack apps with Ruby on Rails.

The default branch master uses Mongoid as database adapter. For ActiveRecord, please check postgres branch.

Setup

Prerequisites

  • FQDN(Fully Qualified Domain Name) to host the app publicly. You can also choose to use ngrok instead.

Create a New Slack App

  1. Create a new app here
  2. Navigate to the OAuth & Permissions page and add the following Bot Token Scopes:
  1. Activate Interactivity & Shortcuts and add this url: BASE_URL/api/slack/action
  2. Activate Slash Commands adding two slash commands /ping, /quiz and use this url: BASE_URL/api/slack/command
  3. Activate Event Subscriptions subscribing to the event type member_joined_channel and add this url: BASE_URL/api/slack/event(This step needs the application to be running :D so you can skip this and come back a few mins later)
  4. Navigate to the App Home page and toggle Always Show My Bot as Online (according to your reference)

Install Dependencies and Create a .env File

bundle install
cp .env.example .env

Go to https://api.slack.com/apps, click on your application.

Checkout what's needed for .env from the Basic Information section.

Run the App

rails s

Open BASE_URL in your browser.

Learn More About Slack Apps with Ruby

Deployment

Please follow the standard Ruby on Rails application deployment methods.

Contributing

Thanks in advance for your contribution!

Credit

This boilerplate uses Slack Ruby Bot Server Events.

Thanks to Daniel Doubrovkine and all the contributors.

Made with ❤️ by crazyoptimist