next-forge supports sending webhooks to your users using Svix. Svix is an enterprise-ready webhooks sending service.

How it works

next-forge uses the Svix API in a stateless manner. The organization ID from the authenticated user is used as the Svix application UID, which is created automatically when the first message is sent.

Usage

Send a webhook

To send a webhook, simply use the send function from the @repo/webhooks package:

import { webhooks } from '@repo/webhooks';

await webhooks.send('invoice.created', {
  data: {
    id: 'inv_1234567890',
  },
});

Add webhook endpoints

Svix provides a pre-built consumer application portal, where users add endpoints and manage everything related to their webhooks subscriptions. App portal access is based on short-lived sessions using special magic links, and can be embed in an iframe in your dashboard.

To get access to the application portal, use the getAppPortal function from @repo/webhooks and use the returned URL in an iframe on your dashboard.

import { webhooks } from '@repo/webhooks';

const { url } = await webhooks.getAppPortal();

return (
  <iframe src={url} style="width: 100%; height: 100%; border: none;" allow="clipboard-write" loading="lazy" />
);

We have a prebuilt page at /webhooks that you can use as a starting point.