Skip to content

Givebutter Event Sync

What is Givebutter Event Sync?

When you create or update an event campaign in Givebutter, NOMA Sync can create or update a matching event on the NOMA website (WordPress). That event stores the Givebutter campaign code and widget ID so the site can show the registration widget (ticket form) on the event page. Registrations still happen in Givebutter; the webhook then syncs each transaction to LGL.

Flow:

  1. Givebutter – You publish an event campaign (type event, with event date).
  2. NOMA Sync – Receives campaign.created or campaign.updated, fetches campaign details and tickets, then calls the WordPress REST API.
  3. WordPress – Creates or updates a noma_events post with title, dates, venue, gb_campaign_id, gb_campaign_code, gb_widget_id, and ticket data.
  4. Site – Event single page loads the Givebutter widget script and renders <givebutter-widget id="..."> or <givebutter-form campaign="..."> so visitors can register.
  5. Registrations – Go to Givebutter; transaction.succeeded webhook → NOMA Sync → LGL (same as other Givebutter donations).

So Givebutter event sync is the leg that keeps the website event listing and registration embed in sync with Givebutter; the donation/ticket → LGL leg is unchanged and documented in Givebutter Overview.

When Does Sync Run?

  • Trigger: Givebutter webhook for campaign.created or campaign.updated.
  • Only event campaigns: Campaign type must be event.
  • Only published: Campaign status must be published (or active).
  • Requires event date: Campaign must have event_date in the Givebutter API response; otherwise sync is skipped with status "skipped".

If WORDPRESS_URL or WORDPRESS_API_KEY is not set in the Worker, WordPress sync is skipped (no error; LGL sync still runs for transactions).

Worker Configuration

Set these Cloudflare Worker secrets (or in .dev.vars for local):

VariableDescription
WORDPRESS_URLWordPress site URL (e.g. https://notonemorealabama.org). No trailing slash.
WORDPRESS_API_KEYSecret key that must match the key stored in WordPress (see below).
WORDPRESS_TIMEZONEOptional. IANA timezone (e.g. America/Chicago) for converting Givebutter UTC dates to the site timezone. Should match WordPress Settings → General → Timezone.

WordPress Configuration (hello-noma theme)

  • API key: The theme checks the header X-NOMA-API-Key against the option hello_noma_sync_api_key. Set this in WordPress (e.g. Settings or a dedicated NOMA Sync settings page) to the same value as WORDPRESS_API_KEY in the Worker. If they don't match, the REST API returns 403 and event create/update fails.
  • Givebutter widget account: For the registration widget to load on event pages, set the option givebutter-widget-account (Givebutter account identifier). The theme enqueues https://widgets.givebutter.com/latest.umd.cjs?acct={account} in the head on event archive/single so <givebutter-widget> and <givebutter-form> are defined before the React app runs.

WordPress REST Endpoints (NOMA Sync → WordPress)

The Worker calls these; they are implemented in the hello-noma theme. Do not call them from the browser without the API key.

MethodRoutePurpose
GET/wp-json/noma/v1/events/by-campaign/{campaign_id}Find existing event by Givebutter campaign ID.
POST/wp-json/noma/v1/events/from-givebutterCreate new event (body: campaign_id, title, event_date, venue, tickets, widget_id, etc.).
PATCH/wp-json/noma/v1/events/{id}/from-givebutterUpdate existing event.

All require header: X-NOMA-API-Key: <secret>.

What Gets Stored on the Event (WordPress)

  • Post type: noma_events
  • Meta (examples): _gb_campaign_id, _gb_campaign_code, _gb_widget_id, _gb_tickets (JSON), _start_date, _end_date, _venue_name, _venue_address, etc. The theme exposes these on the REST API for the events app; the single-event page uses gb_widget_id or gb_campaign_code to render the Givebutter embed.

Recurring events (weekly/monthly, WordPress-only, no Givebutter) use separate meta and are documented in Recurring events.

Troubleshooting Event Sync and Widget

SymptomWhat to check
No event on site after creating/publishing in GivebutterWorker: WORDPRESS_URL and WORDPRESS_API_KEY set. Dashboard Syncs: filter by source Givebutter, look for campaign webhook and any "WordPress event sync failed" or "skipped" (e.g. no event_date).
403 on from-givebutter or by-campaignWordPress option hello_noma_sync_api_key must equal Worker WORDPRESS_API_KEY. Key must be set on both sides.
Widget never appears; only "Register on Givebutter" linkWordPress: givebutter-widget-account set so the widget script loads. Event must have gb_widget_id or gb_campaign_code (sync must have run successfully). Browser console: check for script or custom-element errors.
Campaign not syncingGivebutter: campaign type is event, status is published. Givebutter API: campaign has event_date. Worker logs: "Skipping campaign" (type/status) or "Campaign has no event_date".
Wrong dates or timezone on eventSet WORDPRESS_TIMEZONE to match WordPress (e.g. America/Chicago).