mirror of
https://github.com/vercel/chat.git
synced 2026-09-14 18:32:29 +08:00
2a2b2c5500
Adds a first-party Instagram Direct Messages adapter backed by Meta's
Instagram API with Instagram Login.
- Verifies webhook challenges and HMAC signatures, then normalizes DMs,
story replies, media, quick replies, postbacks, and reactions.
- Sends plain text, cards, quick replies, typing indicators, URL
attachments, and uploaded media through `graph.instagram.com`.
- Maps authentication, rate-limit, and 24-hour messaging-window failures
to typed adapter errors.
- Registers Instagram in the adapter catalog, CLI scaffold, official
docs, replay suite, and Next.js example.
## Usage
```ts
import { createInstagramAdapter } from "@chat-adapter/instagram";
import { Chat } from "chat";
const bot = new Chat({
userName: "mystore",
adapters: { instagram: createInstagramAdapter() },
});
```
## Webhook
```ts
export async function POST(request: Request) {
return bot.webhooks.instagram(request);
}
```
## Verification
- `pnpm --filter @chat-adapter/instagram test`
- `pnpm --filter @chat-adapter/instagram typecheck`
- `pnpm --filter example-nextjs-chat typecheck`
- `pnpm --filter example-nextjs-chat build`
- `pnpm check`
- `pnpm konsistent`
## Live Testing
<table>
<tr>
<td><img width="1440" height="2109" alt="1000000502"
src="https://github.com/user-attachments/assets/9fdb8c3b-4e41-4c81-9426-08756a5e4201"
/></td>
<td><img width="1440" height="1995" alt="1000000503"
src="https://github.com/user-attachments/assets/8a572493-c57a-4412-9049-5737aaa9dfd0"
/></td>
</tr>
</table>
Closes #729 / Co-Authored by @ivandujaut
---------
Co-authored-by: Ben Sabic <bensabic@users.noreply.github.com>
38 lines
1.1 KiB
JSON
38 lines
1.1 KiB
JSON
{
|
|
"name": "@chat-adapter/integration-tests",
|
|
"version": "4.0.0",
|
|
"private": true,
|
|
"description": "Integration tests for chat",
|
|
"type": "module",
|
|
"scripts": {
|
|
"test": "vitest run --coverage",
|
|
"test:watch": "vitest",
|
|
"typecheck": "tsc --noEmit"
|
|
},
|
|
"devDependencies": {
|
|
"@changesets/config": "^3.1.2",
|
|
"@emulators/core": "^0.6.0",
|
|
"@emulators/github": "^0.6.0",
|
|
"@emulators/slack": "^0.6.0",
|
|
"@hono/node-server": "^2.0.10",
|
|
"@manypkg/get-packages": "^1.1.3",
|
|
"@types/node": "^25.3.2",
|
|
"typescript": "^5.7.2",
|
|
"vitest": "^4.0.18"
|
|
},
|
|
"dependencies": {
|
|
"@chat-adapter/discord": "workspace:*",
|
|
"@chat-adapter/gchat": "workspace:*",
|
|
"@chat-adapter/github": "workspace:*",
|
|
"@chat-adapter/instagram": "workspace:*",
|
|
"@chat-adapter/messenger": "workspace:*",
|
|
"@chat-adapter/slack": "workspace:*",
|
|
"@chat-adapter/state-memory": "workspace:*",
|
|
"@chat-adapter/teams": "workspace:*",
|
|
"@chat-adapter/telegram": "workspace:*",
|
|
"@chat-adapter/whatsapp": "workspace:*",
|
|
"chat": "workspace:*",
|
|
"discord-api-types": "^0.37.119"
|
|
}
|
|
}
|