Skip to main content

Push Notifications

Register device tokens so RainMaker can send FCM or APNS notifications.

note

userInstanceESPRMUser from User sign in.

What This Module Does ?

Creates and deletes platform endpoints that map your app’s FCM or APNS device token to RainMaker push delivery.

Use after platform setup in the Push Notifications Configuration Guide (FCM/APNS apps in the RainMaker Dashboard).

Expected outcome: An endpoint ARN you can store locally; the user receives sharing, node, and automation notifications per deployment settings.

Common Workflows

Create platform endpoint

const endpointArn = await userInstance.createPlatformEndpoint({
platform: "FCM",
deviceToken: fcmToken,
});

iOS production: platform: "APNS". iOS development: platform: "APNS_SANDBOX".

Delete platform endpoint

await userInstance.deleteEndpoint(deviceToken, endpointArn);

Call on logout or when replacing a token.

Typical login integration

Register after successful sign-in. The RainMaker Home app creates endpoints post-login.

Error Handling

try {
await userInstance.createPlatformEndpoint({ platform: "FCM", deviceToken });
} catch (error) {
console.error("Push registration failed:", error);
}

Check Dashboard push settings, platform type (FCM vs APNS vs sandbox), and that the device token is current.

Advanced Concepts

Endpoint request fields

Note: Fields marked with * are required.

FieldPurpose
platform*FCM, APNS, or APNS_SANDBOX
deviceToken*Token from FCM or APNS
typeOptional platform-specific category

Notification types

RainMaker can push events such as node sharing, node add/remove, parameter updates, automations, and alerts. Configure which events fire in Deployment Settings → Push Notifications. Payload shapes: Notification events.

Best Practices

  1. Complete Dashboard FCM/APNS setup before calling the SDK
  2. Request OS notification permission before obtaining the device token
  3. Delete endpoints on logout to avoid stale registrations
  4. Use sandbox APNS only for development builds

On this page