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 install
Clone the .env.example
file to .env
cp .env.example .env
Request your Slack legacy token and replace xoxp-your-token
in the .env
file with it.
yarn start
Install pm2
npm install pm2@latest -g
Start the server by running
pm2 start server.js --name your-app-name
Alternatively, 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!