This is a guest post from Adam Marks.

A fairly common request that I get is, “how can I send my users/customers’ text messages from Salesforce?” There are apps on the app exchange that can do this, as well as Apex solutions too. Both of those approaches typically come with an additional cost, though. If you want to impress your users and save the day with a declarative option, well you are in luck, because I just so happen to have one!

Let’s look at our use case here:

When a critical field is updated on an Account, I want to send a notification to the Account owner via text.

Pretty straightforward, right? If you already know how to create E-mail alert Workflow rules then it will be pretty easy to set this up too. We won’t be detailing the full solution here, instead  we’re just focusing on what you need to do to generate your Email to SMS Address. Let’s begin by outlining the basic steps:

  1. Create a new e-mail field on User named Email to SMS Address.
  2. Create a new picklist field on User named Cell Carrier. Your list options can be any carrier that is local to you or that your business uses. We will have several in our example below.
  3. Create a field update workflow rule that updates the Email to SMS Address field you created

That’s it, just 3 easy steps!

Let’s do a deeper dive into the workflow rule that will create your SMS email address.

I start by creating a new workflow rule on the User object and name it SMS Email create. Quick note before we go much further I am doing this on User, but you could do this same process on Lead or Contact or anywhere in the system you are capturing a mobile number. The steps, logic and syntax remain mostly the same. Just use your object instead of User. In my rule, I decided to go with logic that updates the Email to SMS Address field when:

  1. a record is new AND
    1. the mobile number field is not blank AND
    2. the cell carrier field is not blank

OR

  1. the record is edited AND
    1. the mobile number field is changed OR
    2. the cell carrier field is changed

I would also recommend adding a validation rule that enforces if a mobile number is entered, a cell carrier must also be selected and vice versa.

Here is my syntax for the rule entry criteria:

syntax rule criteria
Now let’s get into the field update action. For reference, you may be wondering what values work in the Cell Carrier pick list. Here are some examples:

cell carrier picklist

If you have any smaller regional carriers you could use them too, but only if you can find their Email to SMS address domain. Speaking of Email to SMS address domains, now is a good time to take a peek behind the curtain and explain exactly how this whole thing works.

Each cell carrier has an address that can be used to send an email to a phone via text. The specific syntax for each carrier’s domain will vary but most of them are available online. For example, if you have Verizon then your domain is @vtext.com. So if my number was 804-867-5309 (it’s not by the way!)  then my Email to SMS address would be 8048675309@vtext.com.

The field update action is taking the user’s cell phone number, extracting the special characters, and then mashing it up with the corresponding carrier’s Email to SMS address.

Let’s look at the syntax.

field update action syntax

The substitute function is finding the “special” characters (dashes, spaces, commas, etc) and effectively deleting them. Once that has been done we use a Case statement to determine which Carrier is selected and insert the corresponding Email to SMS address domain. Pretty easy, right?

Once the field update fires, you should now have your Email to SMS field populated with the correct address. At that point, you are ready to send your first text!

Now you can create your email alert template(s) and additional Workflow rule(s) and then test them out. When a user/contact gets a text it will be formatted something like this:

text message example

The part before the forward slash (“/”) is the subject, and everything after is the body. Remember when creating your email templates that these are text messages, so brevity is going to be your friend here!

That’s it – you are now ready to send text messages out of Salesforce via Email Alert Workflow rules. All in all, pretty easy I think, and pretty cool too!

About Adam Marks

Like many others, I stumbled into Salesforce purely by chance over 5 years ago. The company I was working for bought Sales Cloud but had no idea what they were going to do it. Suffice to say once I got involved, I never looked back. The power and flexibility of the platform coupled with the speed at which you can accomplish goals is unparalleled in any other technology I have worked with. In addition to being a Salesforce MVP and fanatic, I also am a senior Salesforce and cloud technologies consultant with RTS Labs in Richmond Virginia.

Follow on Twitter.

58 thoughts on “ Send Text Alerts From Salesforce Using Email to SMS ”

  1. This is a great post. An issue that I’m struggling with is the amount of text messages customers send to my sales and service teams. I haven’t had much luck in finding an easy solution to get those texts documented in SF. Would love to hear ideas/solutions 🙂 Considering that I want to be an Admin Hero when I grow up, I really love this site!

    Like

    1. Hi Jessica! This is a really interesting situation. I haven’t had customers contacting reps directly via text message. I don’t know of a quick and easy way to get this done except to have them copy the text message and past it into Salesforce1 task or “Log a Call.” If I find a different solution, I’ll let you know!

      Like

  2. This is amazing!! Thank you for posting this solution! However I am receiving the following formula error:

    Error: Function ISNEW may not be used in this type of formula.

    Here is my code:

    OR(
    AND(
    ISNEW(),
    NOT(ISBLANK( Mobile_Phone__c ) ),
    NOT(ISBLANK( TEXT( Cell_Carrier__c ) ) ) ),
    OR(
    ISCHANGED( Mobile_Phone__c ),
    ISCHANGED( Cell_Carrier__c ) ) )

    Like

        1. You’re welcome!
          I’ve already tried this workflow rule in my Developer ORG, however I didn’t get the Email to SMS in Mexico (Telcel from America Movil), but this is a great post!

          Thank you!

          Like

  3. Thanks for this feature.

    Question: When using an Email Alert — how do I get the email to go to the “Email to SMS” address — not the primary email address?

    NOTE: I looked up a few other Cell Carrier email/text addresses:

    “CellCom”,”@cellcom.quiktxt.com”,
    “Cricket”,”@sms.mycricket.com”,
    “Metro PCS”,”@mymetropcs.com”,
    “TracFone”,”@mmst5.tracfone.com”,

    Thanks.

    Like

    1. Hi Brian! It depends on the object that the workflow rule is being created on. If you want to send an alert to the Opportunity Owner for example, create a hidden email field on the Opportunity record and create a field update workflow rule to populate the SMS email from the user record. This opportunity-based email field can then be used as the recipient email address in your SMS alert workflow. I hope that helps!

      Like

      1. Hi Brent, is it possible to send texts to specific user(s)/Groups if I create a new Account, for example? It seems that would just send to the Account owner. Also, how do you fire the field update? I set this up on User but nothing happened, but then I updated cell carrier and the Email to SMS field was populated. Sorry, a bit new to this!

        Like

        1. Hi Aron! The email to SMS address will be unique by user based on their specific phone number and carrier. Because it’s tied to a specific user in Salesforce, you may not be able to create a group. I would have to play with that to validate it. The field update you may have seen in the comments thread is it’s own workflow. The idea would be to bring in the email to SMS address to a record (such as an Opportunity or custom object) in order to use the SMS email address to trigger the email alert. This is done as a totally seprate workflow rule with a field update action. The update would be the SMS email address from the user record.

          Like

          1. Thanks Brent, I think I understand the basics, but please correct me if I am mistaken. So Workflow rule would populate the SMS Email field in Opportunity based on SMS Email of the User (owner) for all Opportunities, and then changes could be sent via text? If so, I might try figuring out how to set that up!

            Like

  4. This is to piggy back on Jessica’s question above: how would you go about dealing with users who want to Opt Out of SMS messages sent through SF? And how would those opt outs be translated back to Salesforce via a response to the SMS?

    This really is an amazing site! #AdminHeroRules

    Like

    1. Opt out is a great point Kari! I suppose you could create a checkbox on the user record that would allow the user to opt out of these alerts, but it would probably have to be updated manually. If I can think of a way to automate that, I’ll post an update!

      Like

  5. Works like a charm!

    I had never used the full power of “Recipient Type” in the Email Alert config before.

    Thanks for the insight!

    BFey

    Like

  6. This is an amazingly useful post! Big shout to to Adam Marks for a cool solution.

    I was able to take this concept and automatically send SMS alerts to a Contact when Conga Composer merges and emails a document to them. Works like a charm!

    Like

  7. Excellent! but I can’t get it to work. I tested the format of sending an email from one phone to another using 1112223333@vtext.com and the text comes in (good). Then I added an email field to a simple object and filled in the same text, created a simple text template (no embedded fields), created a workflow rule to send the email to that address and update another field on the form just to be sure the rule was running. The field gets updated on save but the text message never arrives. What am I missing?

    Like

    1. My bad…I was trying this in our sandbox that had “Access to Send Emails” = System Emails, changed to All Emails and this works GREAT…Thanks!

      Like

      1. I just updated the field update formula value to accommodate the following mobile format:
        +1 5034440579

        Replaced: SUBSTITUTE(MobilePhone, “(“, “”), “)”, “”), ” ” , “”), “-“, “”)&

        With: SUBSTITUTE(MobilePhone, “+1 “, “”), “(“, “”), “) ” , “”), “-“, “”)&

        Like

  8. This looks like a great solution. But I don’t think our Leads will want to tell me their provider. Any advice on how to get that info?

    Like

    1. Extend this functionality by using Twilio number lookup API to get the carrier name for the number and match it with list of preset carrier name – domain name pair in custom settings. 🙂

      Like

  9. I am stuck with adding this email alert to my workflow rule. When I am choosing the “Recipient Type”, it doesn’t give me an option to select the newly created Email Address field.

    Like

  10. I’m having the same problem as Ann. I can’t seem to access the newly created field for my workflow. I want to write the workflow so that when the “status” of a campaign member is set to a certain picklist option, the user gets a text message. So, the workflow rule is evaluating against the campaign member object. I created a User lookup field on the campaign member object to indicate when someone wants to get an alert through this process, but I’m not sure how to get the workflow to choose the correct email address on the user object.

    Like

    1. Jeremy,

      Campaign member is a junction that allows you to pull in related Leads and Contacts, not Users. You would need fields on both Contact and Lead with workflows to create the SMS email on each object independently. The example I wrote just covers SMS text to users but could be applied to any person object (Lead, Contact or even a custom object!)

      Like

  11. I’m having trouble opening up the syntax editor on the New Custom Email Field. I am the admin of my account, do I need to unlock a permission or something? Or do I need to create a custom formula field instead of an Email field?

    Like

    1. I figured out how to open up the rule criteria code box, now I’m trying to figure out where to put the second syntax example. The one starting with SUBSTITUTE. Does that go right below the first piece of code?

      This is what my code looks like:

      OR(
      AND(
      ISNEW(),
      NOT(ISBLANK(MobilePhone)),
      NOT(ISBLANK( TEXT(Cell_Carrier__c)))),
      OR(
      ISCHANGED(MobilePhone),
      ISCHANGED(Cell_Carrier__c)))

      SUBSTITUTE(
      SUBSTITUTE(
      SUBSTITUTE(
      SUBSTITUTE (Mobile Phone, ” (“, “”) , “) “, “”), ” “, “”), “-“, “”)&
      CASE(TEXT( Cell_Carrier__C),
      “Alltel”,”@message.alltel.com”,
      “ATT&T”,”@txt.att.net”,
      “Boost Mobile”,”@myboostmobile.com”,
      “Sprint”,”@messaging.sprintpcs.com”,
      “T-Mobile”,”@tmomail.net”,
      “US Cellular”,”@email.uscc.net”,
      “Verizon”,”@vtext.com”,
      “Virgin Mobile”,”@vmobl.com”,
      NULL)

      Like

  12. Hey Josh! Those are two separate items. The first bit of syntax is for your rule entry criteria. The second is for your field update action. Create your WFR and in the rule entry criteria set it to evaluate a formula and then paste in:
    OR(
    AND(
    ISNEW(),
    NOT(ISBLANK(MobilePhone)),
    NOT(ISBLANK( TEXT(Cell_Carrier__c)))),
    OR(
    ISCHANGED(MobilePhone),
    ISCHANGED(Cell_Carrier__c)))

    Then click next to take you to a screen to add an action to your rule. Create an update field action and then use the other syntax to define the logic to update the SMS Email field you created.

    Hopefully that helps!

    Like

  13. Thanks for this post! My use case is slightly different: We’d like a way to send texts to clients when there are service interruptions. Currently we use the mass email feature (which we’d like to retain the ability to do) but since sometimes these are time-sensitive we’d like to use SMS as an alternative. I’ve got the custom SMS Email field set up so that I can send texts on an individual basis. Does anyone know of a way to do a mass email/text on the custom SMS Email field rather than the standard Email field?

    Like

    1. This is more like my case and I do it using a workflow (email action): sending emails to a person’s primary phone –> if the phone is a cell –> and they tell me their carrier (so I can populate the text email address for them). NOTE: this seems to have blown up on me after mid/late 2016 when at least Verizon appears to have stopped allowing this and charge for Enterprise Messaging (need to verify).

      The workflow sends an email alert to the custom field containing the email address. I pulled this in to the workflow’s email action via an email template (under Communications Templates). The only Apex code needed is is you want people to reply to the email and need to set up an email service handler.

      Hope this makes sense and helps!

      Like

  14. Hi Adam,

    This is a really great article & a great idea overall. I’ve set this system up in a number of SF accounts at this point but I have noticed a few things. First, cell carrier limitations are not our friend. I’ve found that messages all-too-often get truncated to below useful limits. UNLESS, you use the MMS email address rather than the SMS email address.

    However, when I switch to an MMS email address I cannot get emails to send out from SF to Verizon. It works AMAZINGLY to all other carriers but the message won’t send at all to any Verizon subscriber. Any idea why?

    Like

    1. I have the same Q and suspect the in late 2016 Verizon started filtering messages sent to @vtext.com and will actually return an error to @vzwpix.com (Message could not be delivered to mobile.). Seems like TMobile, too.

      I came here to see who else is seeing this.

      Thanks!

      Like

  15. Help please. I was not able to to get the formula below worked…Please help!

    Error:Formula result is data type (Text), incompatible with expected data type (true or false).

    SUBSTITUTE(
    SUBSTITUTE(
    SUBSTITUTE(
    SUBSTITUTE( MobilePhone , “(“, “”), “)”, “”), ” “, “”), “-“, “”)&
    CASE(TEXT( Call_Carrier__c), “AT&T”,”text@att.net”,
    “BoostMobile”,”@myboostmobile.com”,
    “MetroPCS”,”@mymetropcs.com”,
    “Sprint”,”messaging@sprintpcs.com”,
    “T-Mobile”, “@tmomail.net”,
    “US Cellular”,”@email.uscc.net”,
    “Verizon”,”@vtext.com”,
    “Virgin Mobile”, “@vmobl.com”,
    Null)

    Like

    1. Hi, Jean.

      I got your code to work (pass syntax checking) by simply replacing the smart quotes with regular ones (used a Notepad app to replace all forward- and backward-facing quotes with “).

      SUBSTITUTE(
      SUBSTITUTE(
      SUBSTITUTE(
      SUBSTITUTE( MobilePhone , “(“, “”), “)”, “”), ” “, “”), “-“, “”)&
      CASE(TEXT( Call_Carrier__c), “AT&T”,”text@att.net”,
      “BoostMobile”,”@myboostmobile.com”,
      “MetroPCS”,”@mymetropcs.com”,
      “Sprint”,”messaging@sprintpcs.com”,
      “T-Mobile”, “@tmomail.net”,
      “US Cellular”,”@email.uscc.net”,
      “Verizon”,”@vtext.com”,
      “Virgin Mobile”, “@vmobl.com”,
      Null)

      BTW, I got confirmation today that for Verizon recipients to work, we now need to subscribe to EMAG as their free email-to-sms gateways were decommissioned in 10/2016. There are ones that still kind of work for legacy customers there prior to 3G (now 4G LTE I think). I’m also having issues with T-Mobile so I suspect I may have to enroll in something there, as well. I’d appreciate hearing your experience.

      Best,

      -MStan.

      Like

    1. Hi JEAN,

      You can send SMS from salesforce in 3 ways.
      In every option you have pros and cons and choose based on your criteria.

      1. Salesforce default SMS sending
      A. Cost wise very expensive in case of messaging.
      B.Some places you have to put your development efforts to make the process automatic.
      2. Integrate SMS gateway.
      N number of gateways in a market where you can choose and integrate.

      Pros:
      SMS prices are low.
      Cons:
      If you want to send SMS to different countries Integration is not a good option because International SMS
      gateway can not give SMS at local Price.
      You have to put your development efforts for dynamic message creation in triggers.
      You have to invest your money and time on every SMS template creation.

      3. You can find App in AppExchange.

      There are a few apps in AppExhnage which are providing complete automation.
      No development efforts.
      Like Email template you can create SMS template.
      You can send SMS with workflow where you need not to write triggers.

      If your option is 3 ? You can have a look at our ValueText SMS (https://appexchange.salesforce.com/listingDetail?listingId=a0N3A00000EFoedUAD) App (https://goo.gl/9B6B7d) at AppExchange.
      Best price and support guaranteed.

      Like

  16. Hi Folks,

    I didn’t received any SMS from Salesforce, even i followed all steps.
    Created fields “SMS Address(Data Type Email)”,”Cell Carrier(Picklist)”.
    Created Workflows rule : Email to SMS
    OR(
    AND(
    ISNEW(),
    NOT(ISBLANK( Mobile__c) ),
    NOT(ISBLANK( TEXT( Cell_Carrier__c) ) ) ),
    OR(
    ISCHANGED( Mobile__c),
    ISCHANGED( Cell_Carrier__c) ) )

    Created Field Update : Selected “SMS Address ”
    SUBSTITUTE(
    SUBSTITUTE(
    SUBSTITUTE(
    SUBSTITUTE (Mobile__c, ” (“, “”) , “) “, “”), ” “, “”), “-“, “”)&
    CASE(TEXT( Cell_Carrier__c),
    “Alltel”,”@message.alltel.com”,
    “ATT&T”,”@txt.att.net”,
    “Boost Mobile”,”@myboostmobile.com”,
    “Sprint”,”@messaging.sprintpcs.com”,
    “T-Mobile”,”@tmomail.net”,
    “US Cellular”,”@email.uscc.net”,
    “Verizon”,”@vtext.com”,
    “Virgin Mobile”,”@vmobl.com”,
    NULL)

    Created Email Template
    Created Workflows : When Cell_Carrier__c equals to Virgin Mobile
    Emails alert : Recipient Type –> Email Filed –> SMS Address

    I did above things but i unfortunately i didn’t received any SMS.
    did i missed something ?
    Please help me.

    Thanks in advance!

    Like

  17. This is Really Nice,

    I am from india and how can i choose my network domain name.

    For example : my mobile number should be enter +91-7418425418 and If i am using Tata Docomo then my domain name is @tatadocomo.com ???

    Thank You !!

    Like

  18. I am getting this error below.

    A workflow or approval field update caused an error when saving this record. Contact your administrator to resolve it. SMS email address: invalid email address: 5082221236

    The formula for the field update is below.

    SUBSTITUTE(
    SUBSTITUTE(
    SUBSTITUTE(
    SUBSTITUTE(
    MobilePhone, ” “,”” ), “-“, “” ), “(“, “”), “)”,””)&CASE (TEXT( Cell_Carrier__c),”Alltel”,”@message.alltel.com”,
    “AT&T”,”@txt.att.net”,
    “Boost Mobile”,”@myboostmobile.com”,
    “Sprint”,”@messaging.sprintpcs.com”,
    “T-Mobile”,”@tmomail.net”,
    “US Cellular”,”@email.uscc.net”,
    “Verizon”,”@vtext.com”,
    “Virgin Mobile”,”@vmobl.com”,null)

    Like

  19. Looks like your email is formatted as just the phone number. If you are on Verizon for example your formatted email should be “5082221236@vtext.com”

    Check your formula and make sure you are appending the appropriate carrier domain to the end of the number!

    Like

  20. Hi Adam,
    I loved your post and I have implemented as per your post. All is fine till only my mobile is not receiving any sms and workflow is activated and executed successfully.
    I tried 2-3 times after changing Mobile number from User record. What is wrong here? Please help me.

    Thanks
    Sushma
    India

    Like

  21. You can send and track SMS at Salesforce in three different ways.

    1. Salesforce default SMS sending (Live Message app)
    A. Cost vise very expensive in case of messages.
    B.Some places you have to put your development efforts to make the process automatic.
    C. support only 5 countries for now

    2. Integrate SMS gateway.
    N number of gateways online where you can choose and integrate.

    Pros:
    SMS prices are low.
    Cons:
    a.If you want to send SMS to different countries Integration is not a good option because International SMS
    gateway can not give SMS at local Price.
    b. You have to put your development efforts for dynamic message creation in triggers.
    c.You have to invest your money and time on every SMS template creation.
    d. Initial gateway integration efforts required. Need to handle your code to decreased decrease number of callouts

    3. You can find App in AppExchange.
    There are a few apps in AppExhnage which are providing complete automation.
    a. No development efforts.
    b. Like Email template, you can create SMS template.
    c. You can send SMS with a workflow where you need not to build a trigger.
    d. You can track your customer replies

    If your option is 3 ? You can have a look at our ValueText SMS (https://appexchange.salesforce.com/listingDetail?listingId=a0N3A00000EFoedUAD) App (https://goo.gl/9B6B7d) at AppExchange.

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.