Skip to content
This repository has been archived by the owner on Aug 12, 2022. It is now read-only.
/ mrrobot Public archive
forked from gen1us2k/mrrobot

A simple greetings bot for Slack that uses events api and hosted on AWS Lambda

Notifications You must be signed in to change notification settings

ory/mrrobot

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mr. Robot a greeter bot for your slack community

A simple greeter bot for your slack communities. The main reason of this bot to have better onboarding experience for newly joined users. This bot built using slack events api and hosted on AWS lambda

Local Development

Clonning the repo

git clone git@github.com:gen1us2k/mrrobot
cd mrrobot

The bot has make commands to speedup development

   build_docker                   Build docker image
   build_linux                    Build executable for linux system
   lint                           Runs linter against the code
   test                           Run tests locally
   zip                            Build and create a zip archive for deploying to AWS lambda

Deploying to AWS

  1. Signin to AWS Console and go to the Lambda service
  2. Create a new function from scratch using Go 1.x SDK
  3. Run make zip to create a zip archive to upload to the AWS
  4. Upload a zipfile to run your code

Configuring AWS API Gateway

  1. Create a new REST API.

  2. In the "Resources" section create a new ANY method to handle requests to / (check "Use Lambda Proxy Integration").

    API Gateway index

  3. Add a catch-all {proxy+} resource to handle requests to every other path (check "Configure as proxy resource").

    API Gateway catch-all

  4. Deploy your API gateway and copy gateway url

Configuring slack

  1. Create a new application
  2. Copy signing secret from Basic information page (at the bottom of the page)
  3. Open Oauth and permissions page of your application and add channels:history, chat:write and users:read to both Bot Token scopes and User token scopes
  4. Go to the Basic information page and open Event subscriptions
  5. Turn on Enable events and paste your API Gateway URL

Environment variables

# ENV variable can have development or production. production uses aws lambda sdk to run. development uses standard net/http handler.
# Default: development
ENV=development

# BIND_ADDR configures bind address for local development
# Default: :12022
BIND_ADDR=:12022

# SLACK_SIGNING_SECRET stores signing secret from slack. You can get one on `Basic information` of your app
# Default: unset
SLACK_SIGNING_SECRET=

# SLACK_BOT_TOKEN can start with xoxp or xoxb. Put xoxp if you want to send message from your personal account. xoxb sends message from the bot username
# Default: unset
SLACK_BOT_TOKEN=xoxp...

# WELCOME_MESSAGE stores welcome message for your onboring experience
# Default: unset
WELCOME_MESSAGE=Hello

About

A simple greetings bot for Slack that uses events api and hosted on AWS Lambda

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 72.9%
  • Shell 12.9%
  • Makefile 10.6%
  • Dockerfile 3.6%