A TypeScript-based Slack bot that acts as an adaptor for an external Conversational AI Agent.
- Listens for mentions and monitored threads.
- Responds to DMs automatically.
- Summarizes long threads (Head + Tail).
- Caches User and Channel names in Redis.
- Connects to an external AI API for intelligence.
- Dockerized setup.
-
Environment Variables: Copy
env.exampleto.envand fill in your Slack credentials and External Agent URL.cp env.example .env -
Docker: Run the app and Redis with Docker Compose (V2).
docker compose up --build -
Local Development:
- Install dependencies:
npm install - Start Redis locally (or via Docker).
- Run dev server:
npm run dev
- Install dependencies:
src/app.ts: Entry point.src/listeners/: Event handlers for mentions and messages.src/services/: Core logic (Cache, Context, Slack, Agent).
The bot sends a POST request to AGENT_API_URL with:
{
"thread_id": "167890.12345",
"messages": [
{ "role": "user", "name": "Alice", "content": "Hello", "timestamp": "..." },
...
],
"is_direct_mention": true
}
The Agent should return JSON:
{
"response": "Hello Alice!",
"should_respond": true
}
(Or just {"text": "Hello Alice!"})