Alphabetical sender id is not sending SMS by Twilio

0 down vote favorite I've setup the Twilio in salesforce to send the SMS. Twilio is configured perfectly.

The number on which I'm try to send the SMS is also in the supportable country list of alphanumeric sender id list. Country : Lebanon.

when i Put the From number is : like +1 45********. then I'm able to send the SMs. But when i put the From number is "CompanyName", then its not sending SMS.


The From phone number "CompanyName" is not a valid, SMS-capable inbound phone number or short code for your account.

Please Note: Alphanumeric Sender Id is enabled for my account. Also my account is upgraded.

my code is Below;

 global Static String sendOTP(string PhoneNo){
Integer rand = Math.round(Math.random()*100000);
string VerificationCode = string.valueOf(rand);
String smsBody='Your Verification code is : '+VerificationCode +'. Please don\'t reply.';
final String  fromNumber = '+14*******';  
//final String  fromNumber = 'Comapany'; //Not working
String account = '********';     // Account SID on home tab
String token   = '*****';  //AUTH Token on home tab
TwilioRestClient client = new TwilioRestClient(account, token);
if(PhoneNo != null)

     Map<String,String> params = new Map<String,String> {
    'To'   => PhoneNo, 
    'From' => fromNumber,
    'Body' => smsBody
     TwilioSMS sms = client.getAccount().getSMSMessages().create(params);
     return VerificationCode;
     catch(Exception e )
      return 'false';
return 'false';

Please suggest what is the wrong here.

  • This seems rather an issue with Twilio than Salesforce, so Id open a case with them. Have you tried any other way except the Apex Wrapper to send the very same SMS? My guess is Lebanon might not support the alpha numeric sender despite docs saying otherwise. Aug 17, 2017 at 10:00

2 Answers 2


As per the Twilio Support, twilio-salesforce helper library is unfortunately out-dated,thus it will not support the alphanumeric sender Id functionality.

But what you can do instead is use direct request in your code, which should use correct endpoint:

/ Add your Account SID and Auth token values below
String account_sid = 'ACxxxxxxxxxxxx';
String auth_token = 'xxxxxxxxxxxxxxxxx';

HttpRequest req = new HttpRequest();
req.setEndpoint('https://api.twilio.com/2010-04-01/Accounts/'+ account_sid 
req.setHeader('Content-Type', 'application/x-www-form-urlencoded');

Blob headerValue = Blob.valueOf(account_sid + ':' + auth_token);
String authorizationHeader = 'BASIC ' +

req.setHeader('Authorization', authorizationHeader);
req.setBody('To=%2145xxxxx&From=%2B145xxxxxx&Body=Testing ABC');

Http http = new Http();
HTTPResponse res = http.send(req);

This way you should be able to use also Alphanumeric sender ID!


If anyone is still struggling with the twilio-salesforce helper library, you can use the below code to achieve even with the Alpha numeric numbers using twilio open source helper library.

Use direct request in your code as follows,

TwilioRestClient client = new TwilioRestClient(AccountSid, AuthToken);
Map<String,String> params = new Map<String,String> {
    'To'   => toNumber,
    'From' => From Number,
    'Body' => body,
    'StatusCallback' => Status Callback URL

TwilioRestResponse response = client.request('https://api.twilio.com/2010-04-01/Accounts/'+ AccountSid +'/Messages.json', 'POST', params);

Map<String, Object> twilioResponse = (Map<String, Object>) JSON.deserializeUntyped(response.getResponseText());

System.debug(LoggingLevel.INFO, '<---The Twilio Rest Respons is--->' + response.getResponseText());

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .