Add a Generic Webhook / HTTP Adapter for Arbitrary Chat Platforms
メンテナーはふだん 1 日以内に返信
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 35/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 静か
- 技術スタック
- typescript
調査の方向性
提案されている Chat 設定と createGenericAdapter エントリポイントから始め、SDK が現在、受信イベントをどのように表現し、レスポンスをどのように送信しているかを確認します。アダプターの範囲を、Webhook ペイロードのマッピング、任意の検証とフィルタリング、開発者が提供する送信 HTTP の動作を中心に定義します。完了とは、文書化された汎用アダプターが、プラットフォーム固有のパースなしに、HTTP に対応する任意のプラットフォームをサポートできる状態を意味します。
索引モデルが issue の本文から書いたものです。
説明
Problem Statement
Many popular or emerging messaging channels do not yet have dedicated adapters in the SDK. Like -
- WhatsApp (via open-source HTTP bridges such as WAHA or Beeper)
- Meta Ray-Ban smart glasses (which surface conversations through Meta/WhatsApp channels)
- Telegram (via its webhook-capable Bot API)
- Matrix / Element
- Various self-hosted, enterprise, or niche messengers
- Any future or custom platform that supports inbound HTTP webhooks and can receive responses via HTTP POST
Without a generic mechanism, supporting these platforms requires either waiting for official adapter packages or forking/maintaining custom platform-specific integrations — which undermines the "write once, run anywhere" value proposition of the SDK.
Proposed Solution
Introduce a built-in generic webhook / HTTP adapter (or a lightweight "raw HTTP" adapter) in the core Chat SDK or as a first-party package (e.g., @chat-adapter/webhook or @chat-adapter/generic).
This adapter would allow developers to connect the same bot logic to any HTTP-capable platform by defining:
- How incoming HTTP payloads are parsed and mapped to Chat SDK events (e.g., extracting message text, sender ID, channel/thread info)
- How outgoing Chat SDK responses are transformed and sent back (e.g., via HTTP POST, specific JSON shape, headers, etc.)
Alternatives Considered
No response
Use Case
import { Chat } from "chat";
import { createGenericAdapter } from "@chat-adapter/generic"; // or built-in
const bot = new Chat({
userName: "mybot",
adapters: {
custom: createGenericAdapter({
// Core webhook handling
path: "/webhook/my-platform", // Vercel / server route
verification: {
secret: process.env.WEBHOOK_SECRET, // optional HMAC / token check
},
// Required mappings (examples)
incoming: {
getText: (payload) => payload?.message?.text || payload?.body,
getSenderId: (payload) => payload?.from?.id || payload?.sender,
getChannelId: (payload) => payload?.thread?.id || payload?.chatId,
// Optional: getMessageId, isFromBot, etc.
},
outgoing: async (channelId, content, options) => {
// Developer provides the send logic (fetch/axios/etc.)
await fetch("https://api.platform.com/messages", {
method: "POST",
headers: { Authorization: `Bearer ${process.env.PLATFORM_TOKEN}` },
body: JSON.stringify({
chat_id: channelId,
text: content.text,
// ... platform-specific fields
}),
});
},
// Optional extras
platformName: "WhatsApp", // for logs/metrics
shouldHandle: (req) => req.headers["user-agent"]?.includes("WhatsApp"), // filter
}),
},
// ... other config (state, model, etc.)
});
Priority
Nice to have
Contribution
- I am willing to help implement this feature
Additional Context
No response
- 主要言語
- TypeScript
- スター
- 2.5k
- フォーク
- 355
- 平均マージ
- 2日 15時間
- マージ済み PR(30日)
- 42
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
vercel/chat のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
X and Twitch: paragraphs inside a block quote are joined with no space対応中かも @abhiramshaji-cyber が 5 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 58/100
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
似ている issue
-
type: bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
db-ux-design-system/core-web#8856 ·
メンテナーはふだん 1 日以内に返信
-
'!' breaking change is lost when the commit also has an empty BREAKING CHANGE footer対応中かも @wittdennis が今日担当しました。 オープンpriority: p3 type: bug
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
googleapis/release-please#2971 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1〜3時間 初心者へのやさしさ 87/100
メンテナーはふだん 1 日以内に返信
-
🛠️ dette technique
難易度 2/5 1〜3時間 初心者へのやさしさ 61/100
betagouv/mon-entreprise#4752 · コメント 1 件 ·
メンテナーはふだん 5 日以内に返信