Skip to main content

Integrations

An integration is a delivery channel your ESP RainMaker Neo deployment has configured; an Apple or Firebase push service, for example. Three methods on ESPRMNeoUser let an app discover which integrations exist and register itself as an endpoint on one, which is how a device gets push notifications.

The flow is always the same three steps: list, pick the integration matching your build, register your delivery token.

List available integrations

const integrations = await user.listIntegrations();

Returns Promise<IntegrationInfo[]>. Each entry exposes only enough to address it, no credentials or other configuration:

FieldContents
integration_idThe ID to register against
integration_typeapns, apns_sandbox or gcm
bundle_idApple bundle ID, on apns and apns_sandbox
project_idFirebase project ID, on gcm

bundle_id and project_id are how you tell several push integrations apart. A deployment commonly configures both an Apple production and sandbox integration, so match on the type and the addressing hint rather than taking the first entry:

const target = integrations.find(
(i) => i.integration_type === "gcm" && i.project_id === "<firebase-project-id>",
);

Register a delivery endpoint

const endpointId = await user.registerIntegrationEndpoint(
target.integration_id,
"<push-token>",
"en_US",
);

registerIntegrationEndpoint(integrationId, appToken, locale?) returns Promise<string>, the endpoint_id the server derived. appToken is the platform push token your app obtained from the OS.

Persist the returned endpoint ID

The server derives the endpoint ID; there is no method that lists your registered endpoints back to you. If you do not store it, you cannot unregister that endpoint later. Save it alongside the push token that produced it, and re-register when the OS rotates the token.

Unregister an endpoint

await user.unregisterIntegrationEndpoint(integrationId, endpointId);

unregisterIntegrationEndpoint(integrationId, endpointId) returns Promise<SuccessResponse>, an optional message. It removes one specific endpoint and cleans up the underlying delivery registration.

Both arguments are required: the endpoint ID alone does not identify the registration, because endpoint IDs are scoped per integration.

Sign-out does not unregister endpoints. If the user should stop receiving notifications on this device, call this before logout().

Method summary

MethodReturns
listIntegrations()IntegrationInfo[]
registerIntegrationEndpoint(integrationId, appToken, locale?)string
unregisterIntegrationEndpoint(integrationId, endpointId)SuccessResponse

All three are signed with the caller's AWS credentials, so they need a session that has completed the credential chain, which connectMQTT() or an explicit getTemporaryAWSCredentials() provides.