-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Webhooks documentation. #108
Conversation
opening for early review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reads well, easy to understand
src/SUMMARY.md
Outdated
@@ -21,4 +21,5 @@ | |||
- [Buy Bitcoin](guide/buy_btc.md) | |||
- [Static Channel Backup](guide/static_channel_backup.md) | |||
- [Service Status](guide/service_status.md) | |||
- [Payment Notificaions](guide/payment_notification.md) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- [Payment Notificaions](guide/payment_notification.md) | |
- [Payment Notifications](guide/payment_notification.md) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
src/guide/payment_notification.md
Outdated
</section> | ||
|
||
## Processing the Payload | ||
Processing the Payload is according to the application needs. One of the major use cases that can be handled via webhooks is receiving a payment in mobile app while the app is not running, or in short "offline receive" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Processing the Payload is according to the application needs. One of the major use cases that can be handled via webhooks is receiving a payment in mobile app while the app is not running, or in short "offline receive" | |
Processing of the Payload can be done according to the application's needs. One of the major use cases that can be handled via webhooks is receiving a payment in a mobile app while the app is not running, or in short "offline receive" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
src/guide/payment_notification.md
Outdated
Processing the Payload is according to the application needs. One of the major use cases that can be handled via webhooks is receiving a payment in mobile app while the app is not running, or in short "offline receive" | ||
|
||
## Webhook integration for "offline recieve" | ||
In the context of mobile applications using the Breez SDK for Lightning Network payments, a crucial architectural component involves the seamless flow of payment notifications to the user's mobile device. This process is facilitated through a Notification Delivery Service (NDS), acting as an intermediary. When a payment is made to a user, the LSP sends a notification to the NDS, configured with a specific webhook URL. The NDS then processes this information and dispatches a push notification to the intended mobile device, ensuring the user receives timely updates about incoming payments. This architecture necessitates vendors to set up and maintain their own NDS, tailored to handle and forward these notifications efficiently. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the context of mobile applications using the Breez SDK for Lightning Network payments, a crucial architectural component involves the seamless flow of payment notifications to the user's mobile device. This process is facilitated through a Notification Delivery Service (NDS), acting as an intermediary. When a payment is made to a user, the LSP sends a notification to the NDS, configured with a specific webhook URL. The NDS then processes this information and dispatches a push notification to the intended mobile device, ensuring the user receives timely updates about incoming payments. This architecture necessitates vendors to set up and maintain their own NDS, tailored to handle and forward these notifications efficiently. | |
In the context of mobile applications using the Breez SDK for Lightning Network payments, a crucial architectural component involves the seamless flow of payment notifications to the user's mobile device. This process is facilitated through a Notification Delivery Service (NDS) acting as an intermediary. When a payment is made to a user, the LSP sends a notification to the NDS configured with a specific webhook URL. The NDS then processes this information and dispatches a push notification to the intended mobile device, ensuring the user receives timely updates about incoming payments. This architecture necessitates vendors setting up and maintaining their own NDS, tailored to handle and forward these notifications efficiently. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
src/guide/payment_notification.md
Outdated
In the context of mobile applications using the Breez SDK for Lightning Network payments, a crucial architectural component involves the seamless flow of payment notifications to the user's mobile device. This process is facilitated through a Notification Delivery Service (NDS), acting as an intermediary. When a payment is made to a user, the LSP sends a notification to the NDS, configured with a specific webhook URL. The NDS then processes this information and dispatches a push notification to the intended mobile device, ensuring the user receives timely updates about incoming payments. This architecture necessitates vendors to set up and maintain their own NDS, tailored to handle and forward these notifications efficiently. | ||
|
||
## Step 1: Run your own NDS | ||
As written above you will need to run your own NDS because NDS is configured to send push notifications to your app users, therefore configured with the required keys and certificates. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As written above you will need to run your own NDS because NDS is configured to send push notifications to your app users, therefore configured with the required keys and certificates. | |
As written above you will need to run your own NDS because the NDS is configured to send push notifications to your app users, therefore configured with the required keys and certificates. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
src/guide/payment_notification.md
Outdated
|
||
## Step 1: Run your own NDS | ||
As written above you will need to run your own NDS because NDS is configured to send push notifications to your app users, therefore configured with the required keys and certificates. | ||
If you don't want to write it from scratch you can use our running <a href="https://github.com/breez/notify">NDS</a> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you don't want to write it from scratch you can use our running <a href="https://github.com/breez/notify">NDS</a> | |
If you don't want to write it from scratch, you can use our own <a href="https://github.com/breez/notify">NDS</a> implementation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
src/guide/payment_notification.md
Outdated
As written above you will need to run your own NDS because NDS is configured to send push notifications to your app users, therefore configured with the required keys and certificates. | ||
If you don't want to write it from scratch you can use our running <a href="https://github.com/breez/notify">NDS</a> | ||
|
||
Our used NDS expects urls in the following format: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Our used NDS expects urls in the following format: | |
Our NDS implementation expects URLs in the following format: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
src/guide/payment_notification.md
Outdated
Our used NDS expects urls in the following format: | ||
<section><i>https://your-nds-service.com/notify?platform=<ios|android>&token=[PUSH_TOKEN]</i></section> | ||
|
||
Once the NDS received such request it will send a push notification to the matched device. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once the NDS received such request it will send a push notification to the matched device. | |
Once the NDS has received such request it will send a push notification to the matched device. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
src/guide/payment_notification.md
Outdated
|
||
* Handle the Notification: After confirming the payment, handle the notification accordingly by updating the app's UI. | ||
|
||
As a reference implelentation see how we did it in c-breez wallet: <a href="https://github.com/breez/c-breez/blob/main/ios/Breez%20Notification%20Service%20Extension/NotificationService.swift">NotificationService.swift</a> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As a reference implelentation see how we did it in c-breez wallet: <a href="https://github.com/breez/c-breez/blob/main/ios/Breez%20Notification%20Service%20Extension/NotificationService.swift">NotificationService.swift</a> | |
As a reference implementation, see how we did it in c-breez wallet: <a href="https://github.com/breez/c-breez/blob/main/ios/Breez%20Notification%20Service%20Extension/NotificationService.swift">NotificationService.swift</a> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
src/guide/payment_notification.md
Outdated
The Breez SDK provides a robust feature for applications to receive real-time notifications for incoming payments over the Lightning Network. This is achieved through the use of webhooks. A webhook is a powerful tool that allows your application to be notified via a specified URL when a payment is received. | ||
|
||
## Setting Up the Webhook | ||
To utilize this feature, you need to set up a webhook that Breez can call when a payment is received. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To utilize this feature, you need to set up a webhook that Breez can call when a payment is received. | |
To utilize this feature, you need to set up a webhook that the LSP can call when a payment is received. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
src/guide/payment_notification.md
Outdated
</custom-tabs> | ||
|
||
## Handling Incoming Notifications | ||
When a payment is received, Breez will send a POST request to your webhook URL. The request body will contain details about the payment. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When a payment is received, Breez will send a POST request to your webhook URL. The request body will contain details about the payment. | |
When a payment is received, the LSP will send a POST request to your webhook URL. The request body will contain details about the payment. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks good and seems clear.
Some points in the comments below.
src/guide/payment_notification.md
Outdated
|
||
* Wake Up the App: When a push notification is received, the NotificationServiceExtension will be triggered, waking up the app. | ||
|
||
* Connect with Breez SDK: Inside the extension, implement the logic to establish a connection with the Breez SDK which also runs the signer so the payment can be processed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: This is the first mention of the signer in the documentation. We should introduce this entire concept of having to be online in order to receive a payment in the documentation elsewhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I used different wording for now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Just needs the other languages.
snippets/rust/src/webhook.rs
Outdated
use std::sync::Arc; | ||
|
||
use anyhow::Result; | ||
use breez_sdk_core::InputType::LnUrlWithdraw; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line is not needed. Maybe add webhook
to main.rs
so the CI picks it up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks clear and concise.
No description provided.