Automatically sync contacts, tags, and order events from [ClickFunnels](https://www.clickfunnels.com) to Lumail using webhooks. This integration allows you to centralize your email marketing data and leverage Lumail's advanced segmentation and automation features with your ClickFunnels audience.

## What is ClickFunnels?

ClickFunnels is a comprehensive sales funnel builder that helps businesses create marketing funnels, landing pages, and manage online sales. With this integration, you can sync your ClickFunnels contacts, tags, and order activity to Lumail in real-time.

## How It Works

When events occur in ClickFunnels (new contacts, tag changes, orders), ClickFunnels sends webhook notifications to Lumail. The integration:

1. **Receives** webhook events from ClickFunnels
2. **Processes** the event (creates/updates subscribers, syncs tags, tracks orders)
3. **Updates** your Lumail database in real-time
4. **Records** all events in the subscriber timeline

## Guided setup (recommended)

Lumail has a step-by-step wizard that generates the token and the webhook URL for you:

**Settings -> Integrations -> ClickFunnels**, at `https://lumail.io/orgs/<your-org-slug>/settings/integrations/clickfunnels`.

It gives you the exact values to paste into ClickFunnels. The manual steps below do the same thing by hand.

## Setup Instructions

Follow these steps to connect your ClickFunnels account to Lumail.

### Step 1: Generate Your API Token

First, you need to generate an API token for the integration.

1. Visit your [organization settings page](https://lumail.io/orgs/default/settings/tokens)
2. Click **"Generate Token"** and give it a name like "ClickFunnels"
3. Copy the generated token - you'll need it for the webhook URL

### Step 2: Configure the Webhook in ClickFunnels

Now you'll add the webhook endpoint in your ClickFunnels workspace.

1. On the bottom left corner, click on **workspace settings**:

   ![ClickFunnels workspace settings](/docs/clickfunnel-1.png)

2. Then navigate to the **"Webhooks"** settings page:

   ![ClickFunnels webhooks page](/docs/clickfunnel-2.png)

3. You will be redirected to the webhooks endpoint page. Click on **"Add new webhook"** button:

   ![ClickFunnels add webhook](/docs/clickfunnel-3.png)

4. In the webhook form, fill in the following details:
   - **Name**: `Lumail.io`
   - **URL**: `https://lumail.io/api/v1/integrations/clickfunnel/{your-token}`
     - Replace `{your-token}` with the API token you generated in Step 1, including its `lum_` prefix
     - Example: `https://lumail.io/api/v1/integrations/clickfunnel/lum_1a2b3c...`
   - **Event types**: Select the events you want to sync:
     - ✅ **contact.created** - Syncs new contacts
     - ✅ **contact.deleted** - Unsubscribes contacts without deleting history
     - ✅ **contact.unsubscribed** - Marks contacts as unsubscribed
     - ✅ **orders/invoice.fulfilled** - Tracks successful orders
     - ✅ **orders/invoice.refunded** - Tracks refunded orders
   - **Endpoint scope**: Leave empty

5. Click **"Create endpoint"** and your integration will be ready

### Step 3: Test the Integration

To verify the integration is working:

1. Add a test contact in ClickFunnels with some tags
2. Check your Lumail organization's subscribers list
3. The contact should appear with all synced tags
4. Check the subscriber's timeline to see the webhook events

## Supported Events

The ClickFunnels integration automatically syncs the following events:

### Contact Created (contact.created)

When a new contact is created in ClickFunnels:

- Creates or updates the subscriber in Lumail
- Syncs all contact fields (first name, last name, phone)
- Applies all tags from ClickFunnels
- Records the event in the subscriber timeline

**Data synced:**

- Email address
- First name and last name (combined into full name)
- Phone number
- All contact tags

### Contact Deleted (contact.deleted)

When a contact is deleted from ClickFunnels:

- Marks the subscriber as unsubscribed in Lumail
- Keeps the subscriber row and send history
- Records the event in the subscriber timeline

### Contact Unsubscribed (contact.unsubscribed)

When a contact unsubscribes in ClickFunnels:

- Marks the subscriber as unsubscribed in Lumail
- Preserves subscriber data for compliance
- Records the event in the subscriber timeline

### Invoice Fulfilled (orders/invoice.fulfilled)

When an order is successfully completed:

- Creates or updates the subscriber with contact information
- Adds the tag **"invoice-fulfilled"**
- Records the event in the subscriber timeline

**Data synced:**

- Email, first name, last name, phone from invoice contact
- The `invoice-fulfilled` tag

> The invoice amount, currency and ID are not stored on the subscriber. Segment on the `invoice-fulfilled` tag, and use the [Events API](/docs/api-reference/api-events-post) if you need the amount in [revenue tracking](/docs/features/revenue-tracking).

### Invoice Refunded (orders/invoice.refunded)

When an order is refunded:

- Creates or updates the subscriber with contact information
- Adds the tag **"invoice-refunded"**
- Records the event in the subscriber timeline

**Data synced:**

- Email, first name, last name, phone from invoice contact
- The `invoice-refunded` tag

> As with fulfilled invoices, the amount and currency are not stored on the subscriber. The `invoice-fulfilled` tag is **not** removed on a refund - a refunded subscriber carries both tags.

## Troubleshooting

### Webhook not working?

1. **Check the webhook URL**: Make sure you replaced `{your-token}` with your actual API token
2. **Verify the token**: Ensure you copied the complete token without extra spaces
3. **Check webhook events**: Make sure you subscribed to the correct events in ClickFunnels
4. **Review logs**: Check your subscriber timeline for any error messages

### Contacts not syncing?

- Verify the webhook is active in ClickFunnels
- Check that the contact has a valid email address
- Ensure the webhook URL is correctly formatted
- Test with a new contact creation to trigger the webhook

### Tags not appearing?

- Tags are automatically created in Lumail if they don't exist
- Check the subscriber's tags section to see all synced tags
- Review the subscriber timeline for tag sync events
- For order events, check for "invoice-fulfilled" and "invoice-refunded" tags

### Order events not tracking?

- Make sure you selected the order event types (orders/invoice.fulfilled, orders/invoice.refunded) in the webhook configuration
- Verify that order webhooks are enabled in your ClickFunnels workspace
- Check the subscriber timeline for order-related events

## Related Documentation

- [ClickFunnels Webhooks Documentation](https://support.clickfunnels.com/support/solutions/articles/150000156983-webhooks)
- [Lumail API Reference](/docs/api-reference) - Complete API documentation
- [API Tokens](/docs/api-reference/api-tokens) - Create and manage API tokens
- [Tags API](/docs/api-reference/api-tags-get) - Manage synced tags
- [Subscriber Events](/docs/features/subscriber-events) - View integration events in timeline
- [Revenue Tracking](/docs/features/revenue-tracking) - Record order amounts yourself with the Events API
