Skip to content

Instantly share code, notes, and snippets.

@mjg123
Created May 2, 2019 11:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mjg123/cec329f5c8a0d61d2338a414d8e2c04e to your computer and use it in GitHub Desktop.
Save mjg123/cec329f5c8a0d61d2338a414d8e2c04e to your computer and use it in GitHub Desktop.
CodeCard Java SMS
// 1. Sign up -> twilio.com/try-twilio
// 2. Get a number -> twilio.com/console
// 3. Add the Twilio Java library
// --> twilio.com/docs/libraries/java
import com.twilio.Twilio;
import com.twilio.rest.api.v2010.account.Message;
import com.twilio.type.PhoneNumber;
class SendSms {
public static void main(String[] s) {
// 4. Initialize the Twilio client
Twilio.init(
System.getenv("ACCOUNT_SID"),
System.getenv("AUTH_TOKEN"));
// 5. Send an SMS
Message.creator(
new PhoneNumber("DESTINATION"),
new PhoneNumber("TWILIO_NUMBER"),
"Twit-Twoo Welcome to Twilio :)")
.create();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment