Developers are encouraged to view the Quick Starts, including screencasts, on Github: See Sending your first SMS
Nexmo’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.
You will need:
- Nexmo account
- API key and your API secret from the Nexmo Dashboard
- The phone number you registered with, will act as the destination number. Note: whilst 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.
- SenderID, which is the From: information that will appear on the recipient’s handset. For U.S. 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.
1. 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:
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 using our Country Specific Knowledge Base.
2. 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.
(Older accounts will have [Nexmo DEMO] in your SMS instead of [FREE SMS DEMO, TEST MESSAGE] ).
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:
3. Put it all together
Now, copy the below link, paste it into the address box of your favorite web browser, and replace values with your actual API key, API secret, SenderID, destination number, and message body into this URL. Upon hitting "Enter" you should receive a text almost immediately.
Congratulations! You've just sent your first text using the Nexmo API.
- Use scripts to send large volumes of messages from your server using pre-built libraries.
- Set up your Webhook URL and your “API Settings” in your Nexmo Dashboard to receive delivery receipts.
- Receive inbound messages using a Nexmo long virtual number.
- Check out projects such as Voice API, Verify or Number Insight.