Skip to content

gameballers/slack-solution-bot

Repository files navigation

Slack Solution Bot - AWS Lambda

A Slack bot that manages solution team requests and creates ClickUp tasks, deployed on AWS Lambda using the Serverless Framework.

Features

  • Listens for messages in a specific Slack channel
  • Interactive buttons to classify requests (Question, Design, RFP)
  • Collects additional details through threaded conversations
  • Creates ClickUp tasks with collected information
  • Serverless architecture using AWS Lambda and DynamoDB

Prerequisites

  • Node.js 18.x or later
  • AWS CLI configured with appropriate credentials
  • Serverless Framework (npm install -g serverless)
  • Slack App configured with Events API (not Socket Mode)
  • ClickUp API token

Slack App Configuration

Your Slack app must be configured with Events API (not Socket Mode):

  1. Go to your Slack App settings at https://api.slack.com/apps
  2. Navigate to Event Subscriptions
  3. Enable Events and set Request URL to: https://YOUR-API-GATEWAY-URL/slack/events
    • You'll get this URL after deploying (see deployment steps below)
  4. Subscribe to bot events:
    • message.channels - Listen for messages in channels
  5. Navigate to OAuth & Permissions
  6. Add Bot Token Scopes:
    • chat:write - Send messages
    • channels:history - View messages in channels
    • users:read - View user information
  7. Install/Reinstall the app to your workspace

Environment Variables

The following environment variables are required:

  • SLACK_BOT_TOKEN - Your Slack bot token (xoxb-...)
  • SLACK_SIGNING_SECRET - Your Slack signing secret
  • SOLUTION_CHANNEL_ID - The Slack channel ID to monitor
  • CLICKUP_API_TOKEN - Your ClickUp API token
  • CLICKUP_LIST_ID - The ClickUp list ID where tasks will be created

Deployment

  1. Install dependencies:

    npm install
  2. Set up your environment variables in .env file (for reference)

  3. Deploy to AWS:

    npm run deploy
  4. After deployment, you'll see output like:

    endpoints:
      POST - https://abc123.execute-api.us-east-1.amazonaws.com/prod/slack/events
    
  5. Copy the endpoint URL and configure it in your Slack App's Event Subscriptions Request URL

  6. Test by sending a message in your configured Slack channel

AWS Resources Created

The deployment creates:

  • Lambda Function: Processes Slack events
  • API Gateway: HTTP endpoint for Slack to send events
  • DynamoDB Table: Stores conversation state (with 24-hour TTL)
  • IAM Role: Permissions for Lambda to access DynamoDB

Commands

  • npm run deploy - Deploy to AWS
  • npm run remove - Remove all AWS resources
  • npm run logs - View Lambda function logs

CI/CD with GitHub Actions

This project includes automated deployment workflows:

  • Production: Auto-deploys when pushing to main or master branch
  • Staging: Auto-deploys when pushing to develop or staging branch

Setup Instructions: See GITHUB_ACTIONS_SETUP.md

Quick setup:

  1. Add GitHub Secrets (AWS credentials, Slack tokens, etc.)
  2. Push to main branch
  3. GitHub Actions automatically deploys to AWS Lambda

No manual deployment needed! 🚀

Architecture

Slack Event → API Gateway → Lambda → DynamoDB
                                  ↓
                              ClickUp API

State Management

Conversation state is stored in DynamoDB with:

  • Primary Key: threadTs (Slack thread timestamp)
  • TTL: 24 hours (automatic cleanup)
  • Attributes: userId, messageTs, originalMessage, step, requestType, additionalDetails

Cost Estimation

This solution uses AWS free tier eligible services:

  • Lambda: 1M free requests/month
  • DynamoDB: 25GB storage + 25 RCU/WCU free
  • API Gateway: 1M API calls free for 12 months

Expected monthly cost after free tier: < $1 for typical usage

Troubleshooting

Slack events not reaching Lambda

  • Verify API Gateway endpoint is configured in Slack Event Subscriptions
  • Check Lambda logs: npm run logs
  • Ensure Slack signing secret is correct

Bot not responding in channel

  • Verify SOLUTION_CHANNEL_ID matches your channel
  • Check bot is invited to the channel
  • Ensure bot has proper OAuth scopes

ClickUp tasks not created

  • Verify CLICKUP_API_TOKEN is valid
  • Verify CLICKUP_LIST_ID exists and bot has access
  • Check Lambda logs for error details

Security Notes

  • Never commit .env file to version control
  • Use AWS Secrets Manager or Parameter Store for production secrets
  • Rotate Slack tokens and ClickUp API keys regularly
  • Review IAM permissions to ensure least privilege

Team Deployment

To share with your team:

  1. Share this folder (excluding node_modules and .env)
  2. Team members need:
    • AWS credentials with appropriate permissions
    • Environment variables (share securely, not via git)
  3. Each team member can deploy to their own AWS account/stage
  4. For production, use CI/CD pipeline (GitHub Actions, GitLab CI, etc.)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •