Core Methods
createPntaClient()
projectId: Your PNTA project ID (format:prj_XXXXXXXXX)baseUrl(optional): API base URL. Default:https://app.pnta.io/api/v1
identify(), setMetadata(), and onNotificationTap()
Throws: if projectId is empty
identify()
token: The native APNs or FCM token fromgetDevicePushTokenAsync()
setMetadata()
null or undefined values are skipped.
Parameters:
token: The device’s push tokenmetadata: Key-value pairs
onNotificationTap()
callback with the notification payload on every tap, including the tap that launches the app. The SDK reads the payload from the correct place on each platform.
Parameters:
callback: Called with the notification payload after each tap
subscription.remove() to stop listening, for example in a useEffect cleanup.
Errors
identify() and setMetadata() reject with an Error when the request fails. The message includes the status code and path, for example PNTA 404 /identification: .... If onNotificationTap() cannot record an open, it logs a warning and does not throw.
Notification Payload
Every PNTA notification includes these fields.onNotificationTap() gives them to your callback:
notification_id: The notification’s IDtoken: The device’s push tokenlink_to: The link you set when sending, if any
Link Handling
The SDK doesn’t open links. YouronNotificationTap() callback gets link_to and decides what to do. With Expo Router, router.push(payload.link_to) handles both kinds of links:
- Internal routes (without a scheme) → Navigate in your app
- Examples:
/profile,/settings,/orders/123 - The route must exist in your
app/directory
- Examples:
- External URLs (with a scheme) → Open in the system browser or app
- Examples:
https://example.com,mailto:[email protected],tel:+1234567890
- Examples:
Linking.openURL() from react-native for external URLs.