external_id, and
Pocketflows creates the record if it doesn’t exist or replaces it if it does.
For the model behind this, see How syncing works.
A sync request replaces the whole record. Properties you leave out are blanked out, so pass every
property in every sync request.
1. Sync a business
Pass the unique identifier you already have for the business asexternal_id,
along with its name. metadata is optional.
id. Save this id to
use as the business_id in the customer endpoints below.
2. Sync a customer of that business
Pass the unique identifier you already have for the customer asexternal_id,
along with the customer’s properties: email_address, phone_number,
full_name, first_name, last_name, and metadata. Every request must
include at least one of email_address or phone_number.
id.
To change one property on an existing customer, send the full record again with
the new value. This request clears the phone number and keeps the email address
and name, because they are sent again:
3. Sync in batches
To sync many records in one request, send them as an array. Each record takes the same properties as the single-record request.customers array contains null for the customers that had errors, and the
errors array says what went wrong with each one. A request can contain at most
15,000 customers.
The business batch endpoint is all or nothing: if any business is invalid, for
example an id that does not match one of your businesses, the request fails
and no businesses are synced.
Keep records in sync over time
After the first sync, send changes as they happen in your system:- A property changes, such as a new phone number: sync the full record again, as in step 2.
- A customer opts out of marketing: see Respect customer consent. Sync doesn’t change a customer’s unsubscribes.
- A customer is deleted: call
DELETE /customers/:idwith the customer’s Pocketflowsid. There is no way to delete or look up a customer byexternal_id, so store theidfrom each sync response alongside your own record.
Re-running a sync
Sending the sameexternal_id again finds the existing record and replaces it,
so repeating a sync does not create a second record.
To retry an individual request safely, see
Idempotency keys.
Related
- Let businesses build segments from your data
to turn the
metadatayou sync into filters in the embed. - Migrate to the sync endpoints if you already create businesses and customers with the previous endpoints.