Add a Generic Webhook / HTTP Adapter for Arbitrary Chat Platforms
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Ít trao đổi
- Công nghệ
- typescript
Hướng nghiên cứu
Bắt đầu từ cấu hình Chat được đề xuất và entry point createGenericAdapter, sau đó xem xét cách SDK hiện biểu diễn các sự kiện gửi đến và gửi phản hồi. Xác định phạm vi của adapter xoay quanh việc ánh xạ payload của webhook, xác minh và lọc tùy chọn, cùng hành vi HTTP gửi đi do nhà phát triển cung cấp; được xem là hoàn thành khi một adapter generic được tài liệu hóa có thể hỗ trợ các nền tảng bất kỳ có khả năng HTTP mà không cần parsing dành riêng cho nền tảng.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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
- Ngôn ngữ chính
- TypeScript
- Star
- 2.5k
- Fork
- 355
- Merge trung bình
- 2 ngày 15 giờ
- Pull request đã merge (30 ngày)
- 42
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của vercel/chat
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 1 ngày
-
X and Twitch: paragraphs inside a block quote are joined with no spaceCó thể đã có người làm @abhiramshaji-cyber đã nhận 5 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 58/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
solidjs/solid-docs#1716 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Progress indicated by console logs is off by oneCó thể đã có người làm @marceliwac đã nhận hôm nay. Đang mởbug needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
aws-samples/aws-cdk-examples#1336 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
melgarafael/DeskcommCRM#4999 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
type: bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 2 ngày