This project demonstrates how to integrate Chatwoot with messengers (WhatsApp via Wasender, Telegram via Telethon, VK via Callback API) using Python and FastAPI.
- Send and receive messages between Chatwoot and:
- WhatsApp (through Wasender)
- Telegram (through Telethon, non-bot account)
- VK (VK group messages)
- Automatic contact sync and enrichment (custom attributes)
- Architecture ready for AI automation and future extensions
- Python 3.11 or newer
- Poetry for dependency management
- A running instance of Chatwoot
- Wasender account (for WhatsApp integration)
- Telegram account (for Telethon, not a bot)
- VK group and API credentials
Clone the repository and install dependencies:
git clone git@github.com:feel90d/chatwoot-messenger-gateway.git
cd chatwoot-messenger-gateway
poetry installCopy .env_template to .env and fill in your credentials:
cp .env_template .envEdit .env and set the following sections:
-
Chatwoot:
CHATWOOT_API_ACCESS_TOKENCHATWOOT_ACCOUNT_IDCHATWOOT_BASE_URLCHATWOOT_WEBHOOK_ID_WHATSAPPCHATWOOT_WEBHOOK_ID_TELEGRAMCHATWOOT_WEBHOOK_ID_VK
-
Wasender:
WASENDER_API_KEYWASENDER_WEBHOOK_SECRETWASENDER_WEBHOOK_IDWASENDER_INBOX_ID
-
Telegram:
TG_API_IDTG_API_HASHTG_SESSION_NAME(arbitrary name for your Telethon session)TG_INBOX_ID
-
VK:
VK_ACCESS_TOKENVK_GROUP_IDVK_SECRETVK_CONFIRMATIONVK_API_VERSIONVK_CALLBACK_IDVK_INBOX_ID
Note: All sensitive values must be kept secret. Never commit
.envto your public repository.
python ./app/main.pyThe application exposes a FastAPI server with webhooks for all configured channels. You can use ngrok or another tunnel to expose your local server for webhooks.
Example:
ngrok http 8000Update your webhook URLs in Chatwoot, Wasender, and VK to point to your public ngrok address.
- Outgoing: Messages from Chatwoot are sent to WhatsApp, Telegram, or VK via their respective adapters.
- Incoming: Replies from users in messengers are delivered to Chatwoot with all attributes preserved.
- Contacts are matched or created based on messenger IDs (e.g.,
telegram_user_id,telegram_username).
- Format code:
poetry run black . - Lint code:
poetry run lint
- feel90d, Telegram: @feel90d
- lukyan0v_a, Telegram: @lukyan0v_a
If you have any questions, want to discuss integrations, or are interested in a similar solution for your business — feel free to message us on Telegram or by email. This article was written to share practical experience and help the community — we’re always happy to connect and answer your questions!
MIT (or your preferred license)