A Hubot chatbot instance connected to Slack, with Redis for persistence.
- Node.js (v18+ recommended)
- Slack app with Socket Mode enabled
- Required tokens (see Environment Variables below)
- Redis instance (local or remote)
-
Configure environment variables:
cp .env-dist .env # Edit .env with your actual tokens -
Run locally (shell adapter for testing):
npm run local -
Run with Slack adapter:
# Load environment variables and start Hubot source .env npm start
Scripts live in scripts/ and are auto-loaded at startup. Each script should follow this pattern:
// Description
// Brief description of what the script does
//
// Commands
// hubot command <args> - What it does
//
// Configuration (optional)
// ENV_VAR_NAME - Purpose
module.exports = (robot) => {
robot.respond(/pattern/i, (msg) => {
// Command logic here
});
};Key concepts:
robot.respond(/pattern/)- Matches when bot is mentionedrobot.hear(/pattern/)- Matches any message in channel- Use
msg.send()to reply - Access environment variables via
process.env.VAR_NAME - Use
robot.http(url)for HTTP requests
- Install the package:
npm install <package-name> - Add to
external-scripts.json - Restart the bot
npm test # Validates environment configurationCore variables needed (see .env-dist for complete list):
HUBOT_SLACK_APP_TOKEN- Slack app-level token (starts withxapp-)HUBOT_SLACK_BOT_TOKEN- Slack bot token (starts withxoxb-)REDIS_URL- Set to your Redis server (e.g.,redis://localhost:6379)
Service-specific scripts may require additional API keys.
Deployment can be triggered via custom Jenkins integration (see scripts/deploy.js).