A Slack bot that leverages Venice AI's API to generate both text responses and images directly within Slack channels.
- Text Generation: Generate AI responses using
/venice chat [prompt] - Image Generation: Create AI-generated images using
/venice image [prompt] - Inline Configuration: Customize model parameters within your prompts
- Security:
- Slack signature verification
- Rate limiting
- Helmet security headers
- HTTPS enforcement
- Health Monitoring: Built-in health check endpoint
- Node.js >= 20.0.0
- Venice AI API key
- Slack workspace with admin permissions
- A Slack App with:
- Bot Token (
xoxb-*) - Signing Secret
- App ID
- Client ID
- OAuth scopes configured (see Slack App Configuration)
- Slash commands enabled
- Event subscriptions enabled
- Interactivity enabled
- Bot Token (
# Install dependencies
yarn install
# Set up environment variables
cp .env.example .env
# Edit .env with your credentials
# Build and start
yarn build
yarn startCreate a .env file with these required variables:
NODE_ENV=development
PORT=3000
SLACK_SIGNING_SECRET=your_signing_secret_here
VENICE_API_KEY=your_api_key_here
SLACK_BOT_TOKEN=your_bot_token_here
APP_ID=your_app_id_here
CLIENT_ID=your_client_id_here
BYPASS_HTTPS_REDIRECT=boolean-
Create a new Slack app at api.slack.com/apps
-
Required Bot Token Scopes:
app_mentions:read- Allow bot to see when it's mentionedchannels:join- Allow bot to join public channelschannels:read- View basic channel informationchat:write- Send messages as the botchat:write.public- Send messages to channels the bot isn't incommands- Add slash commandsfiles:write- Upload and edit filesgroups:read- View basic private channel informationgroups:write- Manage private channels the bot is inim:write- Respond to slash commands in direct messages
-
Slash Command Configuration:
Command: /venice Request URL: https://your-domain.com/slack/commands Description: Generate AI text and images Usage hint: chat [prompt] or image [prompt] (defaults to image if not specified) -
Interactivity & Events:
Note: These endpoints are required by Slack but currently just return 200 OK responses to prevent errors.
Interactivity Request URL: https://your-domain.com/slack/interactions Events Request URL: https://your-domain.com/slack/events
Basic usage:
/venice chat Tell me a story about a catWith configuration:
/venice chat temperature:0.7, model:llama-3.3-70b, Tell me a story about a catAvailable chat configuration parameters:
{
model: string // AI model to use
prompt: string // The prompt text
temperature: number // (0-2) Response randomness
top_p: number // (0-1) Response diversity
stop: string[] // Array of stopping sequences
max_completion_tokens: number // Maximum response length
frequency_penalty: number // (-2 to 2) Repetition control
presence_penalty: number // (-2 to 2) Topic control
venice_parameters: {
character_slug: string // Character configuration
include_venice_system_prompt: boolean
}
}Basic usage:
/venice image A cat playing piano
# or simply (since image is the default)
/venice A cat playing pianoWith configuration:
/venice image model:sdxl, style:anime, A cat playing pianoAvailable image configuration parameters:
{
cfg_scale: number // Classifier free guidance scale
height: number // Image height in pixels
hide_watermark: boolean // Whether to hide the watermark
model: string // AI model to use
negative_prompt: string // Things to avoid in the generation
safe_mode: boolean // Enable/disable safe mode
seed: number // Random seed for reproducibility
steps: number // Number of diffusion steps
style_preset: string // Visual style (see list below)
width: number // Image width in pixels
}Available style presets:
3D Model, Abstract, Advertising, Alien, Analog Film, Anime, Architectural, Cinematic, Collage, Comic Book, Craft Clay, Cubist, Digital Art, Disco, Dreamscape, Dystopian, Enhance, Fairy Tale, Fantasy Art, Fighting Game, Film Noir, Flat Papercut, Food Photography, Gothic, GTA, Graffiti, Grunge, HDR, Horror, Hyperrealism, Impressionist, Isometric Style, Kirigami, Legend of Zelda, Line Art, Long Exposure, Lowpoly, Minecraft, Minimalist, Monochrome, Nautical, Neon Noir, Neon Punk, Origami, Paper Mache, Paper Quilling, Papercut Collage, Papercut Shadow Box, Photographic, Pixel Art, Pokemon, Pointillism, Pop Art, Psychedelic, Real Estate, Renaissance, Retro Arcade, Retro Game, RPG Fantasy Game, Silhouette, Space, Stacked Papercut, Stained Glass, Steampunk, Strategy Game, Street Fighter, Super Mario, Surrealist, Techwear Fashion, Texture, Thick Layered Papercut, Tilt-Shift, Tribal, Typography, Watercolor, Zentangle
# Run in development mode with hot reload
yarn dev
# Type checking
yarn type-check
# Linting
yarn lint
# Production build
yarn build
# Start production server
yarn start:prodThis project is configured for deployment on Render.com.
- Fork this repository
- Create a new Web Service on Render
- Connect your GitHub repository
- Add environment variables in Render dashboard
- Render will automatically deploy when you push to main
Note: When deploying to Render's free tier, you must set BYPASS_HTTPS_REDIRECT=true
The render.yaml configuration handles:
- Build and start commands
- Environment variables
- Health checks
- Auto-deployment
src/handlers/- Command and event handlerssrc/services/- Venice AI and Slack API integrationssrc/configs/- Configuration schemas and defaultssrc/utils/- Helper functions and utilitiessrc/middleware/- Express middleware (security, validation)
- Slack signature verification on all requests
- Rate limiting: 100 requests per 15 minutes per user/team
- Helmet.js security headers
- HTTPS redirect in production
- Environment variable validation
- Input validation using Zod
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request