A simplified Slack bot that generates custom Bombo character stickers using AI image generation. This bot is built with TypeScript and follows a simple, straightforward structure similar to the Python example.
- Simple Structure: No complex services or abstractions - just the core functionality
- AI Image Generation: Uses Replicate's FLUX 1.1 Pro model to generate Bombo stickers
- Slack Integration: Built with Slack Bolt framework for easy deployment
- Socket Mode: Runs in socket mode for easy development and deployment
/generate [prompt]- Generate a custom Bombo sticker based on your description- @mention Bombo in any channel to chat with him — he replies in-thread
- DM Bombo directly for a private conversation
Bombo remembers the last 20 messages per channel, so he has context for the current conversation.
Create a .env file with the following variables:
SLACK_BOT_TOKEN=your_slack_bot_token
SLACK_APP_TOKEN=your_slack_app_token
REPLICATE_API_TOKEN=your_replicate_api_token
OPENAI_API_KEY=your_openai_api_key
...This bot stores generated images in Stackhero Object Storage (compatible with Amazon S3) for better performance and reliability. To set this up:
Add Stackhero Object Storage to your Heroku app:
heroku addons:create ah-s3-object-storage-stackhero --app <your-app-name>For security, create a dedicated user instead of using root credentials:
- Open the Stackhero dashboard:
heroku addons:open ah-s3-object-storage-stackhero- Select your MinIO service and click "Console"
- Login with root credentials (retrieve with
heroku config:get STACKHERO_MINIO_ROOT_ACCESS_KEY) - Go to "Users" → "Create a user"
- Set access key, secret key, and select "readwrite" policy
Add these variables to your .env file:
STACKHERO_MINIO_HOST=your-minio-host-here
STACKHERO_MINIO_ACCESS_KEY=your-access-key-here
STACKHERO_MINIO_SECRET_KEY=your-secret-key-here
STACKHERO_MINIO_BUCKET=bombo-images # Optional, defaults to 'bombo-images'For local development, you can retrieve the config variables:
heroku config:get STACKHERO_MINIO_HOST
heroku config:get STACKHERO_MINIO_ACCESS_KEY
heroku config:get STACKHERO_MINIO_SECRET_KEY- Install dependencies:
pnpm install-
Set up your environment variables in
.env -
Run the bot:
# Production
pnpm start
# Development
pnpm dev
# Development with watch mode
pnpm dev:watchThe bot now follows an enhanced flow with image storage:
- User types
/generate [description] - Bot acknowledges the command and posts a "generating" message
- Bot calls Replicate's FLUX 1.1 Pro model with the user's prompt
- Bot downloads the generated image and stores it in Stackhero Object Storage
- Bot serves the stored image URL for better performance and reliability
- If there's an error, the bot updates the message with error details
The bot now includes:
- Storage Service (
src/services/storage.ts) - Handles image storage in Stackhero Object Storage - Chat Service (
src/services/chat.ts) - Manages Bombo's conversational AI via OpenAI GPT-4o, with per-channel history - Bombo Persona (
src/knowledge/bombo-persona.ts) - Knowledge base defining Bombo's personality, speech style, and world knowledge - Main Bot Logic (
src/index.ts) - Orchestrates image generation, chat, and Slack event handling - Environment-based configuration - Includes storage credentials
- Error handling with proper fallbacks
Bombo uses GPT-4o with a rich system prompt that gives him:
- A distinct vintage/comic personality with Italian flair
- Awareness of his role in the workspace
- Conversational memory (sliding window of 20 messages per channel)
- Knowledge of what he can do (
/generatestickers)
Bombo is a round-faced, joyful man with a big mustache, wearing a felt hat, buttoned shirt, vest, and suspenders. The AI model generates him in a vintage comic book style with transparent backgrounds, perfect for use as stickers.
The bot automatically detects development mode when NODE_ENV=development is set, which enables:
- Enhanced logging for debugging
- Performance timing
- Additional development commands (
/dev-test) - Debug log level
To enable chat, make sure the following scopes are added in your Slack App settings:
Bot Token Scopes:
app_mentions:read— receive @mention eventschat:write— post messagesim:history— read DM history (for DM conversations)users:read— look up display names
Event Subscriptions (Socket Mode):
app_mentionmessage.im
The bot is designed to run in Slack's Socket Mode, making it easy to deploy without exposing webhooks. Simply run the bot and it will connect to Slack automatically.