Getting Started Sending SMS Getting Started Sending SMS

Getting Started Sending SMS

Nexmo Support

Overview

Developers are encouraged to view the Quick Starts, including screencasts, on Github: See Sending your first SMS.

Vonage's RESTful API connects you to carriers in over 200 countries around the world. It's easy to use and takes just minutes to connect.

Before You Begin

You will need:

  • A Vonage API account.
  • API key and your API secret from the Vonage API account dashboard.
  • The phone number you registered with, will act as the destination number. Note: While your account is in trial mode, you will only be able to send test messages to a maximum of 5 test numbers that you have verified on your own.
  • Sender ID, which is the From information that will appear on the recipient’s handset. For US and Canadian destinations this must be a pre-approved phone number, which we will have provided you automatically when you sign up. SMS Features Overview (Outbound) will provide more information on the Sender ID restrictions per the Country regulations.

Format your Destination Number

Make sure you format your mobile number correctly, with the country code and without spaces or plus signs or leading zeros. Here is an example of how a number should be formatted:

Screen_Shot_2021-10-29_at_11.24.04_AM.png

This is the format for any destination number that will receive SMS from your application, both local and international. Be sure to verify local carrier restrictions for any messages you would like to send by reviewing our Country-Specific Features and Restrictions articles.

Prepare your Message

Now it’s time to compose your message body. For your first message, we suggest you send plain text. Note that until you have made your first top-up we will include [FREE SMS DEMO, TEST MESSAGE] in your SMS.

As with all parameters, your message body must always be URL encoded. For type=unicode message body should be also UTF8 encoded (URL and UTF8).  Simply plug your message body into this website to format it properly: http://www.string-functions.com/urlencode.aspx.

Put It All Together

Now, copy the below link, paste it into the address bar of your favorite web browser, and replace values with your actual API key, API secret, Sender ID, destination number, and message body into this URL. Upon hitting Enter you should receive a text almost immediately.

https://rest.nexmo.com/sms/xml?api_key=xxxxx&api_secret=xxxxxx&from=senderID&to=destination_number&text=messagebody

Congratulations! You've just sent your first text using the Vonage API.

Additional Information