A quick-and-dirty out-of-office Slack autoreply based on NodeJS.
Sends an ephemeral message when someone DMs you. Use chat.postMessage if you want to send an actual message.
You'll need NodeJS (tested on 12.15.0) and the Slack legacy token.
yarn installClone the .env.example file to .env
cp .env.example .envRequest your Slack legacy token and replace xoxp-your-token in the .env file with it.
yarn startInstall pm2
npm install pm2@latest -gStart the server by running
pm2 start server.js --name your-app-nameAlternatively, for convenience you can create a ecosystem.config.js config file with the following example and simply run pm2 start
module.exports = {
apps: [
{
name: "your-app-name",
script: "server.js"
}
]
};The server.js uses the "Require hook" hack, check it out here.
Enjoy!