Setting up an NDS
Receiving push notifications involves using an Notification Delivery Service (NDS) as an intermediary to receive the webhook event from one of the SDK services. These can be currently one of several services that provide information about events that the SDK registers for. For example, LNURL-pay requests or swap events from the swap service. The NDS then processes this information and dispatches a push notification to the intended mobile device, ensuring the user receives timely updates about incoming events. This architecture necessitates developers set up and maintain their own NDS, tailored to handle and forward these notifications efficiently. An example payload when a swap_updated
POST request to the webhook URL contains the following JSON formatted structure:
{
"template": "swap_updated",
"data": {
"id": "", // The hashed swap id
"status": "" // The latest swap status
}
}
The need to run your own NDS is because it's configured to send push notifications to your application users and therefore should be configured with the required keys and certificates. You can use our reference NDS implementation as a starting point or as is. Our implementation of the NDS expects URLs in the following format:
https://your-nds-service.com/notify?platform=<ios|android>&token=[PUSH_TOKEN]
This is the same format used when using webhooks in the SDK, replacing the PUSH_TOKEN
with the mobile push token. Once the NDS receives such a request it will send a push notification to the corresponding device.
Mobile push token
Ensure that your mobile application is set up to receive push notifications and can generate a push token, which uniquely identifies the device for push notifications.
- For iOS, use Apple Push Notification Service (APNs) to get the token.
- For Android, use Firebase Cloud Messaging (FCM) to obtain the token.