Created
May 2, 2019 11:56
-
-
Save mjg123/7341da6483bdb73c55f982849af73a75 to your computer and use it in GitHub Desktop.
Code Card Java
This file contains 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
// 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.Call; | |
import com.twilio.type.PhoneNumber; | |
import java.net.URI; | |
import java.net.URISyntaxException; | |
class MakeACall { | |
public static void main(String[] s) | |
throws URISyntaxException { | |
// 4. Initialize the Twilio client | |
Twilio.init( | |
System.getenv("ACCOUNT_SID"), | |
System.getenv("AUTH_TOKEN")); | |
// 5. Make a call | |
Call.creator( | |
new PhoneNumber("DESTINATION"), | |
new PhoneNumber("TWILIO_NUMBER"), | |
new URI("http://demo.twilio.com/docs/voice.xml")) | |
.create(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment