Skip to main content

Automatically enroll Gravity Forms submissions as Benecaster subscribers

Premium Intermediate

If you collect email addresses through Gravity Forms (for a live event, a manual enrollment flow, or a waitlist), each submission can create a Benecaster subscriber on a specific tier, without anyone touching the admin. The new subscriber gets a WordPress account, a feed URL and a welcome email, all from the form submission.

One submission is one person, so post it to the one-subscriber endpoint, POST /benecaster/v1/shows/{id}/subscribers/manual, not to bulk enroll. That endpoint adds the subscriber in the request itself, so it never waits for WP-Cron and is never refused because the show is busy. Bulk Enroll runs one job per show and refuses a second list while one is running, and a form webhook does not retry, so a signup sent there could be lost.

The endpoint does what Add Subscriber Manually on the Subscribers screen does: it creates the WordPress user if needed, starts the membership, mints the feed URL, sends the welcome email and fires benecaster_manual_subscriber_created. The subscriber is recorded as a manual (comped) grant.

Set up the webhook

It requires manage_options, so authenticate with a WordPress Application Password issued to an administrator account kept for the integration (Users → Profile → Application Passwords).

In Gravity Forms: Form Settings → Webhooks → Add New. Set Request URL to https://your-site.com/wp-json/benecaster/v1/shows/{SHOW_ID}/subscribers/manual, Request Method POST and Request Format JSON, and add an Authorization header: Basic followed by the base64 of admin-username:application-password. Request Body (Select Fields):

{
    "email": "{Email:1}",
    "tier_slug": "supporter",
    "display_name": "{Name:2}"
}

tier_slug must be an active, paid tier on the show; an unknown, inactive or free tier returns 400 invalid_tier. Add expiry_at (ISO 8601) to end the access later, for a fixed-term offer. A person who already has an active subscription on the show returns 409 already_subscribed and nothing changes, so a form someone submits twice is safe. A successful add answers 201 with subscription_id, token_hash_prefix and user_id.

To enroll only paying customers, set the webhook’s Conditional Logic to fire after the form’s payment feed (Stripe or PayPal) completes.

The show must use Built-in Membership, or a membership plugin whose bridge add-on supports manual subscribers. Otherwise the endpoint returns 501 bridge_unsupported and nobody is enrolled. On a show run by MemberPress, WooCommerce Subscriptions, Paid Memberships Pro or Restrict Content Pro, enroll paying members through that plugin itself and let Benecaster’s bridge pick them up.

Free followers from a form

The manual endpoint takes paid tiers only. For a form that collects free followers, call benecaster_follower_signup() from the form’s own submission hook instead of a webhook. It works on every show, under every membership plugin, and honors the show’s Ask new followers to confirm their email setting:

add_action( 'gform_after_submission_3', function ( array $entry ): void { // 3 = your form's ID
    $result = benecaster_follower_signup( 42, (string) rgar( $entry, '1' ) ); // 42 = show ID, field 1 = Email
    if ( is_wp_error( $result ) ) {
        error_log( 'Follower signup failed: ' . $result->get_error_message() );
    }
} );

The code example shows an optional follow-up: tagging the newly enrolled user in a CRM on benecaster_subscription_activated. Its $source is admin_enrolled for a subscriber added this way, so you can leave paid signups out.

For a whole list from a spreadsheet, use bulk enroll instead: see Import a follower list from code.

Code

<?php
// Optional: react to the enrollment server-side (e.g. tag the user in a CRM).
add_action( 'benecaster_subscription_activated', function ( int $user_id, int $show_id, string $tier_slug, string $source ): void {
    if ( 'admin_enrolled' !== $source ) {
        return; // Only react to admin and webhook enrollments, not paid signups.
    }
    my_crm_tag_user( $user_id, 'benecaster-webhook-enrolled' );
}, 10, 4 );

View on GitHub →

Hooks Used

Need this built rather than just documented? See our services →