> ## Documentation Index
> Fetch the complete documentation index at: https://docs.brew.new/llms.txt
> Use this file to discover all available pages before exploring further.

# Clerk

> Trigger Brew automations from Clerk webhook events, user signups, organization changes, paid subscriptions, and waitlist entries.

Connect [Clerk](https://clerk.com) to Brew so user, organization, billing, and waitlist events fire automations. Send a welcome email when someone signs up, drip a dunning sequence when a subscription goes past due, kick off a workspace-onboarding flow when a new team gets created.

## What you can do

* **Trigger automations from Clerk events.** Kick off email flows when users sign up, orgs are created, subscriptions go past due, or waitlist entries arrive
* **Auto-sync contacts into your audience.** Every Clerk event upserts the user into Brew with `clerk_*` custom fields (`clerk_user_id`, `clerk_subscription_status`, `clerk_plan_name`, …) you can filter and segment on
* **Personalize with auth context.** Reference `firstName`, `lastName`, `planName`, `organizationName`, and other Clerk fields inside emails
* **Cover lifecycle + billing in one place.** Onboarding, dunning, win-back, and waitlist nurture all use the same Clerk connection

## How it works

1. Brew mints a unique webhook URL for your brand and you paste it into your Clerk Dashboard.
2. Clerk signs every webhook with your endpoint's signing secret. Brew verifies the signature via the [Standard Webhooks (Svix)](https://www.standardwebhooks.com/) spec on receipt — tampered or replayed events are rejected.
3. For each verified event Brew (a) starts every **Published** automation whose trigger matches and (b) upserts the Clerk user into your [audience](/audience/add-contacts) with `clerk_*` custom fields.

See [How event triggers work](/integrations/integrations#how-event-triggers-work) for the conceptual flow shared by every event-source integration.

## Setup

<Steps>
  <Step title="Generate your Brew webhook URL">
    In Brew, open **Integrations**, click the **Clerk** card, and click **Generate URL**. Copy the URL Brew generates for the next step.
  </Step>

  <Step title="Add an endpoint in Clerk">
    Open [dashboard.clerk.com](https://dashboard.clerk.com), go to **Webhooks → + Add Endpoint**, and paste the Brew URL into the **Endpoint URL** field.
  </Step>

  <Step title="Subscribe to the events Brew supports">
    Enable the user, organization, organizationInvitation, organizationMembership, paymentAttempt, subscription, subscriptionItem, and waitlistEntry events (full list below), then click **Create**.
  </Step>

  <Step title="Reveal the Signing Secret">
    On the endpoint detail page Clerk shows next, click the eye icon next to **Signing Secret** to reveal it. The value starts with `whsec_`.
  </Step>

  <Step title="Paste the Signing Secret into Brew">
    Paste the `whsec_…` secret into the Brew connect form and click **Connect**. Brew verifies every webhook using the Standard Webhooks (Svix) spec.
  </Step>

  <Step title="Verify it's working">
    Trigger an event in Clerk (e.g. sign up a test user, or send a test invite). Within a few seconds it should appear in the **Manage → Recent events** panel of the Clerk integration page in Brew. If it doesn't, recheck the signing secret in step 5.
  </Step>
</Steps>

<Note>
  Brew only listens for Clerk events. It can't modify users, create organizations, or charge subscriptions.
</Note>

## Triggering automations

Once connected, every Clerk event below is provisioned automatically and available as a trigger in the [automation builder](/create-emails/automations). The **Manage** tab on the Clerk integration page is a read-only catalogue of the events Brew is listening for plus a live **Recent events** stream — no per-event enable step. Whether an event actually fires emails is controlled by whether the bound automation is **Published** (not Draft).

### Supported events

Brew supports the following 13 Clerk events as automation triggers:

**User**

* `user.created`

**Organization**

* `organization.created`
* `organizationInvitation.created`
* `organizationInvitation.accepted`
* `organizationInvitation.revoked`
* `organizationMembership.created`

**Billing**

* `paymentAttempt.created`
* `subscription.created`
* `subscriptionItem.freeTrialEnding`
* `subscriptionItem.pastDue`
* `subscriptionItem.canceled`
* `subscriptionItem.abandoned`

**Waitlist**

* `waitlistEntry.created`

<Tip>
  In chat, say *"Send this email when someone signs up via Clerk"* and Brew will scaffold the automation with `user.created` pre-selected.
</Tip>

## Common patterns

| Goal                                                | Clerk event                                                           |
| --------------------------------------------------- | --------------------------------------------------------------------- |
| Welcome new user                                    | `user.created`                                                        |
| Workspace-setup checklist for new orgs              | `organization.created`                                                |
| Branded "you have been invited" email               | `organizationInvitation.created`                                      |
| Welcome new teammate                                | `organizationInvitation.accepted` or `organizationMembership.created` |
| Pre-charge heads-up to reduce chargebacks           | `paymentAttempt.created`                                              |
| Trial-ending reminder                               | `subscriptionItem.freeTrialEnding`                                    |
| Dunning sequence on missed payment                  | `subscriptionItem.pastDue`                                            |
| Exit survey / win-back drip on cancel               | `subscriptionItem.canceled`                                           |
| Last-chance offer when a trial ends without payment | `subscriptionItem.abandoned`                                          |
| "You're on the list" + nurture drip                 | `waitlistEntry.created`                                               |

## Personalization

Use Clerk payload fields anywhere in your emails. Common variables:

| Variable                                          | Example                                                                    |
| ------------------------------------------------- | -------------------------------------------------------------------------- |
| `{{@trigger:output.payload.firstName}}`           | `Jane`                                                                     |
| `{{@trigger:output.payload.lastName}}`            | `Doe`                                                                      |
| `{{@trigger:output.payload.planName}}`            | `Pro Plan`                                                                 |
| `{{@trigger:output.payload.planAmount}}`          | `2000` (Clerk sends amounts in the smallest currency unit — cents for USD) |
| `{{@trigger:output.payload.organizationName}}`    | `Acme Corp`                                                                |
| `{{@trigger:output.payload.grandTotalFormatted}}` | `$22.00` (already pre-formatted by Clerk)                                  |

<Tip>
  Prefer `grandTotalFormatted` over `planAmount` in user-facing copy — it ships pre-formatted with the right currency symbol and decimals.
</Tip>

<Note>
  Clerk organization events (like `organization.created`) don't carry a customer email. Brew emits a synthetic placeholder so you can still route the event internally; use `createdBy` if you want to reach the org's creator.
</Note>

## Troubleshooting

<AccordionGroup>
  <Accordion title="An event arrived but no automation fired" icon="circle-question">
    Open the canvas and confirm at least one automation bound to this event is set to **Published** (not Draft). The Brew integration's **Manage → Recent events** panel shows every webhook Clerk has delivered — if the event isn't there, the webhook isn't arriving (check Clerk's endpoint settings and re-paste the signing secret). If the event is there but no email sent, the only remaining gate is `automation.published`.
  </Accordion>

  <Accordion title="Clerk shows 401 on every delivery" icon="triangle-exclamation">
    The signing secret in Brew doesn't match the one in Clerk's Dashboard — usually because it was rotated in one place but not the other. Reveal the current secret on the Clerk endpoint detail page and re-run setup step 5 in Brew.
  </Accordion>

  <Accordion title="I want to test before going live" icon="flask">
    Create a Draft automation, run a test send from the email editor, and only flip the automation to **Published** once you're happy. The **Manage → Recent events** panel shows every webhook Clerk has delivered in the last 24 hours so you can verify the trigger is firing the way you expect.
  </Accordion>
</AccordionGroup>

## Requirements

* A Clerk account on any paid plan (free instances support webhooks too)
* Admin access to your Clerk Dashboard so you can add a Webhook endpoint and reveal the Signing Secret

## Need Help?

Our team is ready to support you at every step of your journey with Brew. Choose the option that works best for you:

<Tabs>
  <Tab title="Self-Service Tools">
    <CardGroup cols="2">
      <Card title="Search Documentation" icon="magnifying-glass" color="#c44925">
        Type in the "Ask any question" search bar at the top left to instantly find relevant documentation pages.
      </Card>

      <Card title="ChatGPT/Claude Integration" icon="robot" color="#c44925">
        Click "Open in ChatGPT" at the top right of any page to analyze documentation with ChatGPT or Claude for deeper insights.
      </Card>
    </CardGroup>
  </Tab>

  <Tab title="Talk to Our Team">
    <CardGroup cols="2">
      <Card title="Schedule a Call" icon="calendar" color="#c44925" href="https://calendar.google.com/calendar/u/0/appointments/schedules/AcZssZ1iYoRUG1J792XQpbuQLjSRRDupr7MwraFK-HQRCtTYdBmrQi8nZu2qXfzKQigb8gbKJK3KN3-R">
        Book time with our founders for personalized guidance on strategy, best practices, or complex implementation questions.
      </Card>

      <Card title="Call Us Directly" icon="phone" color="#c44925">
        Need immediate assistance? Reach us at **+1-(332)-203-2145** for urgent issues or time-sensitive questions.
      </Card>

      <Card title="Slack Channel" icon="slack" color="#c44925">
        Our preferred support channel. You'll receive an invite after signup for direct founder support and fast responses.
      </Card>

      <Card title="Email Support" icon="envelope" color="#c44925" href="mailto:support@brew.new">
        Contact us at **[support@brew.new](mailto:support@brew.new)** for detailed inquiries or if you prefer not to use Slack.
      </Card>
    </CardGroup>
  </Tab>
</Tabs>
