A Salesforce/Force.com library for communicating with the Twilio REST API and generating TwiML. Need help? Post your questions to http://getsatisfaction.com/twilio or email us at help@twilio.com
Hi,
Following is piece of my code. When this code is executed, I am getting Script-thrown exception. Any idea what could be wrong config/code here ? I am setting correct 'accountId' & 'authToken' value.
private static TwilioSMS twilioSms;
//Creating Twilio Client
TwilioRestClient client = new TwilioRestClient(accountId, authToken);
//Adding parameters to send in SMS
Map<String,String> params = new Map<String,String>();
params.put('To',phoneNumber);
params.put('From',fromPhone);
params.put('Body',textMessage);
try{
twilioSms = null;
twilioSms = client.getAccount().getSMSMessages().create(params);
System.debug(LoggingLevel.Error,'SMS Sent '+twilioSms);
}catch(Exception e){
String exceptionMessage = 'Exception Message: ' + e.getMessage();
exceptionMessage += '\nTwilio Client Info: ' + client;
exceptionMessage += '\nTwilio Params Passed: ' + params;
System.debug(LoggingLevel.ERROR,'Error: '+ exceptionMessage);
throw new SmsException(exceptionMessage);
}