Skip to content

Sample code for sending an SMS message using Node.js and Express with the Vonage SMS API

Notifications You must be signed in to change notification settings

nexmo-community/send-sms-nodejs-express

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Send SMS Messages with Node.js and Express

Sample code for sending an SMS message using Node.js and Express with the Vonage SMS API.

For a step-by-step tutorial, follow along the accompanying article.

Running Instructions

  1. Clone this repository.

  2. Run npm install in your project folder.

  3. Provide string values for the environment variables in the .env file.
    Find your API key and secret in your Vonage Dashboard. You can choose a virtual number from the Your Numbers section.

  4. Run node index.js.

  5. Use Postman or a similar service to make a POST request to https://localhost:3000/send with the following JSON object in the request body:

{
    "toNumber": "YOUR_MOBILE_PHONE_NUMBER",
    "message": "Taco tracks on every corner! 🌮🌮"
}

Replace YOUR_MOBILE_PHONE_NUMBER with your personal number in E. 164 format, for example: 447401234567.

About

Sample code for sending an SMS message using Node.js and Express with the Vonage SMS API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published