Awesome
Emojibot
A Slack bot that joins the conversation with emojis.
Getting started
-
Create an AWS account if haven't got one already
-
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
-
Update the Slack app manifest for your server:
- Open
manifest.yml
- Replace
<event endpoint>
with theevent
endpoint - Replace
<explain endpoint>
with theexplain
endpoint - Copy the contents of this file to your clipboard (no need to save these changes)
- Open
-
Create your Slack app from the manifest:
- Create a Slack app
- Select 'From an app manifest'
- Select your workspace and click 'Next'
- Paste in the manifest from your clipboard and click 'Next'
- Click 'Create'
-
Install the Slack app to your workspace:
- Under 'Basic Information / Install your app' click 'Install to Workspace'
- Click 'Allow' to authorize the permissions
- Under 'Basic Information / Display Information' click '+ Add App Icon'
- Select and upload
resources/emojibot.png
- Select 'OAuth & Permissions' and under 'Bot User OAuth Token' click 'Copy'
-
Configure the server credentials:
-
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>
-
Replace
<bot access token>
with your copied bot user OAuth token -
Save the file
-
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