Zernio
Reach Instagram, Facebook, Twitter/X, Telegram, WhatsApp, Bluesky, and Reddit through Zernio with one adapter, without managing each platform's developer program, app review, or token rotation.
Create a new bot
Scaffold a Next.js bot with the Zernio adapter using create-chat-sdk:
pnpm create chat-sdk@latest my-bot --adapter zernio memory -yThe generated app uses the Memory state adapter for local development. To add the adapter to an existing app, start at Install.
Install
pnpm add @zernio/chat-sdk-adapter chat @chat-adapter/state-memoryFor production, swap @chat-adapter/state-memory for a persistent state adapter such as @chat-adapter/state-redis or @chat-adapter/state-pg. See State adapters for all options.
Quick start
Platform setup
Even with native Chat SDK adapters for each platform, shipping a multi-platform bot still means applying to Meta's developer program, going through App Review, getting WhatsApp Business verification, applying for X elevated access, and managing token rotation across all of them. With Zernio, users connect their own accounts in the Zernio dashboard and you use one API key.
Get a Zernio API key
Sign up at zernio.com and create an API key from the dashboard with read-write permissions.
Connect social accounts
Use the Zernio dashboard or API to connect the platform accounts you want the bot to handle.
Configure a webhook
Point a webhook at your bot's webhook endpoint:
- URL:
https://your-app.com/api/chat-webhook - Events:
message.receivedandcomment.received - Secret: a strong shared secret, passed as
ZERNIO_WEBHOOK_SECRET
Enable the inbox addon
Enable the inbox addon on your Zernio account to receive message webhooks.
Configuration
Pass options to createZernioAdapter(), or omit them to read from environment variables:
Environment variables
| Variable | Required | Description |
|---|---|---|
ZERNIO_API_KEY | Yes | Zernio API key for sending messages |
ZERNIO_WEBHOOK_SECRET | Recommended | HMAC-SHA256 secret for verifying inbound webhooks |
ZERNIO_API_BASE_URL | No | Override the API base URL (default: https://zernio.com/api) |
ZERNIO_BOT_NAME | No | Bot display name (default: "Zernio Bot") |
Webhooks
The quick start's route receives Zernio webhooks. Messages flow through the adapter like this:
Webhook verification
The adapter automatically verifies webhook signatures when webhookSecret is configured. You can also call the verifier directly:
Platform support matrix
The feature support table summarizes the adapter as a whole. This table shows which features each network supports through Zernio (FB is Facebook, IG is Instagram):
| Feature | FB | IG | Telegram | X | Bluesky | ||
|---|---|---|---|---|---|---|---|
| Send text | Y | Y | Y | Y | Y | Y | Y |
| Buttons | Y | Y | Y | Y | – | – | – |
| Lists | – | – | – | Y | – | – | – |
| Location / Contacts | – | – | – | Y | – | – | – |
| Templates / Flows | – | – | – | Y | – | – | – |
| Typing | Y | Y | Y | Y | – | – | – |
| Delete | – | – | Y | – | Y | Self | Self |
| Reactions | Y | Y | Y | Y | – | – | – |
| Media | Y | Y | Y | Y | Y | – | – |
| Edit | – | – | Y | – | – | – | – |
WhatsApp typing indicators need a recent inbound message in the conversation. On Instagram, the indicator only shows while the recipient is signed in.
Rich messages
The adapter maps Chat SDK Card elements to native platform formats:
The card renders as an interactive card on Facebook, Instagram, Telegram, and WhatsApp, and falls back to plain text on X, Bluesky, and Reddit.
A card Select or RadioSelect maps to a WhatsApp interactive list. A list can't coexist with reply buttons, so the list takes precedence:
WhatsApp rich messages
Send WhatsApp-only message types that don't map to a Chat SDK card through the exported ZernioApiClient, alongside the adapter. Decode the thread ID to get the accountId and conversationId:
sendInteractive accepts the full WhatsApp interactive union: button, list, cta_url, flow, location_request_message, and voice_call. Pass { replyTo } as the fourth argument to quote a message.
Inbound interactive replies
When a user taps a reply button, selects a list row, or submits a WhatsApp Flow, the reply arrives as a normal onNewMessage event with its interactive context on message.raw.metadata:
Opening conversations
To start a chat with someone who hasn't messaged you yet, use the standard Chat SDK openDM(userId) method. Because one Zernio account is one channel, namespace the recipient as "{accountId}:{recipient}", using a phone number in E.164 format for WhatsApp. openDM only resolves the thread and makes no network call; the first post() opens the thread:
WhatsApp's 24-hour-window rule means you must open with an approved template. openConversation sends it and returns the thread ID in one step:
AI streaming
Stream AI responses using the post-and-edit pattern. thread.post() accepts an AsyncIterable<string>, so you can pass the textStream from streamText directly:
Platform-specific data
Reach platform-specific fields through message.raw:
API client
The adapter includes a standalone REST client for direct Zernio API calls:
It also exposes the WhatsApp rich sends shown above (sendInteractive, sendLocation, sendContacts, sendTemplate, reply).
Error handling
The adapter maps Zernio API errors to standard Chat SDK error classes:
| HTTP status | Error class | Description |
|---|---|---|
| 401 | AuthenticationError | Invalid or expired API key |
| 403 | PermissionError | Read-only key, missing addon, etc. |
| 404 | ResourceNotFoundError | Conversation or message not found |
| 429 | AdapterRateLimitError | Rate limit hit (includes retryAfter) |
| 5xx | NetworkError | Server error |
Thread IDs
Thread IDs follow the format zernio:{accountId}:{conversationId}:
accountId: the Zernio social account ID, which identifies the platform account that received the messageconversationId: the Zernio conversation ID for the specific DM thread- For comments:
zernio:{accountId}:comment:{postId}
Feature support
Messaging
| Feature | Supported |
|---|---|
| Post message | |
| Message replies | |
| Edit message | Telegram |
| Delete message | Telegram, X |
| File uploads | Not Bluesky or Reddit |
| Streaming | post+edit (Telegram) |
| Scheduled messages |
Rich content
| Feature | Supported |
|---|---|
| Card format | FB, IG, Telegram, WhatsApp |
| Buttons | FB, IG, Telegram, WhatsApp |
| Link buttons | FB, IG, Telegram, WhatsApp |
| Select menus | WhatsApp (interactive list) |
| Tables | |
| Charts | |
| Fields | |
| Images in cards | FB, IG, Telegram, WhatsApp |
| Modals |
Conversations
| Feature | Supported |
|---|---|
| Slash commands | |
| Mentions | |
| Add reactions | FB, IG, Telegram, WhatsApp |
| Remove reactions | FB, IG, Telegram, WhatsApp |
| Typing indicator | FB, IG, Telegram, WhatsApp |
| Mark as read | |
| Message edit events | |
| Message delete events | |
| DMs | |
| Ephemeral messages | |
| User lookup | |
| Parent subject | |
| Native client | |
| Custom API endpoint | baseUrl |
Message history
| Feature | Supported |
|---|---|
| Fetch messages | |
| Fetch single message | |
| Fetch thread info | |
| Fetch channel messages | |
| List threads | |
| Fetch channel info | |
| Post channel message |