Generic HTTP webhook ingress channel (@flue/http) #329
astrobot-houston
started this conversation in
Feature Request
Replies: 1 comment
-
|
To make it easier for the maintainers, the complete implementation is fully written, tested, and passing all checks on the fork branch: Feature Motivation & Problem Matrix
Real-World Example: Clerk WebhooksClerk webhooks use Svix signatures, requiring the raw body string and headers ( import { createHttpChannel } from '@flue/http';
import { Webhook } from 'svix';
export const clerkWebhookChannel = createHttpChannel({
async verify(headers, body) {
const svixId = headers.get('svix-id');
const svixTimestamp = headers.get('svix-timestamp');
const svixSignature = headers.get('svix-signature');
if (!svixId || !svixTimestamp || !svixSignature) {
return Response.json({ error: 'Missing Svix headers' }, { status: 400 });
}
const wh = new Webhook(process.env.CLERK_WEBHOOK_SECRET!);
try {
// Svix verification requires the raw string body and headers
wh.verify(body, {
'svix-id': svixId,
'svix-timestamp': svixTimestamp,
'svix-signature': svixSignature,
});
return true;
} catch {
return false; // Returns standard 401 Unauthorized
}
},
async webhook({ json }) {
console.log('Verified Clerk Event:', json);
return { received: true };
},
});Verification
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
Proposes a new generic HTTP webhook ingress channel package (
@flue/http) to allow receiving and verifying arbitrary third-party webhook payloads within the Flue framework.Background & Motivation
Currently, Flue provides dedicated, provider-specific webhook ingress channels (such as GitHub, Stripe, Discord, etc.). However, developers often need to integrate other SaaS providers or custom webhooks that are not supported out of the box. Currently, they have to write custom Hono route handlers from scratch and manually wire up streaming limits, text decoding, and cryptographic signature verification.
A generic HTTP webhook channel solves this by providing a standard, reusable, and framework-integrated contract for arbitrary webhook ingestion.
Goals
@flue/http).Content-Type: application/jsonis specified, whilst leaving text or alternative payloads raw for downstream handling.workerd) environments.Example
Original implementation from #328 by @revanthpobala
Beta Was this translation helpful? Give feedback.
All reactions