Skip to content

Instantly share code, notes, and snippets.

@mjg123
Created September 24, 2020 16:55
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/02f0d2913f65196264a97507ab9b1d9b to your computer and use it in GitHub Desktop.
Save mjg123/02f0d2913f65196264a97507ab9b1d9b to your computer and use it in GitHub Desktop.
package com.twilio.demo;
import com.google.common.util.concurrent.ListenableFuture;
import com.twilio.Twilio;
import com.twilio.rest.api.v2010.account.Message;
import com.twilio.type.PhoneNumber;
public class SmsDemo {
public static void main(String[] args) {
Twilio.init(
System.getenv("ACCOUNT_SID"),
System.getenv("AUTH_TOKEN"));
ListenableFuture<Message> msg = Message.creator(
new PhoneNumber("+447723012710"),
new PhoneNumber("+44 7576 277909"),
"Hello from Twilio"
).createAsync();
try {
System.out.println(msg.get().getSid());
} catch (Exception e) {
e.printStackTrace();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment