Send an SMS Message Quickstart
For full instructions on how to build this code sample from scratch, look at Quickstart: Send an SMS Message
Prerequisites
- An Azure account with an active subscription. Create an account for free.
- Visual Studio Code on one of the supported platforms.
- Node.js, Active LTS and Maintenance LTS versions (10.14.1 recommended). Use the
node --versioncommand to check your version. - An active Communication Services resource and connection string. Create a Communication Services resource.
- An SMS enabled telephone number. Get a phone number.
Code Structure
- ./send-SMS/send-sms.js: Core application code with send SMS implementation.
Before running sample code
- Open an instance of PowerShell, Windows Terminal, Command Prompt or equivalent and navigate to the directory that you'd like to clone the sample to.
git clone https://github.com/Azure-Samples/Communication-Services-javascript-quickstarts.git- With the
Connection Stringprocured in pre-requisites, follow instructions to add it to your environment variables. - With the SMS enabled telephone number procured in pre-requisites, add it to the send-SMS/send-sms.js file. Assign your telephone number in line 7:
from: "<from-phone-number>", - Add a phone number to send the SMS to in line 8:
to: ["<to-phone-number-1>", "<to-phone-number-2>"],
Run Locally
- Run the app using
node send-sms.js