Serverless slack emojibot

Serverless slack bot for emoji

Emojibot

A Slack bot that joins the conversation with emojis.

Getting started

  1. Create an AWS account if haven't got one already

  2. Install Serverless and configure your AWS credentials

  3. Deploy the server to AWS Lambda:

    npm install
    serverless deploy
    

    Note that you'll be charged for these services until they are removed.

    Make a note of the endpoints output once it has deployed, e.g.:

    endpoints:
      POST - https://ab12cd34ef.execute-api.eu-west-1.amazonaws.com/dev/event
      POST - https://ab12cd34ef.execute-api.eu-west-1.amazonaws.com/dev/explain
    
  4. Update the Slack app manifest for your server:

    1. Open manifest.yml
    2. Replace <event endpoint> with the event endpoint
    3. Replace <explain endpoint> with the explain endpoint
    4. Copy the contents of this file to your clipboard (no need to save these changes)
  5. Create your Slack app from the manifest:

    1. Create a Slack app
    2. Select 'From an app manifest'
    3. Select your workspace and click 'Next'
    4. Paste in the manifest from your clipboard and click 'Next'
    5. Click 'Create'
  6. Install the Slack app to your workspace:

    1. Under 'Basic Information / Install your app' click 'Install to Workspace'
    2. Click 'Allow' to authorize the permissions
    3. Under 'Basic Information / Display Information' click '+ Add App Icon'
    4. Select and upload resources/emojibot.png
    5. Select 'OAuth & Permissions' and under 'Bot User OAuth Token' click 'Copy'
  7. Configure the server credentials:

    1. Create a .env file (do not commit this file, it is already Git ignored):

      # Environment variables -- DO NOT COMMIT!
      
      BOT_ACCESS_TOKEN = <bot access token>
      
    2. Replace <bot access token> with your copied bot user OAuth token

    3. Save the file

    4. Redeploy the server to update the environment variable:

      serverless deploy
      

Updating emojis

The bot works by using a map of words to emojis. This map is derived from emoji-data and emojilib and stored in emoji.js. To regenerate it:

npm run generate

Running tests

To run the unit tests:

npm test

Removing

To undeploy the server from AWS:

serverless remove

See also