Back to Omi

๐Ÿ’ฌ Slack Voice Messenger for OMI

plugins/omi-slack-app/README.md

3.0.0-Android-App11.1 KB
Original Source

๐Ÿ’ฌ Slack Voice Messenger for OMI

Voice-activated Slack messaging through your OMI device. Simply say "Send message to [channel]" followed by your message, and AI will automatically post it to the right Slack channel!

โœจ Features

  • ๐ŸŽค Voice-Activated - Say "Send message" and speak naturally
  • ๐Ÿง  AI-Powered Channel Matching - AI intelligently matches spoken channel names to your workspace
  • ๐Ÿ” OAuth Authentication - Secure Slack OAuth 2.0 integration
  • ๐Ÿ“ฆ Channel Selection - Set a default channel or specify in voice command
  • โš™๏ธ Flexible Settings - Change channels anytime from mobile-first homepage
  • ๐Ÿค– Smart Message Extraction - AI cleans up filler words and formats professionally
  • ๐Ÿ”• Silent Collection - Only notifies when message is sent
  • ๐Ÿ“ฑ Mobile-First UI - Beautiful responsive Slack-themed design

๐Ÿš€ Quick Start

For OMI Users

  1. Install the app in your OMI mobile app
  2. Authenticate your Slack workspace (one-time)
  3. Select default channel (optional - you can specify in voice)
  4. Start messaging!
    • Say: "Send message to general saying hello team!"
    • Say: "Post in marketing that the campaign is live"
    • Say: "Slack message to random saying great idea!"

Trigger Phrases (ONLY these 3)

  • "Send Slack message" - "Send Slack message to general saying..."
  • "Post Slack message" - "Post Slack message in marketing that..."
  • "Post in Slack" - "Post in Slack to random saying..."

How It Works

The app intelligently processes your voice commands:

  1. Detects trigger phrase โ†’ Starts collecting
  2. Collects up to 5 segments OR stops if 5+ second gap detected
  3. AI extracts:
    • Channel name (fuzzy matches to your workspace channels)
    • Message content (cleaned and formatted)
  4. Fetches fresh channel list automatically (new channels work immediately!)
  5. Posts message to Slack
  6. Notifies you with confirmation! ๐ŸŽ‰

Example:

You: "Send Slack message to general saying hello team"
     [collecting segment 1/5...]
You: "hope everyone is having a great day"
     [collecting segment 2/5...]
     [5+ second pause - timeout!]
     โ†’ AI processes 2 segments
     
AI Extracted:
Channel: #general
Message: "Hello team, hope everyone is having a great day."

     โ†’ Message sent! ๐Ÿ””

๐ŸŽฏ OMI App Configuration

FieldValue
Webhook URLhttps://your-app.up.railway.app/webhook
App Home URLhttps://your-app.up.railway.app/
Auth URLhttps://your-app.up.railway.app/auth
Setup Completed URLhttps://your-app.up.railway.app/setup-completed

๐Ÿ› ๏ธ Development Setup

Prerequisites

  • Python 3.10+
  • Slack workspace with admin access
  • OpenAI API key
  • OMI device and app

Installation

bash
# Clone the repository
cd slack

# Create virtual environment
python3 -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

# Configure environment
cp .env.example .env
# Edit .env with your API keys

Configuration

Create .env file with:

env
# Slack OAuth Credentials (from api.slack.com/apps)
SLACK_CLIENT_ID=your_client_id
SLACK_CLIENT_SECRET=your_client_secret

# OAuth Redirect URL
OAUTH_REDIRECT_URL=http://localhost:8000/auth/callback

# OpenAI API Key (for AI channel matching & message extraction)
OPENAI_API_KEY=your_openai_key

# App Settings
APP_HOST=0.0.0.0
APP_PORT=8000

Slack App Setup

  1. Go to Slack API Apps
  2. Click "Create New App" โ†’ "From scratch"
  3. Enter app name and select workspace
  4. Navigate to "OAuth & Permissions"
  5. Add scopes:
    • channels:read - View public channels
    • chat:write - Send messages
    • groups:read - View private channels
    • users:read - View user info
  6. Set redirect URL: http://localhost:8000/auth/callback
  7. Copy Client ID and Client Secret to .env

Run Locally

bash
source venv/bin/activate
python main.py

Visit http://localhost:8000/test?dev=true to test!

โ˜๏ธ Railway Deployment

Quick Deploy

  1. Push to GitHub

    bash
    git init
    git add .
    git commit -m "Initial commit"
    git remote add origin https://github.com/BasedHardware/omi-slack-app.git
    git branch -M main
    git push -u origin main
    
  2. Deploy on Railway

    • Go to railway.app
    • New Project โ†’ Deploy from GitHub
    • Select your repo
    • Add environment variables (from your .env)
  3. Get your URL

    • Settings โ†’ Networking โ†’ Generate Domain
    • You'll get: your-app.up.railway.app
  4. Update OAuth Redirect

    • Railway Variables: OAUTH_REDIRECT_URL=https://your-app.up.railway.app/auth/callback
    • Slack App: Update redirect URL to same
  5. Configure OMI

    • Use your Railway URLs in OMI app settings

Railway Environment Variables

Add these in Railway dashboard:

SLACK_CLIENT_ID
SLACK_CLIENT_SECRET
OPENAI_API_KEY
OAUTH_REDIRECT_URL=https://your-app.up.railway.app/auth/callback
APP_HOST=0.0.0.0
APP_PORT=8000
PYTHONUNBUFFERED=1

Note: PYTHONUNBUFFERED=1 ensures instant log output (no buffering delays)

๐Ÿงช Testing

Web Interface

Visit https://your-app.up.railway.app/test?dev=true to:

  • Authenticate your Slack workspace
  • Test voice commands by typing
  • See real-time logs
  • Verify messages are posting

With OMI Device

  1. Configure webhook URLs in OMI Developer Settings
  2. Enable the integration
  3. Authenticate Slack and select default channel (optional)
  4. Say: "Send message to general saying hello team!"
  5. Wait for AI processing (silent)
  6. Get notification with confirmation! ๐ŸŽ‰

๐Ÿง  AI Processing

The app uses OpenAI for intelligent processing:

  1. Channel Matching - Fuzzy matches spoken channel names to workspace channels
  2. Message Extraction - Extracts clean message content from voice segments
  3. Cleanup - Removes filler words, fixes grammar, proper formatting

Example Transformation:

Input (3 segments):
"to general saying um hello team hope you're all um doing great today"

AI Output:
Channel: #general (matched from "general")
Message: "Hello team, hope you're all doing great today"

๐Ÿ“Š How Segments Work

OMI sends transcripts in segments as you speak. The app:

  • โœ… Detects trigger phrase (Send Slack message / Post Slack message / Post in Slack)
  • โœ… Collects up to 5 segments MAX
  • โœ… Processes early if 5+ second gap detected (minimum 2 segments)
  • โœ… Silent during collection (no spam)
  • โœ… AI processes all collected segments together
  • โœ… One notification on completion

Smart Collection:

  • Max segments: 5 (including trigger)
  • Timeout: 5 seconds of silence โ†’ processes immediately
  • Minimum: 2 segments (trigger + content)
  • Duration: ~5-20 seconds depending on speech
  • Auto-refresh: Fetches latest channels every time (new channels work immediately!)

๐Ÿ“ฑ Channel Management

Specifying Channel in Voice

You can always specify the channel in your voice command:

  • "Send message to general saying hello"
  • "Post in marketing that campaign is live"
  • "Message to engineering about the bug fix"

AI will fuzzy match to your workspace channels!

Using Default Channel

Set a default channel in settings, then just say:

  • "Send message saying quick update for everyone"
  • Message goes to your default channel

Refreshing Channel List

The app automatically fetches fresh channels every time you send a message, so new channels work immediately without manual refresh!

You can also manually refresh:

  • Click "Refresh Channels" button on homepage
  • Or re-authenticate to get latest channels

Switching Workspaces

Click "Switch Workspace" to:

  • Connect to a different Slack workspace
  • Re-authenticate with new team
  • Switch between multiple workspaces easily

๐Ÿ” Security & Privacy

  • โœ… OAuth 2.0 authentication (no password storage)
  • โœ… Tokens stored securely with file persistence
  • โœ… Per-user token isolation
  • โœ… HTTPS enforced in production
  • โœ… State parameter for CSRF protection
  • โœ… Secure scopes: minimal required permissions

๐Ÿ› Troubleshooting

"User not authenticated"

  • Complete Slack OAuth flow
  • Check Railway logs for auth errors
  • Re-authenticate if needed

"No channel specified and no default channel set"

  • Visit app homepage
  • Select a default channel OR
  • Specify channel in voice command

"Message not sending"

  • Check Railway logs for errors
  • Verify channel exists and bot has access
  • Ensure Slack app has correct scopes
  • Check Slack API rate limits

"Channel not found"

  • Check channel name pronunciation
  • AI does fuzzy matching but might need clearer speech
  • Use "Refresh Channels" to update list
  • Set as default channel in settings

"Railway deployment fails"

  • Verify all environment variables are set
  • Check build logs for specific errors
  • Ensure OAUTH_REDIRECT_URL matches Slack app

๐Ÿ“ Project Structure

slack/
โ”œโ”€โ”€ main.py                  # FastAPI application with mobile-first UI
โ”œโ”€โ”€ slack_client.py          # Slack API integration
โ”œโ”€โ”€ message_detector.py      # AI-powered message & channel detection
โ”œโ”€โ”€ simple_storage.py        # File-based storage (users & sessions)
โ”œโ”€โ”€ requirements.txt         # Python dependencies
โ”œโ”€โ”€ railway.toml            # Railway deployment config
โ”œโ”€โ”€ runtime.txt             # Python version
โ”œโ”€โ”€ Procfile                # Alternative deployment platforms
โ”œโ”€โ”€ .env.example            # Environment template
โ”œโ”€โ”€ .gitignore             # Git ignore rules
โ”œโ”€โ”€ LICENSE                # MIT License
โ””โ”€โ”€ README.md              # This file

๐Ÿ”ง API Endpoints

EndpointMethodDescription
/GETHomepage with channel selection (mobile-first)
/authGETStart Slack OAuth flow
/auth/callbackGETOAuth callback handler
/setup-completedGETCheck if user authenticated
/webhookPOSTReal-time transcript processor
/update-channelPOSTUpdate selected default channel
/refresh-channelsPOSTRefresh channel list
/testGETWeb testing interface
/healthGETHealth check

๐Ÿค Contributing

  1. Fork the repository
  2. Create feature branch (git checkout -b feature/amazing)
  3. Commit changes (git commit -m 'Add amazing feature')
  4. Push to branch (git push origin feature/amazing)
  5. Open a Pull Request

๐Ÿ“ License

MIT License - see LICENSE file for details.

๐Ÿ†˜ Support

๐ŸŽ‰ Credits

Built for the OMI ecosystem.

  • OMI Team - Amazing wearable AI platform
  • Slack - Team communication platform
  • OpenAI - Intelligent text processing

Made with โค๏ธ for voice-first team communication

Features:

  • ๐ŸŽค Voice-activated Slack messaging
  • ๐Ÿง  AI-powered channel matching
  • ๐Ÿ“ฑ Mobile-first workspace management
  • ๐Ÿ” Secure Slack OAuth integration
  • โšก Real-time processing with Railway deployment