diff --git a/README.md b/README.md
index e7cd74a..9ed869b 100644
--- a/README.md
+++ b/README.md
@@ -24,6 +24,7 @@ All the parameters required to run the demo can be provided through environment
- `VONAGE_APPLICATION_ID`: Vonage application UUID.
- `VONAGE_PRIVATE_KEY_PATH`: Absolute path to the private key associated with your Vonage application.
- `VCR_PORT`: Port to run the demo on. By default, this is `8080`.
+- `VONAGE_SERVER_URL`: The public base URL for the application. For example, this might be your ngrok instance URL.
Other parameters can be provided for convenience or defaults for pre-populating certain fields. These are:
@@ -40,9 +41,16 @@ If you have [IntelliJ IDEA](https://www.jetbrains.com/idea/) installed, you can
and run it through the IDE, where the entry point is the `Application` class
(src/main/java/com/vonage/sample/serversdk/springboot/Application.java).
-To run the demo standalone from the command line, do `mvn install spring-boot:run`.
+To run the demo standalone from the command line, simply invoke `mvn` or `./mvnw` if you don't have it installed.
Then open a browser to [localhost:8080](http://localhost:8080) to use the application.
+The default Maven goal for this project is `spring-boot:run`. To ensure a full build, you can use `mvn clean install`.
+
+On startup, your Vonage application will be updated with the webhook URLs for the demo.
+This is so that you don't have to manually set the webhook URLs on the dashboard every time you restart
+ngrok (or your preferred HTTP tunneling service). You can verify this manually by checking the application
+from [the Vonage dashboard](https://dashboard.nexmo.com/applications).
+
### Maven and Gradle
As a demo application, this project uses Maven, however it can be adapted to work with Gradle too.
You can use the Maven wrapper by invoking `./mvnw`. For a local installation, you can download this
diff --git a/pom.xml b/pom.xml
index af71a90..2314885 100644
--- a/pom.xml
+++ b/pom.xml
@@ -54,7 +54,7 @@
com.vonage
server-sdk
- 8.11.0
+ 8.12.0
org.springframework.boot
diff --git a/src/main/java/com/vonage/sample/serversdk/springboot/ApplicationStartup.java b/src/main/java/com/vonage/sample/serversdk/springboot/ApplicationStartup.java
index 46a513e..4cec8ef 100644
--- a/src/main/java/com/vonage/sample/serversdk/springboot/ApplicationStartup.java
+++ b/src/main/java/com/vonage/sample/serversdk/springboot/ApplicationStartup.java
@@ -24,6 +24,7 @@
import com.vonage.client.application.Application;
import com.vonage.client.application.ApplicationResponseException;
import com.vonage.client.application.capabilities.Messages;
+import com.vonage.client.application.capabilities.NetworkApis;
import com.vonage.client.application.capabilities.Verify;
import com.vonage.client.application.capabilities.Voice;
import com.vonage.client.common.HttpMethod;
@@ -61,6 +62,11 @@ public void init() {
var application = ac.updateApplication(
Application.builder(existing)
.improveAi(true)
+ .addCapability(NetworkApis.builder()
+ .redirectUri(resolveEndpoint(NUMBER_VERIFICATION_REDIRECT_ENDPOINT).toString())
+ .networkApplicationId(existing.getCapabilities().getNetworkApis().getNetworkApplicationId())
+ .build()
+ )
.addCapability(Verify.builder()
.addWebhook(Webhook.Type.STATUS, buildWebhook(VERIFY_STATUS_ENDPOINT)).build()
).addCapability(Messages.builder()
diff --git a/src/main/java/com/vonage/sample/serversdk/springboot/NumberVerificationController.java b/src/main/java/com/vonage/sample/serversdk/springboot/NumberVerificationController.java
index a3a87ed..c9df62d 100644
--- a/src/main/java/com/vonage/sample/serversdk/springboot/NumberVerificationController.java
+++ b/src/main/java/com/vonage/sample/serversdk/springboot/NumberVerificationController.java
@@ -28,6 +28,7 @@
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.view.RedirectView;
import java.net.URI;
+import java.util.UUID;
@Controller
public final class NumberVerificationController extends VonageController {
@@ -53,7 +54,7 @@ public RedirectView buildVerificationUrl(@ModelAttribute NumberVerificationParam
var redirectUrl = getServerUrl().resolve(NUMBER_VERIFICATION_REDIRECT_ENDPOINT);
try {
nvParams.url = getNumberVerificationClient().initiateVerification(
- nvParams.msisdn, redirectUrl, nvParams.msisdn
+ nvParams.msisdn, redirectUrl, UUID.randomUUID().toString().replace("-", "")
);
model.addAttribute(NUMBER_VERIFICATION_PARAMS_NAME, nvParams);
return new RedirectView(nvParams.url.toString());