@pnta/expo
v0.1.1
Published
PNTA push notifications client for Expo / React Native
Downloads
265
Readme
@pnta/expo
Expo / React Native client for PNTA push notifications.
Install
npx expo install @pnta/expoUsage
import { createPntaClient } from "@pnta/expo";
import * as Notifications from "expo-notifications";
const pnta = createPntaClient({
projectId: "your-project-id",
});
const token = await Notifications.getDevicePushTokenAsync();
await pnta.identify(token.data);getDevicePushTokenAsync() returns the native APNs/FCM token PNTA uses as the
device identifier. See the Expo Notifications docs for permissions and platform
setup: https://docs.expo.dev/versions/latest/sdk/notifications/
API
PNTA API docs: https://docs.pnta.io/api-reference/introduction
createPntaClient(config)
const pnta = createPntaClient({ projectId: "your-project-id" });identify(token)
Registers or updates the device for a push token.
await pnta.identify(pushToken);setMetadata(token, metadata)
Updates device metadata.
await pnta.setMetadata(pushToken, { user_id: "user_123" });trackOpen(notificationId, token)
Tracks a notification open.
await pnta.trackOpen(notificationId, pushToken);