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

# Clerk Integration

> Automatically sync users from Clerk to create subscribers

Connect your Clerk authentication to automatically add every new user as a subscriber. No code required—just paste a webhook URL.

## What is Clerk?

[Clerk](https://clerk.com) is a modern authentication platform that provides drop-in user management for web applications. It handles sign-up, sign-in, user profiles, and security.

## Connecting Clerk

### Step 1: Get Your Webhook URL

1. Go to **Settings → Integrations** in Sequenzy
2. Click **Connect** next to Clerk
3. Copy the webhook URL shown (format: `https://api.sequenzy.com/api/webhooks/clerk/{your-company-id}`)

### Step 2: Create Webhook in Clerk

1. Go to your [Clerk Dashboard](https://dashboard.clerk.com)
2. Navigate to **Developers** in the left sidebar. Click on **Webhooks**
3. Click **Add Endpoint**
4. Paste your Sequenzy webhook URL
5. Select these events:
   * `user.created`
   * `user.updated`
   * `user.deleted`
6. Click **Create**
7. Copy the **Signing Secret** (format: `whsec_xxxxxxxxx`)

<Warning>
  The signing secret is only shown once. Copy it before closing the dialog.
</Warning>

### Step 3: Complete Connection in Sequenzy

1. Return to Sequenzy's Clerk connection modal
2. Paste the **Signing Secret** from Clerk
3. Click **Connect Clerk**

That's it! New Clerk users will automatically become subscribers.

## What Gets Synced

When a user signs up through Clerk, Sequenzy automatically:

1. Creates a new subscriber with their email
2. Syncs profile data (name, username, etc.)
3. Triggers the `contact.subscribed` internal event

### Synced Attributes

| Attribute     | Source                         |
| ------------- | ------------------------------ |
| `email`       | Primary verified email address |
| `firstName`   | Clerk first name               |
| `lastName`    | Clerk last name                |
| `username`    | Clerk username                 |
| `clerkUserId` | Clerk user ID                  |

## Tracked Events

| Event                  | Triggered When            |
| ---------------------- | ------------------------- |
| `contact.subscribed`   | New user created in Clerk |
| `contact.unsubscribed` | User deleted in Clerk     |

## Using with Automations

### Welcome Sequence

Create an automation triggered by `contact.subscribed` to send a welcome sequence to every new user:

1. Go to **Automations** → **Create New**
2. Set trigger to **Event Received** → `contact.subscribed`
3. Add your welcome email sequence
4. Activate the automation

Every Clerk signup will now receive your welcome sequence automatically.

### Personalization

Use the synced attributes in your emails:

```
Hi {{firstName}},

Welcome to our app! We're excited to have you on board.
```

## User Lifecycle

| Clerk Event  | Sequenzy Action                                  |
| ------------ | ------------------------------------------------ |
| User created | Subscriber added, `contact.subscribed` triggered |
| User updated | Subscriber attributes updated                    |
| User deleted | Subscriber unsubscribed                          |

When a user is deleted in Clerk, they're automatically unsubscribed in Sequenzy. No manual cleanup needed.

If the same user is later re-created in Clerk (a new `user.created` event for the same email), Sequenzy reactivates the contact automatically. Explicit opt-outs (unsubscribe link, dashboard, API) are never undone by re-creation.

## Troubleshooting

### Users Not Syncing

1. Verify the webhook URL is correct in Clerk
2. Check that all required events are selected (`user.created`, `user.updated`, `user.deleted`)
3. Test by creating a new user in Clerk and checking if they appear in Sequenzy subscribers

### Invalid Signature Errors

If webhooks are failing with signature errors:

1. Verify you copied the complete signing secret from Clerk
2. Ensure the secret starts with `whsec_`
3. Try recreating the webhook in Clerk with a new secret

### Missing Profile Data

Clerk only syncs data that exists in the user profile. If `firstName` is empty in Clerk, it won't appear in Sequenzy. Ensure your Clerk sign-up flow collects the data you need.

## FAQ

<AccordionGroup>
  <Accordion title="Does this sync existing Clerk users?">
    No, only new users created after connecting will sync. Existing users need to be imported manually or will sync when their profile is updated.
  </Accordion>

  <Accordion title="Can I sync users to specific lists?">
    Currently, Clerk users are added to your general subscriber list. You can use
    tags or automations to organize them after creation.
  </Accordion>

  <Accordion title="What if a user doesn't have an email?">
    Users without an email address are skipped. Sequenzy requires an email to
    create a subscriber.
  </Accordion>

  <Accordion title="Is this included in my plan?">
    Yes, Clerk integration is included at no extra cost.
  </Accordion>
</AccordionGroup>
