Sending an SMS
To send an SMS, replace the following variables in the example below:
| 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). |
VONAGE_BRAND_NAME | The alphanumeric string that represents the name or number of the organization sending the message. |
TO_NUMBER | The phone number you are sending the message to. |
Run your code
Save this file to your machine and run it:
Prerequisites
Create a file named send.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 file named SendMessage 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.sms with the package containing SendMessage:
Prerequisites
Add the following to build.gradle:
Create a file named SendMessage 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.sms with the package containing SendMessage:
Prerequisites
Create a file named SendSms.cs and add the following code:
Add the following to SendSms.cs:
Prerequisites
Create a file named send-sms.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 send.rb and add the following code:
Run your code
Save this file to your machine and run it:
Note: To include a new line in the message, see the documentation for Concatenation and Encoding
Try it out
When you run the example above, the text message will be sent to the mobile number that you specified.