Skip to content
Last updated

Integration Patterns

Before writing any code, decide which integration pattern fits your use case. The right pattern determines which API approach, authentication flow, and sync strategy to use.

Choosing a pattern

Use caseRecommended approach
Validate or retrieve one record while a user is waitingDirect app-specific API endpoint
Pull all records for a dataset, such as event registrationsSaved query or Query API
Pull records modified since the last syncQuery API with sys_last_modified_at criteria
Populate a mobile app, vendor database, or external cacheScheduled Query API syncs
Pull data across multiple Rhythm apps or modulesQuery API
Let customer admins adjust fields or filters without code changesSaved Rhythm query
Browser login, WordPress login, or SSOApplicable SSO guide
General rule

Use direct app endpoints for real-time, record-specific workflows. Use the Query API for scheduled syncs, reporting-style extracts, cross-app datasets, and incremental jobs.

Choosing an OAuth flow

Integration scenarioRecommended flow
Scheduled script, backend sync, batch job, or server-to-server process with no user presentClient Credentials / M2M
Server-rendered website where a real user logs inAuthorization Code
Mobile app or single-page application where a real user logs inAuthorization Code with PKCE
Browser login, SSO, WordPress, or redirect issuesApplicable SSO guide
M2M is not for users

If a real user is involved, do not use Machine-to-Machine authentication. M2M tokens are not user-specific and count against the customer's monthly token limit. See the authentication guide for caching requirements.

Incremental sync using "sys_last_modified_at"

For integrations that only need changed records, filter your query on the sys_last_modified_at field using a rolling lookback window rather than an exact timestamp. A rolling window protects against missed runs, time zone edge cases, and replication lag.

Recommended pattern:

  1. Build or save a query in Rhythm
  2. Filter to the specific business context (e.g., event_id or context_id)
  3. Include sys_last_modified_at as an output field
  4. Set criteria to records modified within the last 24–48 hours
  5. Run the query on a schedule
  6. Upsert records in the external system using the Rhythm record ID
  7. De-duplicate records that appear in overlapping sync windows

Handling status changes

Do not filter out cancelled or inactive records in incremental syncs unless the downstream system has another way to deactivate them. Include status changes so the external system can update or remove records accordingly.

ID correlation

Rhythm uses different IDs for different purposes — do not assume one ID serves every need. For event registration integrations, store all three:

IDRepresents
contact_idThe person / contact record
idThe specific registration record
event_id / context_idThe event or program that this record exists under

A single contact may have multiple registrations (for example, if they cancel and repurchase), so storing only the contact ID is not sufficient to identify a specific registration.

Static query vs saved query

Static querySaved query
Query definition lives inYour codeRhythm (referenced by ID)
Use whenField list should be version-controlled; filters should not change without a releaseCustomer admins may need to adjust fields; Support needs to help refine filters

See the Query Guide for how to build and execute both types.