npsp-api-and-integration

NPSP programmatic integration patterns: BDI gift processing API for bulk gift ingestion, ERD Schedules and Installments API for recurring donation data, and wealth screening integration via AppExchange managed packages. NOT for standard Salesforce REST/BULK API, NPSP PMM integration, or Nonprofit Cloud (NPC) native API patterns.

Best use case

npsp-api-and-integration is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

NPSP programmatic integration patterns: BDI gift processing API for bulk gift ingestion, ERD Schedules and Installments API for recurring donation data, and wealth screening integration via AppExchange managed packages. NOT for standard Salesforce REST/BULK API, NPSP PMM integration, or Nonprofit Cloud (NPC) native API patterns.

Teams using npsp-api-and-integration should expect a more consistent output, faster repeated execution, less prompt rewriting, better workflow continuity with your supporting tools.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.
  • You already have the supporting tools or dependencies needed by this skill.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/npsp-api-and-integration/SKILL.md --create-dirs "https://raw.githubusercontent.com/PranavNagrecha/AwesomeSalesforceSkills/main/skills/apex/npsp-api-and-integration/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/npsp-api-and-integration/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How npsp-api-and-integration Compares

Feature / Agentnpsp-api-and-integrationStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

NPSP programmatic integration patterns: BDI gift processing API for bulk gift ingestion, ERD Schedules and Installments API for recurring donation data, and wealth screening integration via AppExchange managed packages. NOT for standard Salesforce REST/BULK API, NPSP PMM integration, or Nonprofit Cloud (NPC) native API patterns.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# NPSP API and Integration

This skill activates when a developer needs to build integrations with NPSP's gift processing pipeline — including the BDI (Bulk Data Import) API for gift ingestion, the Enhanced Recurring Donation Schedule and Installment APIs, or wealth screening tool integration. It does NOT cover standard Salesforce REST API, NPSP PMM integration, or Nonprofit Cloud native API patterns.

---

## Before Starting

Gather this context before working on anything in this domain:

- **Direct Opportunity insert bypasses NPSP** — The most critical rule: never insert Opportunity and npe01__OppPayment__c records directly via Data Loader or REST API. This bypasses NPSP's BDI pipeline, silently skipping GAU allocations, soft credits, household rollup calculations, and Salesforce Elevate payment linkage.
- **BDI is the canonical gift processing API** — All gift integrations must route through `npsp__DataImport__c` staging records and invoke `BDI_DataImport_API`. This is NPSP's prescribed integration surface.
- **ERD API distinction** — The Enhanced Recurring Donation API exposes two separate Apex-invocable methods: the **RD2 Schedules API** (returns projected schedule as JSON) and the **RD2 Installments API** (returns calculated future installments as a list). Installment records are NOT persisted Opportunity records — they are calculated projections.
- **Wealth screening has no native API** — There is no built-in NPSP wealth screening API. iWave, DonorSearch, and similar tools integrate via AppExchange managed packages that write scores to custom fields on Contact/Account.

---

## Core Concepts

### BDI Gift Processing Pipeline

NPSP's Bulk Data Import (BDI) framework is the prescribed gift processing integration surface. The flow is:

1. Integration inserts records into `npsp__DataImport__c` (the staging object)
2. Integration invokes `BDI_DataImport_API.process()` or the standard NPSP Data Import batch job
3. BDI processes each staging record: creates/matches Contact, Household Account, Opportunity, Payment, GAU Allocations, and Opportunity Contact Roles (soft credits)
4. Processed DataImport records have `npsp__Status__c = 'Imported'` (or 'Failed' with error detail)

Key BDI staging fields:
- `npsp__Contact1_Firstname__c`, `npsp__Contact1_Lastname__c`, `npsp__Contact1_Email__c` — primary donor
- `npsp__Donation_Amount__c`, `npsp__Donation_Date__c`, `npsp__Donation_Stage__c` — gift data
- `npsp__Donation_Campaign_Name__c` — campaign attribution
- `npsp__Payment_Method__c` — payment method
- `npsp__GAU_Allocation_1_General_Accounting_Unit__c`, `npsp__GAU_Allocation_1_Amount__c` — fund allocation
- `npsp__Contact2_Firstname__c`, etc. — soft credit recipient

Advanced Mapping must be enabled in NPSP Settings to map custom fields on Opportunity or Payment.

### ERD Schedules and Installments APIs

Enhanced Recurring Donations exposes two Apex-invocable APIs:

**RD2 Schedules API:** Returns the active schedule for a recurring donation as JSON. Useful for displaying projected payment amounts and dates to donors.
```apex
String scheduleJson = npsp.RD2_ApiService.getSchedules(rdId);
```

**RD2 Installments API:** Returns a list of projected future installment records (not persisted Opportunities). Useful for cash flow projections and displaying upcoming payment expectations.
```apex
List<npsp.RD2_ApiService.Installment> installments = 
    npsp.RD2_ApiService.getInstallments(rdId, numberOfPeriods);
```

Critical distinction: `getInstallments()` returns calculated projections, NOT the actual Opportunity records that will be created. Future installment Opportunities are created by NPSP's scheduled batch job, not by the Installments API.

### Wealth Screening Integration Pattern

Wealth screening tools (iWave, DonorSearch, Windfall) integrate via AppExchange managed packages that:
1. Connect to the vendor's API via a Connected App or API key in the managed package settings
2. Provide a Lightning component or batch process to retrieve wealth scores
3. Write scores to custom fields on Contact/Account (e.g., `iwave__iWave_Score__c`)

There is NO native NPSP or Salesforce wealth screening API. Each ISV package has its own integration configuration. Architects should not design custom HTTP callout integrations when an AppExchange package exists for the target vendor.

---

## Common Patterns

### BDI Integration for External Gift Processing

**When to use:** Any external system (event platform, payment processor, peer-to-peer fundraising tool) that needs to push gift data into NPSP.

**How it works:**

```apex
// 1. Create DataImport staging records
List<npsp__DataImport__c> imports = new List<npsp__DataImport__c>();
for (ExternalGift gift : externalGifts) {
    imports.add(new npsp__DataImport__c(
        npsp__Contact1_Firstname__c = gift.firstName,
        npsp__Contact1_Lastname__c  = gift.lastName,
        npsp__Contact1_Email__c     = gift.email,
        npsp__Donation_Amount__c    = gift.amount,
        npsp__Donation_Date__c      = gift.giftDate,
        npsp__Donation_Stage__c     = 'Closed Won',
        npsp__Payment_Method__c     = gift.paymentMethod
    ));
}
insert imports;

// 2. Process via BDI API
npsp.BDI_DataImport_API.processDataImportRecords(
    new npsp.BDI_DataImport_API.BDIImportSettings(),
    imports,
    false // dryRun = false
);

// 3. Check results
for (npsp__DataImport__c di : [
    SELECT npsp__Status__c, npsp__FailureInformation__c
    FROM npsp__DataImport__c WHERE Id IN :imports
]) {
    if (di.npsp__Status__c == 'Failed') {
        // Handle failure
    }
}
```

**Why not direct Opportunity insert:** Direct inserts bypass GAU allocation processing, soft credit creation, household account rollup triggers, and Elevate payment ID linkage — all silently. The BDI pipeline handles all of these automatically.

### ERD Schedule Retrieval

**When to use:** Donor-facing portal or communication that needs to display a recurring donor's projected payment schedule.

```apex
// Get active recurring donation schedules for display
String scheduleJson = npsp.RD2_ApiService.getSchedules(recurringDonationId);
Map<String, Object> scheduleMap = 
    (Map<String, Object>) JSON.deserializeUntyped(scheduleJson);
// Parse schedule details for UI display
```

---

## Decision Guidance

| Situation | Recommended Approach | Reason |
|---|---|---|
| Insert gift data from external system | npsp__DataImport__c + BDI_DataImport_API | Only method that triggers all NPSP gift processing logic |
| Get recurring donation schedule | RD2_ApiService.getSchedules() | Returns active schedule as JSON |
| Get projected future installments | RD2_ApiService.getInstallments() | Returns calculated projections (not persisted Opps) |
| Wealth screening integration | AppExchange managed package (iWave, DonorSearch) | No native NPSP wealth screening API exists |
| Bulk historical gift import | DataImport__c batch (50,000 records max, 100MB file) | BDI supports large batch loads |
| Custom payment/GAU field mapping | NPSP Advanced Mapping (must be enabled first) | Standard BDI mapping does not cover custom fields |

---

## Recommended Workflow

1. **Confirm BDI Advanced Mapping** — If the integration requires custom field mapping on Opportunity, Contact, or Payment, verify NPSP Advanced Mapping is enabled in NPSP Settings > Advanced Mapping.
2. **Map source data to DataImport fields** — Map every source field to the corresponding `npsp__DataImport__c` field. Document fields that have no standard BDI mapping (will need Advanced Mapping or post-processing).
3. **Write DataImport insertion code** — Build the staging record population logic, including gift data, donor match fields, GAU allocations, and soft credit recipients.
4. **Invoke BDI processing** — Call `BDI_DataImport_API.processDataImportRecords()` or trigger the batch job.
5. **Handle failures** — Check `npsp__Status__c = 'Failed'` and `npsp__FailureInformation__c` on DataImport records post-processing. Route failures to a notification or remediation queue.
6. **Validate rollup recalculation** — After bulk import, verify NPSP CRLP (Customizable Rollups) has recalculated household totals for affected Contacts. Large imports may require a manual CRLP batch run.

---

## Review Checklist

- [ ] No direct Opportunity or OppPayment inserts — all gifts routed through DataImport__c
- [ ] BDI Advanced Mapping enabled if custom fields are needed
- [ ] GAU allocation fields populated on DataImport records where required
- [ ] Soft credit recipient fields populated for matching gift and in-kind donors
- [ ] Error handling checks `npsp__FailureInformation__c` on failed DataImport records
- [ ] CRLP batch recalculation triggered after large bulk imports
- [ ] ERD Installments API not confused with persisted Opportunity records

---

## Salesforce-Specific Gotchas

1. **Direct Opportunity insert bypasses all NPSP processing** — This is the #1 NPSP integration mistake. Inserting Opportunity and OppPayment records directly (via Data Loader or REST API) silently skips GAU allocations, soft credits, household rollups, and Elevate payment linkage. Always use BDI.
2. **ERD Installments API returns projections, not Opportunities** — `RD2_ApiService.getInstallments()` returns a list of calculated projection objects. These are NOT the actual Opportunity records for future installments. Future Opportunities are created by NPSP's scheduled Apex batch job. Integrations that wait for installment Opportunities to appear immediately after calling getInstallments() will wait forever.
3. **BDI Advanced Mapping must be enabled before custom field mapping works** — Standard DataImport__c fields cover most gift data, but custom Opportunity, Contact, or Payment fields require Advanced Mapping to be enabled in NPSP Settings. Without it, custom field values in DataImport records are silently ignored.

---

## Output Artifacts

| Artifact | Description |
|---|---|
| DataImport field mapping table | Source-to-BDI field mapping for the integration |
| BDI integration Apex class | Staging record population and BDI API invocation code |
| ERD API usage examples | Code samples for Schedule and Installments API calls |

---

## Related Skills

- `npsp-trigger-framework-extension` — For custom Apex logic that extends NPSP TDTM after BDI processing
- `gift-history-import` — For bulk historical gift migration using DataImport__c

Related Skills

npsp-trigger-framework-extension

8
from PranavNagrecha/AwesomeSalesforceSkills

Use when extending the NPSP Trigger-Driven Trigger Management (TDTM) framework with custom Apex handler classes — covering class authorship, DmlWrapper return patterns, Trigger_Handler__c registration, load order, recursion guards, and test isolation. NOT for standard Apex triggers outside of NPSP, general trigger-handler framework design, or Nonprofit Cloud (NPC) which replaced NPSP in new orgs.

scim-provisioning-integration

8
from PranavNagrecha/AwesomeSalesforceSkills

Use when designing or reviewing SCIM-based user lifecycle provisioning into Salesforce from Okta, Azure AD / Entra, or another IdP — create/update/deactivate, group-to-permission-set mapping, attribute mapping, and deprovisioning semantics. Triggers: 'scim provisioning', 'okta scim salesforce', 'entra salesforce provisioning', 'user deactivation automation', 'group to permission set mapping'. NOT for SSO/authentication setup (see single-sign-on skills).

omnistudio-lwc-integration

8
from PranavNagrecha/AwesomeSalesforceSkills

Use when embedding OmniScripts in Lightning Web Components, registering custom LWC elements inside OmniScript screens, or calling OmniScript/Integration Procedures from LWC. Triggers: embed omniscript in LWC, custom LWC element in OmniScript, call OmniScript from Lightning page, omnistudio-omni-script tag, seed data JSON, OmniScript launch from LWC. NOT for standalone LWC development, standard Flow embedding, or OmniScript-to-OmniScript embedding.

integration-procedures

8
from PranavNagrecha/AwesomeSalesforceSkills

Use when building, reviewing, or debugging OmniStudio Integration Procedures. Triggers: 'integration procedure', 'IP', 'HTTP action', 'DataRaptor', 'rollbackOnError', 'failureResponse'. NOT for Apex-only integrations unless the main design choice is whether OmniStudio is still appropriate.

integration-procedure-cacheable-patterns

8
from PranavNagrecha/AwesomeSalesforceSkills

Use when designing Integration Procedures (IPs) with platform cache to cut latency and callout load. Covers cache key design, TTL selection, per-user vs org-wide partitions, invalidation on data changes, and safe fallback on cache miss/stale. Does NOT cover general IP authoring (see omnistudio-error-handling-patterns) or LWC client-side caching.

slack-salesforce-integration-setup

8
from PranavNagrecha/AwesomeSalesforceSkills

Use this skill when setting up or troubleshooting the Salesforce for Slack managed app — including connecting a Salesforce org to a Slack workspace, configuring the three-party admin handshake, linking Slack channels to Salesforce records, enabling record preview sharing, and managing org-level limits. Triggers on: Salesforce for Slack app not connecting, Slack org connection setup, Salesforce record sharing in Slack, Slack workspace admin approval, connecting Salesforce to Slack. NOT for building custom Slack apps or Slack bots (separate development platform), not for Slack Workflow Builder Salesforce connector (use slack-workflow-builder skill), not for Flow-based Slack messaging (use flow-for-slack skill).

sis-integration-patterns

8
from PranavNagrecha/AwesomeSalesforceSkills

Use this skill when designing or implementing an integration between a Student Information System (SIS) — such as Ellucian Banner, Ellucian Colleague, Anthology Student, Oracle PeopleSoft Campus Solutions, or Workday Student — and Salesforce Education Cloud. Covers the canonical Education Cloud data model objects (AcademicTermEnrollment, CourseOfferingParticipant, CourseOfferingPtcpResult, LearnerProfile, PersonAcademicCredential), external ID / upsert keying strategies using SIS-native identifiers (Banner PIDM, PeopleSoft EMPLID), batch nightly upsert patterns, Change Data Capture (CDC) for enrollment status writeback, and MuleSoft/middleware watermark patterns. Trigger keywords: SIS integration, Banner integration, PeopleSoft integration, Education Cloud data model, enrollment sync, grade writeback, AcademicTermEnrollment, LearnerProfile upsert. NOT for Salesforce Admissions Connect application processing, Financial Aid integration, Learning Management System (LMS) integrations, or general ETL tooling not involving Education Cloud objects.

salesforce-to-salesforce-integration

8
from PranavNagrecha/AwesomeSalesforceSkills

Use this skill to implement Salesforce-to-Salesforce integration patterns — covering the native S2S feature, API-based cross-org sync, Platform Event bridging, and Salesforce Connect Cross-Org adapter. Trigger keywords: Salesforce to Salesforce integration, cross-org data sharing, S2S feature, cross-org Platform Events, Salesforce Connect cross-org. NOT for multi-org strategy or architecture decisions (use architect/multi-org-strategy), single-org data sharing, or external (non-Salesforce) system integration.

real-time-vs-batch-integration

8
from PranavNagrecha/AwesomeSalesforceSkills

When to use this skill: choosing between real-time (synchronous callouts, Platform Events, CDC, Pub/Sub API) and batch (Bulk API 2.0, scheduled ETL) integration patterns. Trigger keywords: should I use real-time or batch, how to sync high-volume data, when to use Platform Events vs Bulk API, integration latency vs volume tradeoff. NOT for Batch Apex internals (use batch-apex-patterns), NOT for MuleSoft middleware design (use middleware-integration-patterns), NOT for CDC field tracking configuration.

platform-events-integration

8
from PranavNagrecha/AwesomeSalesforceSkills

Use when publishing Platform Events from external systems via REST API, subscribing to Platform Events from outside Salesforce via CometD or Pub/Sub API, designing replay ID strategy for durable external consumers, or handling high-volume event delivery guarantees. Trigger keywords: 'external publish platform event', 'CometD subscribe', 'Pub/Sub API', 'replay ID external', 'durable subscription', 'RetainUntilDate'. NOT for Apex-only event publishing or triggering (use platform-events-apex). NOT for Change Data Capture external subscription (use change-data-capture-integration).

middleware-integration-patterns

8
from PranavNagrecha/AwesomeSalesforceSkills

Use when selecting or comparing middleware / iPaaS tools (MuleSoft, Dell Boomi, Workato, Informatica) for Salesforce connectivity, or when determining whether a scenario requires middleware at all versus native Salesforce capabilities. Triggers: 'which iPaaS should I use', 'MuleSoft vs Boomi vs Workato', 'when do I need middleware for Salesforce', 'message transformation orchestration middleware'. NOT for MuleSoft Anypoint Salesforce Connector configuration (use mulesoft-salesforce-connector). NOT for API-led connectivity layer design (use api-led-connectivity). NOT for native Salesforce-to-Salesforce integration, Platform Events, or CDC.

idempotent-integration-patterns

8
from PranavNagrecha/AwesomeSalesforceSkills

Use when designing retry-safe integrations with Salesforce — including external ID upsert strategies, idempotency key management for inbound calls, Platform Event replay safety, and Outbound Message retry handling. NOT for Salesforce duplicate management rules.