Skip to content

LGL Data

Overview ​

NOMA Sync finds or creates constituents and creates gifts in Little Green Light (LGL). LGL constituent and gift data comes only from Givebutter and Square — not from Mailchimp. (Mailchimp subscription status is synced to LGL by LGL’s built-in Mailchimp integration; see Mailchimp Overview.) For full LGL API details see LGL API documentation.

Authentication ​

  • Method: API key (Bearer or header per LGL docs).
  • Storage: Stored as Cloudflare Worker secret (LGL_API_KEY). LGL environment (production vs sandbox) is selectable in Dashboard → Settings.

Constituent (Find or Create) ​

NOMA Sync searches LGL for an existing constituent by email (normalized: lowercase, trimmed) before creating. This avoids duplicates when the same person donates, buys, or signs up from multiple sources.

Create payload (conceptual) ​

When no matching constituent is found, NOMA Sync creates one with:

FieldGivebutterSquare
first_namesupporter first namecustomer given_name or default
last_namesupporter last namecustomer family_name or default
email_addressessupporter emailcustomer email or default constituent
phone_numberssupporter phonecustomer phone
addressessupporter addresscustomer address

For Square orders with no customer, the default constituent (configured in Settings) is used; NOMA Sync finds or creates that constituent in LGL.

Gift (Create) ​

One gift per Givebutter transaction or Square order. Mailchimp does not create gifts (see Mailchimp Overview for scope).

FieldGivebutterSquareNotes
constituent_idFrom find-or-createFrom find-or-create or defaultRequired
amounttransaction amountorder.total_money (cents → dollars)Required
gift_datetransaction dateorder.created_atFormatted per LGL API
sourcee.g. "Givebutter"e.g. "Square Online Store"Optional
external_idgivebutter_{id}square_order_{id}Idempotency; LGL rejects duplicate
fund_id / campaign_idFrom campaign mappingFrom type default or location overrideFrom Dashboard Mappings
payment_type / gift_typeAuto-detected or mappingFrom tender typeLGL payment/gift type by name
custom fieldsFrom transaction custom_fieldsOptional (line items summary)Per campaign mapping

Idempotency ​

  • sync_log: Each sync has external_id (e.g. givebutter_123, square_order_abc) so the same event is not processed twice.
  • LGL gift: Same external_id is sent to LGL. If LGL returns 422 "External Gift ID already exists", NOMA Sync treats it as skipped (success), not failure.

Mailchimp and LGL (Not NOMA Sync) ​

NOMA Sync does not update LGL from Mailchimp webhooks. The Mailchimp webhook in NOMA Sync is audit-only: events (unsubscribe, cleaned, etc.) are verified, parsed, and logged to sync_log (source: mailchimp) for audit. No LGL API calls are made.

Mailchimp ↔ LGL subscription status (Subscribed, Unsubscribed, Bounced, etc.) is handled by LGL’s built-in Mailchimp integration (Settings → Integration → Mailchimp in LGL), which syncs nightly and uses LGL’s “MailChimp Status” category/keywords. NOMA Sync does not duplicate this.

Error Handling ​

LGL ResponseNOMA Sync behavior
2xxSuccess; sync_log written
422 (external_id already exists)Treated as idempotent; sync_log status skipped
4xx/5xxRetry with backoff; on final failure, log and alert

Campaign / Fund Mapping ​