What would be the approach to create an SMS application (either in Salesforce or other language) to send SMS from Salesforce? Is it feasbile if the client-side process is done through a streaming API (from the client side)?


A number of companies provide SMS services that you pre-pay for and invoke using a REST API. To send an SMS is usually quite simple e.g.:

private static final String ENDPOINT = 'https://api.twilio.com';
private static final String VERSION = '2010-04-01';

public void send(String toNumber, String message) {

    // Custom setting containing SMS service information
    SmsConfiguration__c config = SmsConfiguration__c.getInstance();

    HttpRequest req = new HttpRequest();
    req.setHeader('X-Twilio-Client', 'salesforce-' + VERSION);
    req.setHeader('User-Agent', 'twilio-salesforce-' + VERSION);
    req.setHeader('Accept', 'application/json');
    req.setHeader('Authorization', 'Basic '+ EncodingUtil.base64Encode(Blob.valueOf(
            config.AccountSid__c + ':' + config.AuthToken__c)));
    req.setEndpoint(ENDPOINT + '/' + VERSION + '/Accounts/' + config.AccountSid__c
            + '/SMS/Messages');
           + 'From=' + EncodingUtil.urlEncode(config.FromNumber__c, 'UTF-8')
           + '&To=' + EncodingUtil.urlEncode(toNumber, 'UTF-8')
           + '&Body=' + + EncodingUtil.urlEncode(message, 'UTF-8')
    HttpResponse res = new Http().send(req);
    if (res.getStatusCode() >= 200 && res.getStatusCode() < 300) {
        // OK
    } else {
        // Error

You could expose your own simple @RestResource endpoint that you call from the client side to in turn call the above code on the server:

global with sharing class SmsRest {
    global static void doPost(String toNumber, String message) {
        new SmsSender().send(toNumber, message);

or that could say accept the ID of the Contact to send to and query to get the number and then send.

  • Keith -- shouldn't the last line read new SmsSender().sendSms(toNumber, message); ?
    – cropredy
    Oct 28 '14 at 4:45
  • @crop1645 Yep - thanks I'll change it.
    – Keith C
    Oct 28 '14 at 8:11
  • 1
    In addition to Twilio like others have suggested, there's also an excellent app exchange app called "SMS Magic" As one of the first implementers of the package, had a few kinks to work out in our instance, but their support was responsive and the package worked very well. Linky: appexchange.salesforce.com/… Oct 28 '14 at 14:33
  • 1
    @manza I've added those to the code.
    – Keith C
    Apr 25 '16 at 9:14
  • 1
    @Rob Thanks I've fixed. Note that you probably have enough points to make such edits yourself.
    – Keith C
    Apr 25 '16 at 12:42

I built a solution for an NPO using Twilio - you can see the code on GitHub

Twilio has a pre-built library for Salesforce that enables you to invoke their REST API for sending messages that the code above takes advantage of.


You may want to cast a glance at 360 SMS App. The app allows users to send single and/or bulk SMS to Contacts, Leads or Custom Object and possesses wide array of functionalities like Auto forwarding, Un Subscribe, Messages in Inbox, Call Routing, Automated Transactional Messages, Easy Template Creation and Many more. For detailed Information, you can visit the following link: https://appexchange.salesforce.com/listingDetail?listingId=a0N3000000DpSyIEAV


You can use built in libraries like TWILIO API,@BritishBoyinDC has specified. I have used the twilio in SFDC last 6 month it working fine.It receive SMS from the customer's and send SMS to Customers dynamically.Can you Rererences of this post .

Install the packages:https://login.salesforce.com/?ec=302&startURL=%2Fpackaging%2FinstallPackage.apexp%3Fp0%3D04ti0000000XkE0


If you know the provider of the person you're sending the text to you can just send an email

Step 1: Using the email client of your choice, compose your email as you would normally. You can use either your smartphone or your computer to do so.

Step 2: Instead of entering an email address in the recipient box, insert the 10-digit phone number of the person you’re trying to reach.

Step 3: Once entered, tack on the appropriate “@gateway” address behind it. Below, we’ve put together a list of some of the most common service providers in the United States and their corresponding gateway addresses.

This would save you from having to go through a paid service like Twilio


You can check Girikon Smart SMS App which allows its user to send Single / Bulk SMS / MMS messages from the Salesforce.


You can check Salesforce SMS APP by Girikon- Smart SMS App which allows its user to send Single / Bulk SMS / MMS messages from the Salesforce.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.