@zernio/chat-sdk-adapter
Official Zernio adapter for Chat SDK. Build chatbots that work across Instagram, Facebook, Twitter/X, Telegram, WhatsApp, Bluesky, and Reddit through a single integration.
Even with native Chat SDK adapters for each platform, you'd still need to apply to Meta's developer program, go through App Review, get WhatsApp Business verification, apply for X elevated access, and more. With Zernio, your users connect accounts in a dashboard and you get one API key. No developer programs, no app reviews, no token management.
Installation
Quick Start
Next.js Webhook Route
Configuration
Environment Variables
Explicit Configuration
Setup
1. Get a Zernio API Key
Sign up at zernio.com and create an API key from the dashboard. Make sure the key has read-write permissions.
2. Connect Social Accounts
Connect the social accounts you want your bot to handle through the Zernio dashboard or API.
3. Configure a Webhook
Create a webhook in your Zernio dashboard pointing to your bot's webhook endpoint:
- URL:
https://your-app.com/api/chat-webhook - Events: Select
message.receivedandcomment.received - Secret: Set a strong secret and pass it as
ZERNIO_WEBHOOK_SECRET
4. Enable the Inbox Addon
The inbox addon must be enabled on your Zernio account to receive message webhooks.
How It Works
Thread ID Format
Thread IDs follow the format zernio:{accountId}:{conversationId}:
accountId: The Zernio social account ID (which platform account received the message)conversationId: The Zernio conversation ID (the specific DM thread)- For comments:
zernio:{accountId}:comment:{postId}
Supported Features
Platform Support Matrix
Rich Messages
The adapter maps chat-sdk Card elements to native platform formats instead of rendering as fallback text:
AI Streaming
Stream AI responses with the post+edit pattern (works best on Telegram):
Platform-Specific Data
Access the underlying platform through the raw message:
API Client
The adapter exports a standalone API client for direct Zernio API calls:
Webhook Verification
The adapter automatically verifies webhook signatures when webhookSecret is configured. You can also use the verification utility directly:
Error Handling
The adapter maps Zernio API errors to standard chat-sdk error classes:
License
MIT