A slack app for replying to specific messages with images from reddit. An example slack app using r/birdwitharms can be installed by clicking here.
- Docker host for running linux containers
- MySQL instance
Docker images (for Linux) are available on Docker Hub.
-
Create an app on Slack
-
Create a database for the app with the following schema:
CREATE TABLE `instances` ( `team_id` char(9) NOT NULL, `access_token` char(76) NOT NULL, CONSTRAINT `instances_pk` PRIMARY KEY (`team_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-
Create a config file named
appsettings.Production.json
using the following template:{ "ConnectionStrings": { "AppDbContext": "Server=myServerAddress;Database=myDatabase;Uid=myUsername;Pwd=myPassword" }, "AppSettings": { "AppId": "slack app id", "ClientId": "slack app client id", "ClientSecret": "slack app client secret", "SigningSecret": "unique string for signing auth requests", "Scopes": "channels:history,chat:write:bot", "DisplayName": "app display name", "ProductName": "app name (no spaces or special chars)", "Subreddit": "subreddit to use (excluding leading r/)", "ImageExtensions": ["jpg", "png", "gif"], "Triggers": ["array", "of", "trigger", "words"] } }
-
Run the app using the following command (a proxy should be used for TLS support):
docker run -dit --restart always --name app-name -p 80:80 -v /path/to/appsettings.Production.json:/app/appsettings.Production.json ngpitt/slack-reddit-bot:desiredCommitHash