Skip to content

sarmadnawaz/slack-teamops-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TeamOps Slack-Linear Bot

A powerful Slack bot integrated with Linear that helps teams manage feature requests, track team member workloads, and maintain project priorities.

🚀 Features

Core Functionality

  • Smart Message Processing: Automatically detects feature requests and status queries
  • Linear Integration: Fetches and creates tickets in Linear
  • Conversation Flow: Guides users through feature request creation with clarifying questions
  • Team Status Tracking: Shows what team members are working on
  • Priority Management: Displays current high-priority tasks

Advanced Features

  • Slash Commands: /feature-request for direct feature requests
  • Reaction Handling: Upvote feature requests with 👍 emoji
  • Daily Digests: Automated morning summaries
  • State Management: Tracks conversation context and user states
  • REST API: Full API for external integrations

🏗️ Architecture

teamops/
├── slackBot/          # Slack bot logic and message handling
├── linearClient/      # Linear API integration
├── server/           # Express.js backend and API routes
├── db/               # SQLite database and data management
├── package.json      # Dependencies and scripts
└── env.example       # Environment variables template

🛠️ Setup Instructions

1. Prerequisites

  • Node.js 16+
  • Slack App with Bot Token
  • Linear API Key
  • Linear Team ID

2. Environment Configuration

Copy env.example to .env and fill in your credentials:

cp env.example .env

Required environment variables:

  • SLACK_BOT_TOKEN: Your Slack bot token (xoxb-...)
  • SLACK_SIGNING_SECRET: Your Slack app signing secret
  • SLACK_APP_TOKEN: Your Slack app token (xapp-...)
  • LINEAR_API_KEY: Your Linear API key
  • LINEAR_TEAM_ID: Your Linear team ID

3. Install Dependencies

npm install

4. Start the Application

# Development mode with auto-restart
npm run dev

# Production mode
npm start

📱 Usage Examples

Feature Requests

Users can request features in several ways:

Direct message:

"Can we support MCP connectors?"

Slash command:

/feature-request

Bot mention:

@TeamOpsBot can we add dark mode?

The bot will respond with:

  1. Current top 3 priorities
  2. Clarifying questions about the feature
  3. Option to create a Linear ticket

Team Status Queries

Ask about team member workloads:

"What is John working on since yesterday?"
"Show me Sarah's current tasks"

General Status

Get overview of team priorities:

"What are our current priorities?"
"Show me high priority tasks"

🔧 API Endpoints

The bot includes a REST API for external integrations:

  • GET /api/feature-requests - List all feature requests
  • GET /api/feature-requests/:id - Get specific feature request
  • PUT /api/feature-requests/:id - Update feature request
  • GET /api/team-members - List team members
  • GET /api/team-members/:id/tasks - Get member's tasks
  • GET /api/priorities - Get current priorities
  • POST /api/digest - Generate daily digest

🗄️ Database Schema

The bot uses SQLite with the following tables:

  • feature_requests - Stores feature requests and their metadata
  • user_states - Tracks conversation states for multi-step flows
  • team_members - Maps Slack users to Linear team members
  • linear_tasks - Caches Linear task data

🎯 Bot Intelligence

Message Intent Detection

The bot automatically detects:

  • Feature requests: "Can we...", "I need...", "Add support for..."
  • Status queries: "What is...", "Show me...", "Current priorities"
  • Team member queries: Mentions of team member names

Conversation Flow

For feature requests, the bot guides users through:

  1. Feature description
  2. Urgency level (High/Medium/Low)
  3. Deadline information
  4. Linear ticket creation

Priority Mapping

  • High urgency → Priority 1 (Critical)
  • Medium urgency → Priority 2 (High)
  • Low urgency → Priority 3 (Medium)

🔒 Security Features

  • Input validation and sanitization
  • Rate limiting on API endpoints
  • Secure environment variable handling
  • SQL injection prevention
  • CORS configuration

🧪 Testing

Run tests with:

npm test

📊 Monitoring

The bot includes health checks and logging:

  • GET /health - Application health status
  • Console logging for debugging
  • Error handling and recovery

🤝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Submit a pull request

📄 License

MIT License - see LICENSE file for details

🆘 Support

For issues and questions:

  1. Check the logs for error messages
  2. Verify your environment variables
  3. Ensure your Slack app has the required permissions
  4. Confirm your Linear API key has proper access

🔄 Deployment

Local Development

npm run dev

Production

npm start

Docker (Optional)

FROM node:16-alpine
WORKDIR /app
COPY package*.json ./
RUN npm ci --only=production
COPY . .
EXPOSE 3000
CMD ["npm", "start"]

Happy coding! 🚀

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published