diff --git a/apps/builder/pages/api/auth/adapter.ts b/apps/builder/pages/api/auth/adapter.ts index 4d4369c3e..9e65ea517 100644 --- a/apps/builder/pages/api/auth/adapter.ts +++ b/apps/builder/pages/api/auth/adapter.ts @@ -3,6 +3,7 @@ import { PrismaClient, Prisma, Invitation, Plan } from 'db' import { randomUUID } from 'crypto' import type { Adapter, AdapterUser } from 'next-auth/adapters' import cuid from 'cuid' +import { got } from 'got' export function CustomAdapter(p: PrismaClient): Adapter { return { @@ -19,6 +20,10 @@ export function CustomAdapter(p: PrismaClient): Adapter { plan: process.env.ADMIN_EMAIL === data.email ? Plan.PRO : Plan.FREE, }, }) + if (process.env.USER_CREATED_WEBHOOK_URL) + await got.post(process.env.USER_CREATED_WEBHOOK_URL, { + json: data, + }) if (invitations.length > 0) await convertInvitationsToCollaborations(p, user, invitations) return createdUser diff --git a/apps/docs/docs/self-hosting/configuration.md b/apps/docs/docs/self-hosting/configuration.md index 57991ea99..dd58b4a0a 100644 --- a/apps/docs/docs/self-hosting/configuration.md +++ b/apps/docs/docs/self-hosting/configuration.md @@ -181,3 +181,12 @@ These can also be added to the `viewer` environment | SLEEKPLAN_SSO_KEY | -- | Sleekplan SSO key used to automatically authenticate a user in Sleekplan |

+ +
Webhooks +

+ +| Parameter | Default | Description | +| ------------------------ | ------- | --------------------------------------------------------------------------------------------- | +| USER_CREATED_WEBHOOK_URL | -- | Webhook URL called whenever a new user is created (used for importing a new SendGrid contact) | + +