Update a Number
This page shows you how to programmatically update the configuration settings for one of your numbers.
You can also update these settings online, using the developer dashboard. Select the "Your Applications" option from either the "Voice" or "Messages and Dispatch" menu. Or, you can use the Vonage CLI.
Replace the following variables in the sample code with your own values:
| Key | Description |
|---|---|
VONAGE_API_KEY | Your Vonage API key (see it on your dashboard). |
VONAGE_API_SECRET | Your Vonage API secret (also available on your dashboard). |
COUNTRY_CODE | The two digit country code for the number. For example: |
VONAGE_NUMBER | Your Vonage Number. E.g. |
SMS_CALLBACK_URL | An URL-encoded URI to the webhook endpoint that handles inbound messages. Your webhook endpoint must be active before you make this request. Vonage makes a GET request to the endpoint and checks that it returns a 200 OK response. Set this parameter's value to an empty string to remove the webhook. |
VONAGE_APPLICATION_ID | The ID of the application that handles inbound traffic to this number. |
VOICE_CALLBACK_TYPE | The Voice API webhook type: |
VOICE_CALLBACK_VALUE | A SIP URI, telephone number or Application ID, depending on |
VOICE_STATUS_URL | A webhook URL for Vonage to POST Voice API status updates to |
Run your code
Save this file to your machine and run it:
Prerequisites
Create a file named update.js and add the following code:
Run your code
Save this file to your machine and run it:
Prerequisites
Add the following to build.gradle:
Create a class named UpdateNumber and add the following code to the main method:
Run your code
We can use the application plugin for Gradle to simplify the running of our application. Update your build.gradle with the following:
Run the following gradle command to execute your application, replacing com.vonage.quickstart.kt.numbers with the package containing UpdateNumber:
Prerequisites
Add the following to build.gradle:
Create a class named UpdateNumber and add the following code to the main method:
Run your code
We can use the application plugin for Gradle to simplify the running of our application. Update your build.gradle with the following:
Run the following gradle command to execute your application, replacing com.vonage.quickstart.numbers with the package containing UpdateNumber:
Prerequisites
Create a file named UpdateNumber.cs and add the following code:
Add the following to UpdateNumber.cs:
Prerequisites
Create a file named update.php and add the following code:
Run your code
Save this file to your machine and run it:
Prerequisites
Run your code
Save this file to your machine and run it:
Prerequisites
Create a file named update.rb and add the following code:
Run your code
Save this file to your machine and run it: