Adeli for Chat SDK: Instagram, WhatsApp and TikTok Bots

By Nick ReyesPublished 2 min read

The short answer

@adeli/chat-sdk-adapter is an Adeli adapter for Vercel's Chat SDK. One bot, with one Adeli API key, answers Instagram, Facebook and WhatsApp DMs, shows up to three tappable buttons on Instagram DMs, and replies to Instagram and TikTok comments. Your users connect their accounts in Adeli, so the bot needs no Meta app, App Review or TikTok developer access.

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 reach onSubscribedMessage.
  • 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 as onAction.
  • apiKey and webhookSecret accept 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-memory

Create 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 AdapterError with code window_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 startTyping does 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.

Frequently asked questions

Which platforms does the Adeli Chat SDK adapter support?

Instagram, Facebook and WhatsApp direct messages, and comments on Instagram posts and TikTok videos. Cards with buttons render as native buttons on Instagram DMs, up to three per message, and as plain text everywhere else.

Can the bot message someone on WhatsApp at any time?

No. Meta allows free-text replies only within 24 hours of the person's last message. Outside that window the adapter throws a window_closed error, and you open the conversation with an approved template through @adeli/sdk.

Power your next project
with one ads & social media API

Give your users publishing, scheduling, and analytics through one integration your team can actually maintain.

Try with agents

Start with free credits. No credit card required.