Funnel Webhooks

Send webhook postbacks to external systems when funnel events occur.

OptiPub can send webhook postbacks to external URLs when funnel events fire. This lets you notify third-party systems — such as CRMs, analytics platforms, or custom backends — in real time when subscribers take actions like signing up, opening an email, or clicking a link.

Webhooks are sent using the Make Post Request to Url funnel action. It can send either a GET or a POST request, and you can either send OptiPub's default JSON payload (subscription, subscriber, and event data) or supply your own custom request body. URLs and request bodies support macros so you can inject subscriber-specific values like email address or ESP variables.

Setting Up a Funnel Webhook

Step 1. Create or edit a funnel.

Open an existing funnel or create a new one in Marketing > Funnels.

Step 2. Add a trigger event.

Choose the funnel event that should trigger the webhook (e.g., New Subscription, Email Opened, Email Clicked). Click the + button on the event grid to add one.

Step 3. Add the "Make Post Request to Url" action.

Click the + button under your trigger event and select Make Post Request to Url from the action list.

Step 4. Configure the request.

FieldDescription
NameInternal label for the action (not visible to subscribers).
Only onceWhen enabled, the action fires only once per subscriber for this funnel. Useful for avoiding duplicate notifications.
Meta Conversions APIOptional shortcut button. Opens a dialog for Pixel ID, access token, and event name, then prefills the URL and a JSON body that uses macros such as {$email_hash_meta}, {$fbc}, and {$unix_timestamp}. You can still edit the fields afterward. Existing actions that use {$email_sha256} keep working.
Google Enhanced ConversionsOptional shortcut button. Opens a dialog for Google Ads customer ID, conversion action ID, and optional MCC login customer ID, then prefills a Data Manager ingest URL and JSON body. Optional Conversion value (a number, or a macro such as an event variable) is sent with the Currency field (ISO 4217, defaults to USD). At send time the value is converted to a plain number, so $1,299.00 is sent as 1299. If the value isn't a valid amount (for example, the macro is empty or holds text), the value and currency are left out and the conversion is sent without them. Optional Transaction ID must be a macro that is unique per conversion, such as {$transaction_id}, or left empty: Google counts one conversion per ID and drops later uploads with the same ID, so a fixed value means only the first conversion is counted. OptiPub authenticates with the Google Ads Data Manager integration at send time — the access token is not stored on the funnel action.
URLThe full endpoint URL including https://. This is where OptiPub sends the request. Supports macros.
MethodThe HTTP method to use: GET or POST. Defaults to POST.
Body encoding (POST only)How the request body is encoded: JSON (Content-Type: application/json) or Form (URL-encoded) (application/x-www-form-urlencoded, like a typical HTML form post). Defaults to JSON.
Custom body (POST only)An optional custom request body. Leave blank to send OptiPub's default payload. See Customizing the request body.
Send Only If ActiveWhen enabled, the request only fires if the subscription is still active.

GET requests send no body. When Method is set to GET, the body encoding and custom body fields are hidden. To pass data on a GET request, include it as query-string parameters in the URL using macros (see below).

Google Ads Data Manager must be connected under Admin → Settings → Integrations (and the Data Manager API enabled on the Google Cloud OAuth project) before a Google Enhanced Conversions action can send. Connect with a Google account that can access the Ads account. The conversion action must be type UPLOAD_CLICKS (shown in Google Ads as Website — Import from clicks). This uses Google's Data Manager API, not the legacy Ads API UploadClickConversions endpoint.

Step 5. Set the timing.

Choose when the webhook should fire after the trigger event:

OptionBehavior
ImmediatelyFires as soon as the event occurs.
Specific Day / TimeFires on a specific day and time after the event.
DelayedFires after a set delay (e.g., 30 minutes, 2 hours).
Delayed at a Specific TimeFires after a set number of days, at a specific time.
Choosing the time the action fires with the time menu.

Timing options for the webhook action.

Step 6. Save.

Click OK to add the action, then Save the funnel.

Webhook Payload

When a POST request fires without a custom body, OptiPub sends this default JSON payload to the configured URL. It includes the full subscription, subscriber (with emails and ESP variables), and event context. To send your own body instead, see Customizing the request body.

{
    "id": 715462777,
    "active": true,
    "email_id": 10048162,
    "publication_id": 7,
    "subscriber_id": 57343261,
    "started_at": "2024-10-17 16:11:50",
    "ended_at": null,
    "deleted_at": null,
    "created_at": "2024-10-17T16:11:50.000000Z",
    "updated_at": "2024-10-17T16:11:50.000000Z",
    "publication": {
        "id": 7,
        "name": "OptiPub Daily",
        "active": true,
        "code": "opd"
    },
    "subscriber": {
        "id": 57343261,
        "created_at": "2024-10-17T16:11:50.000000Z",
        "updated_at": "2024-10-17T16:11:50.000000Z",
        "emails": [
            {
                "id": 10048162,
                "email": "[email protected]",
                "md5": "01f6ea24e7137bd99a7b73436fd7ef30",
                "variables": [
                    { "id": 1002021, "name": "phone", "value": "5554445949" },
                    { "id": 1002703, "name": "first_name", "value": "John" },
                    { "id": 1002707, "name": "last_name", "value": "Doe" }
                ]
            }
        ]
    },
    "email": {
        "id": 10048162,
        "email": "[email protected]",
        "md5": "01f6ea24e7137bd99a7b73436fd7ef30"
    },
    "event": {
        "event": "NewSubscription",
        "data": {
            "ip": "17.30.57.47",
            "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36",
            "referring_url": "https://example.com/landing-page",
            "effort_id": "809502",
            "variables": [
                { "name": "first_name", "value": "John" },
                { "name": "last_name", "value": "Doe" },
                { "name": "phone", "value": "5554445949" }
            ]
        }
    },
    "subscription": {
        "id": 715462777,
        "active": true,
        "email_id": 10048162,
        "publication_id": 7,
        "subscriber_id": 57343261,
        "started_at": "2024-10-17 16:11:50"
    }
}

The payload above is condensed for readability. The actual payload includes additional fields on the subscription, subscriber, and nested objects.

Macros

Both the URL and a custom request body support macros — placeholders that OptiPub replaces with subscriber-specific values when the request fires. Macros use the format {$name} and are case-insensitive.

MacroValue
{$email}The subscriber's email address for this subscription.
{$email_md5}The MD5 hash of that email address.
{$email_sha256}The SHA-256 hash of the OptiPub email (trimmed, lowercased).
{$email_hash_meta}Alias of {$email_sha256}. Used by the Meta Conversions API shortcut for em matching.
{$email_hash_google}SHA-256 after Google Enhanced Conversions normalization: all whitespace stripped, then for gmail.com / googlemail.com only, . and +suffix are removed from the local part.
{$locale}The language stored on the email address, as a language code such as de. Empty when none has been recorded.
{$timezone}The IANA timezone stored on the email address, such as America/New_York. Empty when none has been recorded.
{$ip_address}The IP address from the triggering event, or from the subscriber's most recent signup when the event has none.
{$user_agent}The user agent from the triggering event, or from the most recent signup when the event has none.
{$referring_url}The referring URL from the triggering event, or from the most recent signup when the event has none.
{$gclid}The Google Ads click ID captured at signup, or the gclid query parameter from referring_url. Empty when neither is present.
{$fbclid}The Meta click ID captured at signup, or the fbclid query parameter from referring_url. Empty when neither is present.
{$fbc}The visitor's Meta _fbc cookie captured at signup, or a click ID built as fb.1.{unix_ms}.{fbclid} when fbclid is present. Empty otherwise.
{$effort_id}The effort ID from the triggering event, when available.
{$transaction_id}The ID of the purchase transaction behind the triggering event, unique per purchase and renewal. Empty when the event carries none, including all events that are not purchases.
{$unix_timestamp}The current Unix timestamp (seconds since epoch) when the request fires.
{$rfc3339_timestamp}The current UTC time as RFC 3339 (Y-m-dTH:i:sZ) when the request fires.
{$esp_<name>}Any ESP variable stored on the email, by variable name — e.g. {$esp_first_name}, {$esp_phone}.
{$event_<name>}Any variable carried by the triggering event, by name with an event_ prefix — the same variables a Send Email action or welcome letter receives. Signups through the public subscribe API carry each extra form field (a price field becomes {$event_price}), and purchase events carry the variables sent with the order. Most other events, such as opens, clicks, and tag changes, carry none. Empty when the event has no such variable.

Where macros work:

  • In the URL — values are automatically URL-encoded, so macros are safe to use in query-string parameters (e.g. https://example.com/hook?email={$email}). This is the primary way to pass data on GET requests.
  • In a custom body — macros are substituted inside string values (not keys). Values are inserted as-is (not URL-encoded).

Event variables can include personal or payment details, such as a phone number, card details, or a pre-authenticated login link. Only send the variables the receiving service needs.

Where click IDs come from:

  • OptiPub subscribe forms read gclid and fbclid from the page URL when the visitor signs up. If the visitor browsed to another page first, the form falls back to the Google conversion linker cookie (_gcl_aw) and the Meta _fbc cookie, which exist only when the site runs Google's tag or the Meta Pixel.
  • The public subscribe API (/o/subscribe) accepts gclid, fbclid, and fbc fields.
  • Everything else falls back to the referring_url query string. Many paths set referring_url from the HTTP Referer header, which browsers strip down to the site's domain on cross-site requests, so click IDs are usually missing there.

When a visitor broadcasts Do Not Track or Global Privacy Control, the subscribe form does not read click IDs, and the public subscribe API ignores gclid, fbclid, and fbc on that request, including as subscriber variables.

When the Google Data Manager URL is used, empty values (such as a blank {$gclid} or {$ip_address}) are removed from the body before sending, so Google can still match the conversion on the hashed email alone.

Signup details on later events

Only the signup itself happens in the visitor's browser. Triggers that fire afterwards, such as Opened Email, Clicked Email, a tag change, or Added to Funnel, carry no IP address, user agent, referring URL, or click IDs of their own.

For those triggers, OptiPub fills in whichever of these values the event lacks from the subscriber's most recent signup, duplicate signup, or reactivation on that publication. This lets a funnel report a conversion when the subscriber clicks their welcome email and still send the {$gclid} from the ad that brought them in.

  • Values on the triggering event always win over the saved signup values.
  • Only the most recent signup is used. If it carried no click ID, an older signup's click ID is not sent.
  • A signup saved without click IDs falls back to the gclid or fbclid in its saved referring URL, when it has one.
  • A signup more than 90 days old is not used, because ad platforms stop attributing a conversion to a click after that.

Customizing the Request Body

For POST requests, you can replace the default payload with your own body by filling in the Custom body field. Leave it blank to send the default payload.

Enter a valid JSON object. If the body is empty or is not valid JSON, OptiPub falls back to the default payload.

The Body encoding setting controls how the body is sent:

EncodingContent-TypeBehavior
JSONapplication/jsonThe JSON object is sent as the raw request body.
Form (URL-encoded)application/x-www-form-urlencodedEnter a JSON object of field names to values; OptiPub sends it as URL-encoded form fields. With the default payload, nested keys use bracket notation.

Example — custom JSON body with macros:

{
    "email": "{$email}",
    "first_name": "{$esp_first_name}",
    "source": "optipub",
    "effort": "{$effort_id}"
}

Custom headers and HTTP methods other than GET/POST are not currently supported on generic Post to URL actions. Google Enhanced Conversions is the exception: OptiPub attaches a refreshed OAuth Authorization header (and x-goog-user-project) when the URL is the Data Manager ingest endpoint.

Common Use Cases

Use CaseExample
CRM syncPOST new subscriber data to your CRM when they sign up.
Analytics trackingNotify your analytics platform when subscribers open or click.
Partner postbacksFire a conversion postback to an affiliate or ad network.
Meta Conversions APIUse the Meta shortcut to send hashed email and click ID ({$fbc}) to Graph API.
Google Enhanced ConversionsUse the Google shortcut to upload leads to Google Ads via Data Manager.
Slack/Teams alertsSend a notification to a webhook URL when a high-value event occurs.
Custom workflowsTrigger downstream automation in Zapier, Make, or a custom API.

Did this page help you?