AI messaging CRM for WhatsApp, Telegram, and external apps.
Wanie is a self-hosted customer messaging CRM that ships as a CLI package. It combines a Next.js dashboard, an Express API, Prisma-backed data access, Socket.IO realtime updates, media uploads, runtime API documentation, and AI automation in a single local-first package.
Wanie is also designed to be AI-agent-ready. The runtime exposes agent-friendly documentation, machine-readable OpenAPI output, and API key authentication so AI agents and automation tools can discover capabilities and interact with the workspace without reverse-engineering the app.
Wanie also includes a CRM AI workspace for customer support automation. You can upload knowledge-base documents, generate AI drafts, enable guarded auto-replies, and serve both WhatsApp and Telegram customer conversations from the same dashboard.
Wanie is an independent open source project. It is not an official WhatsApp product and is not affiliated with, endorsed by, or sponsored by Meta or WhatsApp.
If you use Wanie with WhatsApp, make sure your usage complies with the terms, policies, and legal requirements that apply in your environment.
- Dashboard authentication for register, login, and workspace access.
- Workspace bootstrap endpoint for loading the current user, sessions, chats, active chat, and initial messages.
- Multi-session WhatsApp management with session creation, connect, disconnect, and QR pairing.
- WhatsApp Official API / Meta Cloud API device support for teams that prefer the official Meta transport instead of WhatsApp Web QR sessions.
- Contact and chat browsing with search and chat opening from contacts.
- Message APIs for listing, searching, sending, forwarding, and deleting messages.
- Multipart media upload flow with
mediaFileIdsupport for outbound media messages. - Runtime docs endpoints for Swagger UI, OpenAPI JSON, agent README, health checks, and version metadata.
- CRM AI workspace with draft generation, auto-reply, knowledge-base search, automation logs, and safety guards.
- Knowledge-base uploads for Markdown, CSV, TXT, JSON, PDF, DOCX, and XLSX files, with reindex support.
- Telegram customer channel support: non-admin Telegram bot chats can enter the CRM and receive AI replies.
- Debounced CRM auto-replies that combine rapid follow-up customer messages before answering.
- Abuse cooldown and daily reply limits to reduce spam and runaway automation.
- Dual authentication model:
- JWT bearer auth for dashboard users.
- API key auth for agents and external integrations.
- Built-in AI Assistant with extensible tool capabilities.
- Remote control via Telegram bot integration, including BotFather token setup and admin allowlist support.
- Agent-friendly architecture with machine-readable documentation and tool registration.
- Setup a Telegram bot using a BotFather token and connect it to Wanie.
- Restrict bot control to specific Telegram chat IDs with admin allowlist support from Settings → Telegram or the assistant tool
configure_telegram_admins. - Use
/newfrom Telegram to start a fresh assistant chat context. - Monitor the bot status via the assistant tool
get_telegram_bot_status. - Use the same bot as a CRM customer channel: Telegram chat IDs not listed in the admin allowlist are treated as customer conversations and never receive remote assistant tool access.
- Customer Telegram messages are stored as CRM chats and can receive AI draft or auto-reply responses grounded in the CRM knowledge base.
Wanie can run WhatsApp devices through either WhatsApp Web QR pairing or the WhatsApp Official API / Meta Cloud API. Official API devices use the same dashboard inbox, CRM automation, outbound delivery queue, media storage, webhooks, and API endpoints as WhatsApp Web devices.
To add an official API device:
- Open Settings → Devices.
- Choose WhatsApp Official API.
- Enter the Meta Phone Number ID, access token, and webhook verify token.
- Optionally enter the WhatsApp Business Account ID and App Secret.
- In Meta Developer settings, set the callback URL to
https://<your-wanie-host>/api/whatsapp/meta/webhook. - Subscribe the app to WhatsApp message and status webhook events.
Wanie stores the access token and app secret encrypted in runtime storage. Incoming text, media, location, button, and interactive WhatsApp messages are converted into normal Wanie chats. Outbound text and uploaded media can be sent through the same dashboard composer and API routes.
Meta's WhatsApp messaging policies still apply. Free-form outbound replies are intended for the customer service window; template-message sending for conversations outside that window is not implemented yet.
Wanie includes a CRM page for support teams that want AI-assisted replies grounded in uploaded knowledge. The CRM works with regular WhatsApp chats and with Telegram customer chats created through the Telegram bot integration.
- Off — no AI automation for the chat.
- Draft only — generate a suggested reply and save it in CRM activity without sending it automatically.
- Auto send — generate and deliver the reply automatically to WhatsApp or Telegram.
Automation can be configured globally, overridden per WhatsApp session, and overridden per individual chat. Chat-level settings take priority over session settings, and session settings take priority over the global default.
For Telegram bot chats, Off stores non-admin customer messages in the dashboard and replies with a short notice that automation is inactive. Draft only and Auto send route the Telegram conversation through the CRM knowledge-base workflow. Only Telegram chat IDs in the admin allowlist can use the regular Wanie Assistant/AI agent flow.
CRM replies are grounded in uploaded knowledge documents. Supported file types include:
- Markdown (
.md) - CSV
- TXT
- JSON
- DOCX
- XLSX
- Images (
.jpg,.jpeg,.png,.webp,.gif)
CSV files are converted into row/column-labeled text so service data such as Service Name, Base Price, and Duration (min) can be retrieved reliably. Existing documents can be reindexed from the CRM page after parser changes, embedding configuration changes, or updated source files.
Image files can be used as knowledge assets for customer-facing attachments such as QRIS payment images, pricelists, menus, catalogs, and brochures. Use clear filenames such as payment-qris.png, premium-package-pricelist.jpg, or service-menu.webp so retrieval can match the image to the customer's request.
The CRM knowledge page supports multiple file uploads in one action. If an uploaded file has the same original filename as an existing knowledge document, Wanie automatically replaces the old document and rebuilds its chunks from the new file.
- Wanie waits briefly after the latest inbound message before generating a CRM auto-reply, so rapid messages like
hi,how much is it, andcan I order noware answered as one context. - AI generation and outbound delivery are retried a few times for transient provider or network failures.
- If AI generation still fails, Wanie sends the configured CRM fallback message.
- Normal follow-up questions are still answered until the daily per-chat reply limit is reached.
- Abuse protection starts only when a chat sends too many inbound messages in a short window. During abuse cooldown, Wanie skips expensive AI work and sends a short notice to the customer.
CRM activity records generated drafts, auto-sent replies, skipped replies, delivery failures, fallback use, and source snippets used for the answer. This makes it easier to audit why a customer received a specific response.
- Node.js 20+
- Next.js 15
- React 19
- Express
- Prisma
- Socket.IO
whatsapp-web.js
Special thanks to whatsapp-web.js. Wanie builds on top of that excellent open source project for WhatsApp Web integration.
If you find this project useful, please also support and star the whatsapp-web.js project.
Install Wanie globally:
npm i -g @adens/wanieRun Wanie:
wanieWhen Wanie starts, it launches the local frontend and backend runtime and automatically opens your browser to the Wanie frontend dashboard by default.
If you are working on this repository locally instead of using the published CLI package:
npm install
npm run build
npm startWanie also supports running with Docker Compose for a portable local deployment. From the repository root:
docker compose up --buildThis starts the frontend and backend services together with the configured ports.
To run in detached mode:
docker compose up --build -dTo stop and remove the containers:
docker compose downWanie includes a built-in reset helper for administration tasks.
wanie resetWhen you run wanie reset, you can choose:
1)Reset Password — set a new password for an existing user by email.2)Reset All Data — delete all runtime data under the Wanie data directory and recreate runtime folders.
On first startup, Wanie allows registration for the initial admin user. After the first user is created, registration is automatically blocked unless allowRegistration is explicitly enabled again via Settings.
By default, Wanie starts two local services:
- Frontend dashboard:
http://localhost:55111 - Backend API:
http://localhost:55222
Important runtime endpoints such as docs, health, and version are also proxied through the frontend URL for convenience.
Wanie reads .env from the repository root.
For local CLI installs, the only required environment variable is:
WANIE_JWT_SECRET=your_secret_key_hereThe first wanie run will prompt you for this secret and save it into .env if it is missing.
For Docker Compose or server deployment, you can configure additional runtime values in .env:
HOST=0.0.0.0
FE_PORT=55111
BE_PORT=55222
WANIE_DATA_DIR=/app/storage
WANIE_JWT_SECRET=your_secret_key_here
WANIE_AUTO_OPEN=false
WANIE_USE_WWEBJS=true
WANIE_ALLOW_MOCK=false
OUTBOUND_DELIVERY_MAX_ATTEMPTS=5
OUTBOUND_DELIVERY_WORKER_INTERVAL_MS=5000
WEBHOOK_DELIVERY_MAX_ATTEMPTS=3
WEBHOOK_DELIVERY_WORKER_INTERVAL_MS=5000
OUTBOUND_DELIVERY_DELIVERED_RETENTION_DAYS=30
WEBHOOK_DELIVERY_DELIVERED_RETENTION_DAYS=30
WHATSAPP_HEALTH_INTERVAL_MS=30000
WHATSAPP_HEALTH_TIMEOUT_MS=10000
WHATSAPP_RECONNECT_BASE_DELAY_MS=5000
WHATSAPP_RECONNECT_MAX_DELAY_MS=120000
WHATSAPP_META_GRAPH_VERSION=v23.0
DATABASE_URL=file:./storage/database/openwa.dbWhen running in Docker, WANIE_DATA_DIR should point to the mounted storage volume (/app/storage by default). Wanie will automatically derive frontend and backend URLs from HOST, FE_PORT, and BE_PORT.
If WANIE_JWT_SECRET is not set, the first wanie run will prompt you to enter it and save it into .env automatically. For production use, set a strong secret before starting Wanie. Legacy OPENWA_* environment variables are still accepted for existing deployments.
- Set
WANIE_AUTO_OPEN=falseto disable automatic browser opening. - Set
WANIE_USE_WWEBJS=falseto disable the WhatsApp Web adapter. - Set
WANIE_ALLOW_MOCK=trueto allow the mock adapter for testing. - LLM providers are normally configured from Settings → AI Providers.
WANIE_TERMINAL_ALLOWLISTrestricts which terminal commands can auto-execute without manual approval (space-separated patterns).OUTBOUND_DELIVERY_MAX_ATTEMPTScontrols capped retry for WhatsApp and Telegram sends.OUTBOUND_DELIVERY_BACKOFF_MScontrols outbound retry delays as comma-separated milliseconds.WEBHOOK_DELIVERY_MAX_ATTEMPTScontrols capped retry for incoming-message webhook delivery.WEBHOOK_DELIVERY_BACKOFF_MScontrols webhook retry delays as comma-separated milliseconds.OUTBOUND_DELIVERY_DELIVERED_RETENTION_DAYSandWEBHOOK_DELIVERY_DELIVERED_RETENTION_DAYScontrol cleanup of old delivered delivery records.WHATSAPP_HEALTH_INTERVAL_MScontrols active WhatsApp device health checks.WHATSAPP_HEALTH_TIMEOUT_MScontrols how long a WhatsApp health probe may hang before reconnect.WHATSAPP_RECONNECT_BASE_DELAY_MSandWHATSAPP_RECONNECT_MAX_DELAY_MScontrol reconnect backoff.WHATSAPP_META_GRAPH_VERSIONcontrols the Meta Graph API version used for WhatsApp Official API devices.- Terminal commands are only auto-executed if
approvalModeisautoand the command matches an allowlist entry or user settings allow it.
- Start Wanie.
- Open the dashboard at
http://localhost:55111or your deployment host. - Register the first user or log in.
- Create a new WhatsApp session from the dashboard.
- Choose WhatsApp Web QR and pair the QR code, or choose WhatsApp Official API and enter the Meta Cloud API credentials.
- Wait for the workspace to sync chats and contacts or receive new webhook messages.
- Send text or media from the dashboard or the HTTP API.
- Create an API key from Settings → API Access for agents or external integrations.
- Optional: open CRM, upload knowledge documents, test knowledge answers, then enable draft or auto-send mode.
Wanie includes a built-in AI assistant that can manage WhatsApp sessions, LLM configurations, and extend functionality via registered tools. The assistant is accessible via WebSocket for real-time chat in the dashboard and via HTTP API for programmatic access.
The assistant comes with these built-in skills:
add_device— Create and manage new WhatsApp session/device for the workspace.add_llm_provider— Configure LLM providers (OpenAI, Anthropic, Ollama, OpenRouter).update_assistant— Customize the assistant's display name, avatar, and personality.create_api_key— Generate API keys for external integrations.update_webhook— Configure incoming webhook URL and authentication key.setup_gateway_integration— Configure Wanie as an external app gateway from chat: set webhook URL/key, optionally create an API key, and turn internal CRM automation off.update_tools_md— Register and document new external tools.get_webpage— Fetch and parse webpage content (with fallback to browser rendering).open_browser— Launch headless browser for dynamic content extraction.list_workspaces— Enumerate project folders in the workspaces directory.run_terminal— Execute shell commands with approval control.search_messages— Query WhatsApp message database and attachments.run_code_agent— Invoke the internal coding agent for file and project automation.
You can extend the assistant with custom tools by registering a tool manifest URL:
Via cURL:
curl -X POST 'http://localhost:55111/api/agent/register-tool-url' \
-H 'Authorization: Bearer <DASHBOARD_JWT>' \
-H 'Content-Type: application/json' \
-d '{
"url": "https://example.com/manifest.json",
"apiKey": "<MANIFEST_API_KEY>",
"headerName": "Authorization",
"overwrite": true
}'PowerShell:
Invoke-RestMethod -Method Post -Uri 'http://localhost:55111/api/agent/register-tool-url' `
-Headers @{"Authorization"="Bearer <DASHBOARD_JWT>";"Content-Type"="application/json"} `
-Body '{"url":"https://example.com/manifest.json","apiKey":"<MANIFEST_API_KEY>","overwrite":true}'Once a tool is registered, invoke it with either a user JWT or an API key:
Using API Key:
curl -X POST 'http://localhost:55111/api/agent/invoke-tool/<tool_id>' \
-H 'X-API-Key: <API_KEY>' \
-H 'Content-Type: application/json' \
-d '{
"method": "GET",
"path": "/endpoint"
}'Using JWT:
curl -X POST 'http://localhost:55111/api/agent/invoke-tool/<tool_id>' \
-H 'Authorization: Bearer <USER_JWT>' \
-H 'Content-Type: application/json' \
-d '{
"method": "POST",
"path": "/action",
"body": { "param": "value" }
}'- Dashboard-only registration: Tool registration requires a valid dashboard JWT.
- Invocation control: Each tool has an
invokeEnabledflag determining if non-owner users can call it. - Approval modes: Terminal execution supports
auto(trusted allowlist) andmanual(requires approval). - Terminal allowlist: Set
WANIE_TERMINAL_ALLOWLISTenvironment variable to restrict auto-executable commands. - Audit logging: All tool invocations are logged for accountability.
Configure assistant behavior via environment variables:
# Terminal command allowlist for auto-execution (space-separated patterns)
WANIE_TERMINAL_ALLOWLIST="npm run build npm test node --version"
# LLM provider settings
OPENAI_API_KEY=sk-...Wanie exposes comprehensive runtime documentation for both users and AI agents:
- Swagger UI:
GET /docs— Interactive API explorer with try-it-out functionality. - OpenAPI JSON:
GET /docs/json— Machine-readable API schema for code generation and integrations. - Agent guide markdown:
GET /docs/readme— Markdown documentation for AI agents and automation tools. - Health check:
GET /health— Service availability status. - Version:
GET /version— Runtime version and component info. - Backend health alias:
GET /api/health— Direct backend health endpoint.
This architecture is designed for AI agents and automation platforms:
- An agent reads
/docs/readmeto understand available operations. - The agent fetches
/docs/jsonto understand request/response schemas. - The agent creates an API key from the dashboard (or requests one programmatically).
- The agent authenticates with the API key header and immediately starts interacting with chats, contacts, sessions, and messages.
- The agent can discover and register additional external tools via the
/api/agent/register-tool-urlendpoint.
This makes Wanie a strong fit for AI agents: full API documentation, extensible tool registration, and secure authentication without reverse-engineering the app.
POST /api/auth/registerPOST /api/auth/loginGET /api/auth/me
These endpoints are intended for dashboard users. External agents that already have an API key normally do not need to use dashboard login flows.
GET /api/api-keysPOST /api/api-keysDELETE /api/api-keys/{apiKeyId}
API key management requires dashboard JWT authentication.
GET /api/bootstrap
Returns the initial workspace payload, including the current user, sessions, chats, active chat, initial message batch, and pagination metadata.
GET /api/sessionsPOST /api/sessionsPOST /api/sessions/{sessionId}/connectPOST /api/sessions/{sessionId}/disconnect
GET /api/chatsGET /api/contactsPOST /api/contacts/{contactId}/open
/api/chats and /api/contacts support sessionId and q query filters.
GET /api/chats/{chatId}/messagesPOST /api/chats/{chatId}/messages/sendPOST /api/messages/sendGET /api/outbound-deliveriesPOST /api/outbound-deliveries/{deliveryId}/retryPOST /api/outbound-deliveries/{deliveryId}/cancelDELETE /api/messages/{messageId}POST /api/messages/{messageId}/forward
Note:
sessionIdis required when sending a new WhatsApp message byphoneNumber. Replies to an existing chat can use/api/chats/{chatId}/messages/send; Wanie uses the chat transport, including Telegram chats whose receiver starts withtg:.
Outbound sends are queued durably and retried with backoff when WhatsApp or Telegram delivery fails. Wanie stops after 5 attempts by default and marks the delivery job as failed; use the retry endpoint to reset and try again manually.
GET /api/chats/{chatId}/messages supports:
takebeforesearch
POST /api/media
Upload a file first, then use the returned mediaFileId when calling the send message endpoint.
GET /api/crm/settingsPOST /api/crm/settingsPOST /api/crm/persona/generatePOST /api/crm/sessions/{sessionId}/settingsPOST /api/crm/chats/{chatId}/settingsPOST /api/crm/chats/{chatId}/draftGET /api/crm/logs
CRM settings include automation mode, assistant name, business name, persona, fallback message, knowledge retrieval settings, abuse cooldown, and daily reply limits.
When an admin replies to a customer from the Wanie dashboard, the API, or the paired WhatsApp app, CRM auto-reply pauses for that chat temporarily. The default pause is 30 minutes and can be changed with adminPauseSeconds in CRM settings.
WhatsApp group chats are not auto-replied by default, even when the global or session mode is Auto send. Set the specific group chat override to Auto send to enable auto-reply for that group.
To use Wanie as a gateway/API only, set internal CRM automation mode to Off, configure an incoming webhook, and let the external app reply through /api/chats/{chatId}/messages/send or /api/messages/send.
GET /api/knowledge/documentsPOST /api/knowledge/documentsaccepts onefilefield or multiplefilesfields. Matching original filenames replace existing documents automatically.GET /api/knowledge/documents/{documentId}/downloadDELETE /api/knowledge/documents/{documentId}POST /api/knowledge/documents/{documentId}/reindexGET /api/knowledge/documents/{documentId}/chunksPOST /api/knowledge/searchPOST /api/knowledge/test-chat
Use reindex when source parsing or embedding settings change. Reindexing extracts the stored file again and rebuilds chunks.
Wanie supports two main authentication modes.
Authorization: Bearer <jwt-token>Used by the dashboard after login or registration.
X-API-Key: <api-key>or:
Authorization: Bearer <api-key>Recommended for agents, automation, and external integrations.
Wanie can forward incoming customer messages to an external application such as a CRM, ERP, helpdesk, or AI service with its own knowledge base.
Configure the webhook from Settings -> Webhooks or with:
GET /api/webhook— read the current webhook.POST /api/webhook— set{ "url": "https://example.com/wanie-webhook", "apiKey": "shared-secret" }.DELETE /api/webhook— remove the webhook.POST /api/webhook/test— send a syntheticwebhook.testpayload to the configured URL.GET /api/webhook/deliveries— list recent webhook delivery attempts.POST /api/webhook/deliveries/{deliveryId}/retry— replay a stored webhook payload.
When a WhatsApp or non-admin Telegram customer message arrives, Wanie sends:
POST <your-webhook-url>
Content-Type: application/json
x-wanie-webhook-key: <apiKey configured in Wanie>
x-openwa-webhook-key: <same apiKey, sent for backward compatibility>Payload shape:
{
"chat": {
"id": "chat_id_from_wanie",
"title": "Customer Name",
"sessionId": "whatsapp_session_id_or_null_for_telegram",
"contact": {
"externalId": "6281234567890@c.us or tg:123456789"
}
},
"message": {
"id": "message_id_from_wanie",
"chatId": "chat_id_from_wanie",
"sessionId": "whatsapp_session_id_or_null_for_telegram",
"sender": "6281234567890@c.us or tg:123456789",
"receiver": "your_whatsapp_or_telegram_target",
"body": "Customer message text",
"type": "text",
"direction": "inbound",
"mediaFile": null,
"statuses": []
}
}The external app should verify x-wanie-webhook-key or the legacy x-openwa-webhook-key, store chat.id, and reply through the API.
Webhook deliveries are logged per user. Wanie retries transient delivery failures automatically, emits realtime dashboard updates, and failed deliveries can be replayed with the retry endpoint.
Minimal Express receiver:
app.post("/wanie-webhook", express.json(), async (req, res) => {
const key = req.get("x-wanie-webhook-key") || req.get("x-openwa-webhook-key");
if (key !== process.env.WANIE_WEBHOOK_KEY) {
return res.status(401).json({ ok: false });
}
const { chat, message } = req.body;
console.log("Incoming Wanie message", {
chatId: chat.id,
from: message.sender,
text: message.body,
});
res.json({ ok: true });
});Reply to the same chat:
curl -X POST http://localhost:55111/api/chats/<chatId>/messages/send \
-H "Content-Type: application/json" \
-H "X-API-Key: <api-key>" \
-d '{"body":"Reply from external CRM","type":"text"}'Send media to the same chat with a public URL:
curl -X POST http://localhost:55111/api/chats/<chatId>/messages/send \
-H "Content-Type: application/json" \
-H "X-API-Key: <api-key>" \
-d '{"type":"image","mediaUrl":"https://example.com/photo.jpg","body":"Photo caption"}'Or upload media first:
curl -X POST http://localhost:55111/api/media \
-H "X-API-Key: <api-key>" \
-F "file=@./invoice.pdf"Then send:
curl -X POST http://localhost:55111/api/chats/<chatId>/messages/send \
-H "Content-Type: application/json" \
-H "X-API-Key: <api-key>" \
-d '{"type":"document","mediaFileId":"<mediaFileId>","body":"Invoice"}'For API-only gateway mode, set internal CRM automation to Off. Wanie will still store incoming messages, deliver webhooks, and allow the external app to reply through API endpoints. Non-admin Telegram users do not receive assistant tool access.
POST /api/agent/register-tool-url— Register a new tool from a manifest URL (dashboard JWT required).GET /api/agent/tools— List all registered tools.POST /api/agent/invoke-tool/{toolId}— Invoke a registered tool with method, path, and optional body.
POST /api/chat/{chatId}/messages— Send a message to an assistant conversation.GET /api/agent/docs/readme— Fetch agent-friendly documentation.GET /api/agent/docs/json— Fetch OpenAPI specification in JSON format.
These endpoints support both JWT and API key authentication.
List chats:
curl -H "X-API-Key: <api-key>" http://localhost:55111/api/chatsRead messages for a chat:
curl -H "X-API-Key: <api-key>" http://localhost:55111/api/chats/<chatId>/messagesSend a text message to an existing chat:
curl -X POST http://localhost:55111/api/chats/<chatId>/messages/send \
-H "Content-Type: application/json" \
-H "X-API-Key: <api-key>" \
-d '{"body":"Hello from Wanie","type":"text"}'Use this same endpoint to reply to a Telegram customer chat received from a webhook.
For WhatsApp Official API chats, use the same endpoint. Wanie resolves the chat transport and sends through Meta Cloud API automatically.
For media replies, either upload first with /api/media and pass mediaFileId, or pass a public mediaUrl with type image, video, audio, document, or sticker.
Send a direct message by phone number:
curl -X POST http://localhost:55111/api/messages/send \
-H "Content-Type: application/json" \
-H "X-API-Key: <api-key>" \
-d '{"sessionId":"<sessionId>","phoneNumber":"+6281234567890","body":"Hello from Wanie","type":"text"}'Upload media:
curl -X POST http://localhost:55111/api/media \
-H "X-API-Key: <api-key>" \
-F "file=@./example.png"Search messages:
curl -H "X-API-Key: <api-key>" \
"http://localhost:55111/api/search-messages?q=invoice&chatId=12345@c.us&limit=20"Fetch agent readme:
curl -H "X-API-Key: <api-key>" http://localhost:55111/api/agent/docs/readmeFetch OpenAPI specification:
curl -H "X-API-Key: <api-key>" http://localhost:55111/api/agent/docs/jsonList all registered tools:
curl -H "X-API-Key: <api-key>" http://localhost:55111/api/agent/toolsInvoke a registered external tool:
curl -X POST http://localhost:55111/api/agent/invoke-tool/weather-api \
-H "X-API-Key: <api-key>" \
-H "Content-Type: application/json" \
-d '{"method":"GET","path":"/forecast?city=London"}'bin/- CLI entrypointserver/- backend runtime, OpenAPI docs, auth, sessions, chats, media, and socketsserver/express/- Express middleware and route handlersserver/services/- Business logic including agent orchestration, tool execution, and assistant managementserver/ai/llm-adapters/- LLM provider adapters (OpenAI, Anthropic, etc.)
web/- Next.js dashboard UIprisma/- Database schema and migrationsstorage/- Runtime storage, sessions, media files, and database
server/services/agent-orchestrator.js- Orchestrates agent workflow and tool execution.server/services/agent-service.js- Handles assistant chat messages and tool invocation.server/services/crm-auto-reply-service.js- Generates CRM drafts, runs guarded auto-replies, and delivers CRM messages to WhatsApp or Telegram.server/services/crm-service.js- Stores CRM automation settings, per-chat/session overrides, and automation logs.server/services/knowledge-service.js- Extracts, chunks, indexes, searches, and reindexes CRM knowledge documents.server/services/whatsapp-meta-service.js- Handles WhatsApp Official API / Meta Cloud API config, webhook verification, inbound messages, media download, and outbound sends.server/services/tool-executor.js- Executes assistant tools and external integrations.server/services/llm-service.js- LLM provider abstraction and model selection.server/services/assistant-service.js- Manages assistant profiles and configurations.
For repository-based local development:
- Install dependencies with
npm install. - Configure
.envif you need non-default ports or runtime behavior. - Run
npm run devfor development mode. - Run
npm run buildbefore shipping production changes.
If you are working on API-facing features, validate them against:
server/express/openapi.js/docs/docs/json/docs/readme
Contributions are welcome.
If you want to contribute:
- Fork the repository.
- Create a feature branch.
- Make focused changes.
- Test your changes locally.
- Open a pull request with a clear description of what changed and why.
Good contribution areas include:
- WhatsApp session reliability
- Dashboard UX
- API ergonomics
- Documentation improvements
- Tests and validation
- Developer experience
If you find a bug or want to request a feature, please open an issue with:
- what you expected
- what happened
- steps to reproduce
- logs or screenshots if relevant
- environment details such as Node.js version and runtime mode
Please do not use this project for spam, abuse, or policy-violating automation.
If you discover a security issue, report it responsibly and avoid posting sensitive details publicly before maintainers have a chance to assess it.
This project is released under the MIT license. See package.json for the current license declaration.
Recommended call order:
GET /healthGET /versionGET /docs/jsonGET /api/chatsorGET /api/contactsPOST /api/contacts/{contactId}/openGET /api/chats/{chatId}/messagesPOST /api/chats/{chatId}/messages/send

