Created
September 24, 2020 16:55
-
-
Save mjg123/d66353988187c8fbca179f05d1230c58 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | |
// do other stuff here while the message is sending | |
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