Skip to content

Files

Latest commit

acb7278 · Sep 15, 2021

History

History
This branch is 2 commits ahead of, 92 commits behind Azure-Samples/communication-services-java-quickstarts:main.

send-sms-quickstart

page_type languages products
sample
Java
azure
azure-communication-sms

Create and manage access tokens

For full instructions on how to build this code sample from scratch, look at Quickstart: Send an SMS message

Prerequisites

Code Structure

  • ./send-sms-quickstart/src/main/java/com/communication/quickstart/App.java: contains code for creating and managing access tokens.
  • pom.xml: Project's Project Object Model, or POM.

Before running sample code

  1. 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.
  2. git clone https://github.com/Azure-Samples/communication-services-java-quickstarts.git
  3. With the Communication Services procured in pre-requisites, add connection string in the code at line no 24 String connectionString = "ACS_Connection_String";.
  4. With the SMS enabled telephone number procured in pre-requisites, add it to the App.java file. Assign your ACS telephone number and sender numbers at line 46 and 47.

Run the code

  1. Navigate to the directory containing the pom.xml file and compile the project by using command mvn compile.
  2. Build the package using command mvn package.
  3. Run the command to execute the app mvn exec:java -Dexec.mainClass="com.communication.quickstart.App" -Dexec.cleanupDaemonThreads=false.