Skip to content

wr46/slack-bot-server

Repository files navigation

slack-bot-server

All Contributors

A simple slack bot server template in Go for messaging

Introduction

This project is a simple Go server application for a Slack Bot.
The main goal here was to implement a Bot that answer to users in same workspace, by direct chat (user<>bot)
or mention the bot in workspace channels.

Implemented features

  • Show all available commands
  • Do a vacation request
  • Tell a joke
  • Run a local script

Usage

In order for the server to work, you need to setup a '.env' file, you can use 'example.env' as a template.

# NGROK
NGROK_AUTH=YOUR NGROK TOKEN
NGROK_PORT=botapp:3000
NGROK_REGION=eu

# Application
DEBUG=true

# Slack
BOT_USER_OAUTH_ACCESS_TOKEN=YOUR BOT USER OAUTH ACCESS TOKEN
VERIFICATION_TOKEN=YOUR APP VERIFICATION TOKEN

# Email (Gmail default)
EMAIL_SMTP_SERVER=smtp.gmail.com
EMAIL_SMTP_PORT=587
EMAIL_USER=email@gmail.com
EMAIL_PASSWORD=YOUR EMAIL PASSWORD
VACATION_RECIPIENT_EMAIL=EMAIL FOR VACATION REQUEST
  • Ngrok Token you must create a Ngrok account so you can have a private url and add it to Slack "Event Subscriptions" request URL. \
    ex: "https://NGROK_PUBLIC_URL_HERE/events-endpoint" (check Ngrok section below)
  • Bot User OAuth Token can be found after you create an app on Slack workspace
  • Verification Token can be found on "Basic Information" -> "App Credentials" of your Slack App

Note:
The email configuration was intended to be used as a vacation request process. Change it to suit your needs.

Docker

Docker build and run

docker-compose up

Ngrok

Get the Ngrok public URL using the following URL

http://localhost:4040/api/tunnels

Useful documentation

❗ Code of Conduct

We expect everyone to abide by our Code of Conduct. Please read it. 🤝

🙌🏻 How to Contribute

Check out our Contributing Guide for information on contributing.

License

slack-bot-server is licensed by an MIT license as can be found in the LICENSE file.

💜 Thanks

Thanks to everyone contributing in any manner for this repo and we extend this thanks to everyone working on Open Source.

Sharing is Caring

Contributors ✨


Wilson Rodrigues

💻 🚧

Yosyp Schwab

📖

About

A simple slack bot server template in Go

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published