Adeli for Chat SDK: Instagram, WhatsApp and TikTok Bots
The short answer
Chat SDK lets you write a bot once and run it on Slack, Teams, Discord and other chat platforms through adapters. Today we're releasing @adeli/chat-sdk-adapter, which adds Instagram, Facebook and WhatsApp DMs, and Instagram and TikTok comments, to that list. The bot uses one Adeli API key, and your users connect their own accounts in the Adeli dashboard. You don't need a Meta app, App Review, or TikTok developer access.
What's new
- A new DM on Instagram, Facebook or WhatsApp reaches
onNewMention, and follow-ups in a subscribed thread reachonSubscribedMessage. - A new top-level comment on an Instagram post or TikTok video counts as a mention too, and
thread.post()replies under it. - On Instagram DMs, a card's
<Button>and<LinkButton>become native buttons, up to three per message, and a tap arrives asonAction. apiKeyandwebhookSecretaccept a function, which the adapter calls on every request and every webhook, so you can rotate keys without a restart.
To support it, Adeli's public API gained a message.created webhook for inbound Instagram, Facebook and WhatsApp DMs, conversation-scoped message history, and WhatsApp free-text sends. They're documented in the webhooks reference and List messages, so you can use them without Chat SDK too.
How to use it
Install the adapter and Chat SDK:
npm install chat @adeli/chat-sdk-adapter @chat-adapter/state-memoryCreate the bot:
import { Chat } from "chat";
import { createMemoryState } from "@chat-adapter/state-memory";
import { createAdeliAdapter } from "@adeli/chat-sdk-adapter";
export const bot = new Chat({
userName: "shopbot",
adapters: {
adeli: createAdeliAdapter({
apiKey: process.env.ADELI_API_KEY!,
webhookSecret: process.env.ADELI_WEBHOOK_SECRET!,
}),
},
state: createMemoryState(),
});
bot.onNewMention(async (thread, message) => {
await thread.subscribe();
await thread.post(`Thanks for reaching out! You said: ${message.text}`);
});Then serve bot.webhooks.adeli from a route such as /api/webhooks/adeli, and register that URL as an Adeli webhook for message.created, message.postback and comment.created. The Chat SDK adapter docs cover the webhook, the Next.js route, the thread model and the full feature table.
What to know first
- Instagram, Facebook and WhatsApp accept free-text messages only within 24 hours of the person's last message. Outside that window, a post throws
AdapterErrorwith codewindow_closed. To open a WhatsApp conversation, send an approved template with@adeli/sdk. - None of these platforms lets a bot edit a sent DM, so the adapter buffers a streamed reply and posts it once. Reactions aren't supported, and
startTypingdoes nothing. - Every bot reply counts as a message or comment in your Adeli usage. A workspace on the free tier gets a rate-limit error once it has used its monthly sends.
The source is at github.com/kingscrosslabs/adeli-chat-sdk-adapter, under the MIT license.