@chat-adapter/instagram

中文文档
4.44.0发布于 2026/11/02MITTypeScriptES Module构建来源已验证近 30 天下载 4.5万

Instagram Direct Messages adapter for Chat SDK — native Meta Messaging API webhooks, media, and quick replies

原始使用文档
文档目录8 节
  1. Installation
  2. Scaffold with the CLI
  3. Configure
  4. Use
  5. Features
  6. Messaging window
  7. AI Coding Agents
  8. License

Instagram Direct Messages adapter for Chat SDK

@chat-adapter/instagram

npm package: @chat-adapter/instagram

Agent Stack MIT License

Native Instagram Direct Messages adapter for Chat SDK. It uses Meta's Instagram API with Instagram Login and does not require an aggregator.

Documentation: chat-sdk.dev/adapters/official/instagram · Guides: vercel.com/kb/chat-sdk

Building for Facebook Messenger? Use @chat-adapter/messenger instead. It connects through the Messenger Platform API and uses a Facebook Page access token.

Installation

pnpm add @chat-adapter/instagram

Scaffold with the CLI

npx create-chat-sdk@latest my-bot --adapter instagram memory

Visit the adapters directory to see other available official and vendor-official adapters.

Configure

INSTAGRAM_ACCESS_TOKEN=
INSTAGRAM_APP_SECRET=
INSTAGRAM_VERIFY_TOKEN=
INSTAGRAM_ACCOUNT_ID=
# Optional; defaults to v26.0
INSTAGRAM_API_VERSION=

The Instagram account must be a professional Business or Creator account. The Meta app needs instagram_business_basic and instagram_business_manage_messages; production apps serving accounts they do not own require Advanced Access.

Subscribe the Instagram webhook object to messages, messaging_postbacks, messaging_reactions, messaging_seen, messaging_referrals, and messaging_optins.

Use

import { createInstagramAdapter } from "@chat-adapter/instagram";
import { Chat } from "chat";

const bot = new Chat({
  userName: "mystore",
  adapters: {
    instagram: createInstagramAdapter(),
  },
});

bot.onDirectMessage(async (thread, message) => {
  await thread.post(`Thanks for reaching out! You said: ${message.text}`);
});

export const POST = bot.webhooks.instagram;
export const GET = bot.webhooks.instagram;

Thread IDs use instagram:{accountId}:{igsid} so conversations stay scoped to the professional account that received them.

Features

  • Receive and send text DMs
  • Receive story replies, story mentions, shares, media, and reactions
  • Send image, video, audio, and PDF attachments by public HTTPS URL or upload
  • Cards using Instagram templates or quick replies
  • Typing indicators
  • Buffered streaming
  • Signed webhooks and subscription verification

Instagram does not support message editing, message deletion, group chats, or modals through this API.

Messaging window

Free-form replies must be sent within 24 hours of the customer's latest message. Window failures are surfaced as a typed ValidationError.

For a real human support agent with the required Meta permission, the adapter exposes:

await instagram.sendHumanAgentMessage(threadId, "A human follow-up");

HUMAN_AGENT extends the window to seven days and is audited by Meta. It must not be used for automated messages.

AI Coding Agents

If you use an AI coding agent such as OpenAI Codex, Claude Code, or Cursor, install the Chat SDK skill before writing code:

npx skills add vercel/chat

The skill references the bundled documentation in node_modules/chat/docs. You can also install the optional Vercel Plugin:

npx plugins add vercel/vercel-plugin

For agent-readable documentation, see chat-sdk.dev/llms.txt or chat-sdk.dev/llms-full.txt.

License

MIT

版本与发布记录

@chat-adapter/instagram 共发布 11 个版本,首次发布于 2026/08/05;过去 12 个月发布了 11 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
4.44.0latest2026/11/026 天前
4.43.02026/10/1921 天前
4.42.02026/10/1425 天前
4.41.12026/09/291 个月前
4.41.02026/09/181 个月前
4.40.02026/09/052 个月前

关于 @chat-adapter/instagram 的常见问题

@chat-adapter/instagram 是什么?

Instagram Direct Messages adapter for Chat SDK — native Meta Messaging API webhooks, media, and quick replies

如何安装 @chat-adapter/instagram?

在项目目录运行 npm install @chat-adapter/instagram,或使用 pnpm add / yarn add / bun add。

@chat-adapter/instagram 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@chat-adapter/instagram 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@chat-adapter/instagram 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=20。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@chat-adapter/instagram 可以商用吗?

@chat-adapter/instagram 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@chat-adapter/instagram 的下载量有多少?

根据 npm 官方下载统计,@chat-adapter/instagram 在 2026/10/10 – 2026/11/08 这 30 天内被下载 44,760 次,日均约 1,492 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@chat-adapter/instagram 还在维护吗?

最新版本 4.44.0 发布于 2026/11/02(6 天前);至今共发布 11 个版本,其中过去 12 个月发布了 11 个;首次发布于 2026/08/05。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。