Created
November 24, 2015 19:52
-
-
Save kwhinnery/0eebd17afd2f265a2479 to your computer and use it in GitHub Desktop.
How to test SSL cert changes on api.twilio.com:8443
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
var client = new TwilioRestClient( | |
"[YOUR_ACCOUNT_SID]", | |
"[YOUR_AUTH_TOKEN]", | |
"{YOUR_ACCOUNT_SID]", | |
"2010-04-01", | |
"https://api.twilio.com:8443/"); | |
var result = client.SendMessage("[FROM_PHONE_NUMBER]", "[TO_PHONE_NUMBER]", "Your system is ready for the upcoming change to the Twilio API's SSL certificate. No further action is needed"); |
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
// You may want to be more specific in your imports | |
import java.util.*; | |
import com.twilio.sdk.*; | |
import com.twilio.sdk.resource.factory.*; | |
import com.twilio.sdk.resource.instance.*; | |
import com.twilio.sdk.resource.list.*; | |
public class App { | |
// Find your Account Sid and Token at twilio.com/user/account | |
public static final String ACCOUNT_SID = "AC5ef872f6da5a21de157d80997a64bd33"; | |
public static final String AUTH_TOKEN = "[AuthToken]"; | |
public static void main(String[]args) throws TwilioRestException { | |
TwilioRestClient client = new TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN, "https://api.twilio.com:8443"); | |
// Build the parameters | |
List<NameValuePair> params = new ArrayList<NameValuePair>(); | |
params.add(new BasicNameValuePair("To", "+16518675309")); | |
params.add(new BasicNameValuePair("From", "+14158141829")); | |
params.add(new BasicNameValuePair("Body", "Your system is ready for the upcoming change to the Twilio API's SSL certificate. No further action is needed.")); | |
MessageFactory messageFactory = client.getAccount().getMessageFactory(); | |
Message message = messageFactory.create(params); | |
System.out.println(message.getSid()); | |
} | |
} |
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
// Twilio Credentials | |
var accountSid = 'AC5ef872f6da5a21de157d80997a64bd33'; | |
var authToken = '[AuthToken]'; | |
//require the Twilio module and create a REST client | |
var client = require('twilio')(accountSid, authToken, 'api.twilio.com:8443'); | |
client.messages.create({ | |
to: "+16518675309", | |
from: "+14158141829", | |
body: "Your system is ready for the upcoming change to the Twilio API's SSL certificate. No further action is needed." | |
}, function(err, message) { | |
console.log(message.sid); | |
}); |
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
from twilio.rest import TwilioRestClient | |
ACCOUNT_SID = "ACxxxxxxxx" | |
AUTH_TOKEN = "yyyyyyyyyyy" | |
TWILIO_NUMBER = "+15556667777" | |
NUMBER_TO_TEXT = "+12223334444" | |
client = TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN, base="https://api.twilio.com:8443") | |
client.messages.create(from_=TWILIO_NUMBER, to=NUMBER_TO_TEXT, body="Your system is ready for the upcoming change to the Twilio API's SSL certificate. No further action is needed.") |
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
require 'rubygems' # not necessary with ruby 1.9 but included for completeness | |
require 'twilio-ruby' | |
# put your own credentials here | |
account_sid = 'AC5ef872f6da5a21de157d80997a64bd33' | |
auth_token = '[AuthToken]' | |
# set up a client to talk to the Twilio REST API | |
@client = Twilio::REST::Client.new account_sid, auth_token | |
@client.host = 'api.twilio.com:8443' | |
@client.account.messages.create({ | |
:from => '+14158141829', | |
:to => '+16518675309', | |
:body => 'Your system is ready for the upcoming change to the Twilio API\'s SSL certificate. No further action is needed.' | |
}) |
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
curl -X POST 'https://api.twilio.com:8443/2010-04-01/Accounts/AC5ef872f6da5a21de157d80997a64bd33/Messages.json' \ | |
--data-urlencode 'To=+16518675309' \ | |
--data-urlencode 'From=+14158141829' \ | |
--data-urlencode 'Body=Your system is ready for the upcoming change to the Twilio API SSL certificate. No further action is needed.' \ | |
-u AC5ef872f6da5a21de157d80997a64bd33:[AuthToken] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment