Register a mobile app push token
- Path
/appPush/tokens- Auth
- Access token · browser or app
const url = 'https://releva.ai/api/v0/appPush/tokens';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"profileId":"DEMO-CUSTOMER-1001","deviceId":"demo-device-android-0001","deviceType":"android","pushToken":"demo-fcm-registration-token-android-0001"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://releva.ai/api/v0/appPush/tokens \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "profileId": "DEMO-CUSTOMER-1001", "deviceId": "demo-device-android-0001", "deviceType": "android", "pushToken": "demo-fcm-registration-token-android-0001" }'Registers the push token of one app install so Releva can send it push notifications from campaigns and
workflows. The Releva mobile SDKs call it for you (React Native registerPushToken). Call it again when the
token or the profile id changes.
Writes a pushNotificationSubscribe event (which can trigger campaigns) on every call, and creates a
placeholder profile when profileId is unknown. Only tokens with deviceType android or ios are ever
sent to. With tokenType: apns, Releva exchanges the APNs token for an FCM token through the shop’s iOS
Firebase project (“APNs import”). Processing is asynchronous. Unknown fields are ignored.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”object
Your customer id for the profile. Must not be null. A merged-away id is resolved to the surviving profile.
Stable id of the app install.
Stored as the token’s platform. Only android and ios tokens receive pushes; always send it.
FCM registration token, or a raw APNs device token (64 hex characters) when tokenType is apns.
Apns exchanges the APNs token for an FCM token through the shop’s iOS Firebase project and stores the device as ios.
IOS bundle identifier. Required when tokenType is apns.
Data (stored default): data-only messages, the SDK draws the notification. notification: Android pushes carry an FCM notification block so Android draws them (used with the Expo adapter).
Examples
{ "profileId": "DEMO-CUSTOMER-1001", "deviceId": "demo-device-android-0001", "deviceType": "android", "pushToken": "demo-fcm-registration-token-android-0001"}{ "profileId": "DEMO-CUSTOMER-1001", "deviceId": "demo-device-ios-0001", "deviceType": "ios", "pushToken": "0000000000000000000000000000000000000000000000000000000000000001", "tokenType": "apns", "bundleId": "com.example.shop"}Responses
Section titled “Responses”Accepted for asynchronous processing.
object
Example
{}Authentication, validation or APNs import error.
object
Human-readable error. Several validation errors are joined with a space.
Examples
{ "message": "The 'profileId' field is required. The 'deviceId' field is required. The 'pushToken' field is required."}{ "message": "The 'profileId' field is required."}{ "message": "The 'deviceType' field does not match any of the allowed values."}{ "message": "The 'tokenType' field does not match any of the allowed values."}{ "message": "The 'notificationStyle' field does not match any of the allowed values."}{ "message": "pushToken looks like a raw APNs device token. Send tokenType \"apns\" with bundleId so it can be exchanged for an FCM registration token."}{ "message": "bundleId is required when tokenType is apns."}{ "message": "No iOS Firebase account is configured for this domain."}{ "message": "APNs token could not be imported into FCM. Status: INTERNAL."}{ "message": "The '' field is required."}{ "message": "Authorization header is missing, and accessToken url parameters is also missing. At least one of them is required."}{ "message": "Authorization header is malformed. It should look like `Bearer <string>`."}{ "message": "The access token you provided is invalid."}{ "message": "Domain with the provided access token cannot be found."}The domain is disabled.
object
Human-readable error. Several validation errors are joined with a space.
Example
{ "message": "Domain is disabled. Please reach out to support@releva.ai to enable it."}Request body larger than 800 KB.
object
Human-readable error. Several validation errors are joined with a space.
Example
{ "message": "request entity too large"}Unexpected server error.
object
Human-readable error. Several validation errors are joined with a space.
Example
{ "message": "An internal error occurred."}