ldenman / serverless-slack-memebot

A serverless slackbot used to generate memes :tada:

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

serverless-slack-memebot

We implemented a memebot for slack, built on the serverless framework to use as a demonstration for the Disruptors in Tech meetup. See slides. It was implemented by GorillaStack to serve as a boilerplate for similar serverless projects.

The key purpose of the talk was to demonstrate how to work with frameworks and minimise risks around framework changes and provider lock-in.

Usage

Development environment

It is possible to run this slackbot in your slack rooms without deploying to AWS!

Terminal1:

#!/bin/bash

## First install npm dependencies for the project
npm install

## Now install npm dependencies that will be packaged up with our slackbot and deployed
pushd bot && npm install && popd

## Now run babel in watch mode to listen for changes to our code
npm run compile:dev

Terminal2:

#!/bin/bash

## Move into the bot/ directory
cd bot

## Run the offline plugin for the serverless framework to emulate API gateway and invoke our lambda functions
## We should now be listening on localhost:3000
sls offline

Terminal3:

#!/bin/bash

## Use ngrok to expose our localhost:3000 to a public https endpoint
ngron http 3000

While contributing, or working on your fork, run npm test to run tests, npm run cover to run tests and check code coverage and npm run lint to check our code styling. To see an HTML report of our code coverage, go to /path/to/project/coverage/lcov-report/index.html in your web browser.

Slack configuration

To integrate your development, production or any other environment with slack, you will need to set up a slack app.

  1. Go to https://api.slack.com/apps
  2. Click the "Create New App" button
  3. Enter your app's name and a development slack team and click "Create App" create app
  4. Under "Add features and functionality", click "Slash Commands" add features and functionality
  5. Click "Create New Command"
  6. Enter the command details and press save slash command details
  7. Select OAuth & Permissions from the sidebar
  8. Click "Install App to Team" to finish :)

Deploy to production

About

A serverless slackbot used to generate memes :tada:

License:MIT License


Languages

Language:JavaScript 100.0%