palbaseDocs

Palbase Notify · API

POST/notify/in-app/campaigns

Create an in-app campaign

A campaign: a message (a screen of the message kind: a modal, a banner, the whole screen), who sees it (everyone, or an analytics audience's members who allowed personalization), what shows it (an event of the app's), how often at most (beside the project's in_app settings), and what counts as its conversion.

Called by your server, with the project's secret key.

Headers

Idempotency-Keystring · optionalMakes the write safe to send again (at most 255 characters). A retry with the same key and the same request gets the first answer back, marked `Idempotent-Replayed: true`, and changes nothing; the same key with a different request is refused with 422, and while the first request still runs a retry gets 409 with Retry-After. Answers are kept for 24 hours.

Request body

audience_idstring (uuid) · optionalAn analytics audience: its members who allowed personalization; none: everyone.
conversionobject · optionalWhat counts as a campaign's conversion: the person's event within hours of seeing it.
couponstring · optionalOne of iap's coupons: {{coupon}} is each person's own code of it — the campaign is shown to users alone, and waits for one the coupon has no code for.
definitionobject · requiredA message shown in the app, or a card of its inbox: a design system (the theme's colors, type scale, radii and spacing) and a free layout of components that name it, drawn by the same renderer as a paywall, and how it is shown (presentation). Its texts name the values its sender gives. Its assets (asset:<id>) are the project's, downloaded before it is shown. The server refuses what it does not know and holds a definition to a paywall's bounds: 128 KiB of JSON, 400 components, 16 deep, 500 characters a text, 40 languages.
ends_atstring (date-time) · optional
for_journeysboolean · optionalShown to no one but the people a journey's step opened it for, each for the step's days; such a campaign has no audience_id.
limitsobject · optionalHow often a campaign reaches a person at most, beside the project's in_app settings.
namestring · required
priorityinteger · optionalWhich shows when two would (higher first).
starts_atstring (date-time) · optional
status"draft" | "active" | "paused" | "ended" · optional
triggerobject · requiredWhat shows a campaign: an event of the app's (session_start as it comes to the foreground), with properties it must have, each equal.
variablesobject · optionalThe values its texts name.
curl
curl -X POST "https://<your-ref>.palbase.studio/notify/in-app/campaigns" \
  -H "apikey: $PALBASE_SECRET_KEY" \
  -H "content-type: application/json" \
  -d '{"definition":{"default_locale":"string","name":"string","presentation":{"type":"modal"},"root":{"action":{"type":"close"},"content":null,"type":"button"},"schema":2,"theme":{"colors":{"dark":{},"light":{}}}},"name":"string","trigger":{"event":"string"}}'

Responses

201The campaign

400Validation failed or a required field is missing

401Missing or invalid API key

403Not the project's secret key, or not what the shared sender sends for it (`own_provider_required`; `auth_template_reserved`: auth's templates, which auth's own flows alone send through it, but for an organization's invitation, auth.org_invitation); or a change to the platform's own project (`owner_only`) without its owner's access token (X-Palbase-Owner) or its operator's token (X-Palbase-Operator) beside the key. An owner's sign-in that is not a passkey one from the last 15 minutes is 401 `insufficient_user_authentication`.

409A request with this Idempotency-Key is still running

422The Idempotency-Key was sent with a different request

429Over the project's request limit, or its shared sends for this window

503Temporarily unavailable; retrying is safe after Retry-After

defaultAn error: the envelope names it (`error`) and explains it (`error_description`).

Operation CreateInAppCampaign of notify's contract.