Appearance
Why Campaign Mapping?
Givebutter uses campaigns (events, fundraisers, general donation forms). LGL uses funds (restricted, unrestricted, campaign-specific). NOMA Sync needs a mapping so every transaction lands in the correct LGL fund.
Configuration is done in the Dashboard → Mappings page (and stored in D1). No code change required for new campaigns once the pattern is set.
Two Levels of Mapping
1. Type Defaults
What: Default LGL fund (and optionally campaign, gift type, payment type) for each Givebutter campaign type.
Examples:
- donation → Unrestricted Fund
- ticket → Event Fund
- peer_to_peer → General Fund
Where: Dashboard → Mappings → "Type defaults" or similar section. Each type (donation, ticket, etc.) has a default fund dropdown.
2. Campaign Overrides
What: A specific Givebutter campaign overrides the type default and maps to a specific LGL fund.
Example: Givebutter campaign "Not One More Rally 2026" → LGL fund "Rally 2026".
Where: Dashboard → Mappings → Campaign overrides. Add override by selecting Givebutter campaign (from cached list) and LGL fund.
Cache: Givebutter campaigns are cached in D1. Use Refresh in Mappings or Settings to pull the latest list from the Givebutter API.
How the Worker Uses Mapping
- Webhook or polling delivers a transaction with
campaign_idand campaign type. - Worker calls
determineLGLMapping(db, { givebutter_campaign_id, givebutter_campaign_name })(seelib/campaign-mapping.ts). - If a campaign override exists for that campaign ID, use its fund (and optional campaign, gift type, payment type).
- Otherwise use the type default for the transaction type.
- If nothing is set, fall back to a global default (e.g. default LGL fund for the environment).
Payment Type and Gift Type
- Payment type is often auto-detected from the transaction (e.g. credit card, cash). Type default and overrides can optionally set a default payment type or gift type in LGL.
- See Settings → LGL reference data refresh to ensure fund, campaign, gift type, and payment type lists are up to date in the dashboard.
Custom Fields
Custom form fields (shirt size, dietary, etc.) are mapped to LGL custom fields. This may be configured in campaign overrides (if the UI supports it) or in code in the Worker. Check campaign-mapping.ts and the Givebutter/LGL adapter for custom field handling.
Example Workflow
- NOMA adds a new Givebutter event "Gala 2026".
- In Mappings, click Add override, select "Gala 2026" from the Givebutter campaign list, choose LGL fund "Gala 2026".
- All ticket purchases for that event now sync to the Gala 2026 fund.
- No deploy required; mapping is stored in the database.

