Using Webhooks
Registering a webhook API docs
Once your vendor NDS is set up and can accept POST requests from the SDK services, you can within your main application register the webhook URL with the Breez SDK by calling the register webhook API as follows:
let url =
"https://your-nds-service.com/api/v1/notify?platform=<ios|android>&token=<PUSH_TOKEN>".to_string();
sdk.register_webhook(url).await?;
let url = "https://your-nds-service.com/api/v1/notify?platform=<ios|android>&token=<PUSH_TOKEN>"
try sdk.registerWebhook(webhookUrl: url)
try {
val url = "https://your-nds-service.com/api/v1/notify?platform=<ios|android>&token=<PUSH_TOKEN>"
sdk.registerWebhook(url)
} catch (e: Exception) {
// Handle error
}
try {
const url = 'https://your-nds-service.com/api/v1/notify?platform=<ios|android>&token=<PUSH_TOKEN>'
await registerWebhook(url)
} catch (err) {
console.error(err)
}
String url = "https://your-nds-service.com/api/v1/notify?platform=<ios|android>&token=<PUSH_TOKEN>";
await breezSDK.registerWebhook(webhookUrl: url);
url = "https://your-nds-service.com/api/v1/notify?platform=<ios|android>&token=<PUSH_TOKEN>"
sdk_services.register_webhook(webhook_url=url)
url := "https://your-nds-service.com/api/v1/notify?platform=<ios|android>&token=<PUSH_TOKEN>"
err := sdk.RegisterWebhook(url)
if err != nil {
log.Printf("Webhook register failed: %v", err)
return err
}
try
{
var url = "https://your-nds-service.com/api/v1/notify?platform=<ios|android>&token=<PUSH_TOKEN>";
sdk.RegisterWebhook(url);
}
catch (Exception)
{
// Handle error
}
When the NDS receives a POST request for the registered webhook URL, it will forward the request data via push notification to the applications Service Extension (iOS) or Foreground Service (Android) to be handled by the Notification Plugin.
Unregistering a webhook API docs
When a webhook is no longer needed or the webhook URL has changed such that it needs unregistering (for example, the token is valid but the locale changes), you can call the unregister webhook API as follows:
let url =
"https://your-nds-service.com/api/v1/notify?platform=<ios|android>&token=<PUSH_TOKEN>".to_string();
sdk.unregister_webhook(url).await?;
let url = "https://your-nds-service.com/api/v1/notify?platform=<ios|android>&token=<PUSH_TOKEN>"
try sdk.unregisterWebhook(webhookUrl: url)
try {
val url = "https://your-nds-service.com/api/v1/notify?platform=<ios|android>&token=<PUSH_TOKEN>"
sdk.unregisterWebhook(url)
} catch (e: Exception) {
// Handle error
}
try {
const url = 'https://your-nds-service.com/api/v1/notify?platform=<ios|android>&token=<PUSH_TOKEN>'
await unregisterWebhook(url)
} catch (err) {
console.error(err)
}
String url = "https://your-nds-service.com/api/v1/notify?platform=<ios|android>&token=<PUSH_TOKEN>";
await breezSDK.unregisterWebhook(webhookUrl: url);
url = "https://your-nds-service.com/api/v1/notify?platform=<ios|android>&token=<PUSH_TOKEN>"
sdk_services.unregister_webhook(webhook_url=url)
url := "https://your-nds-service.com/api/v1/notify?platform=<ios|android>&token=<PUSH_TOKEN>"
err := sdk.UnregisterWebhook(url)
if err != nil {
log.Printf("Webhook unregister failed: %v", err)
return err
}
try
{
var url = "https://your-nds-service.com/api/v1/notify?platform=<ios|android>&token=<PUSH_TOKEN>";
sdk.UnregisterWebhook(url);
}
catch (Exception)
{
// Handle error
}