Send Text Alerts From Salesforce Using Email to SMS

Send_Text_Alerts_From_Salesforce_Using_Email_to_SMA 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!

 

Load More Related Articles
Load More By Adam Marks
Load More In How To

57
Leave a Reply

avatar
29 Comment threads
28 Thread replies
2 Followers
 
Most reacted comment
Hottest comment thread
31 Comment authors
Maxime SavartValueText SupportSushmaBob PoliquinEmily Smith Recent comment authors
  Subscribe  
newest oldest most voted
Notify of
Jessica Tanner
Guest

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!

Brent Downey
Admin

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!

Karen Robinson
Guest
Karen Robinson

Why not try 360 SMS app. It will surely solve your problem regarding incoming messages from your customers,easy to use and many features at economical cost. https://appexchange.salesforce.com/listingDetail?listingId=a0N3000000DpSyIEAV

Brent Downey
Admin

Hey Karen! Great suggestion! This post was written a year before that app was released. Great find – thanks for sharing!

Kari Bryan
Guest
Kari Bryan

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 ) ) )

Carlos
Guest
Carlos

Hey Kari!

Try selecting ‘created, and every time it’s edited’ in Evaluation Criteria section!

Good Luck!

Brent Downey
Admin

Thanks for helping out Carlos!

Carlos
Guest
Carlos

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!

Kari Bryan
Guest
Kari Bryan

That worked! Thank you!

Brian Fey
Guest
Brian Fey

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.

Brent Downey
Admin

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!

Aron Schor
Guest
Aron Schor

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!

Brent Downey
Admin

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… Read more »

Aron Schor
Guest
Aron Schor

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!

Brent Downey
Admin

Exactly right!

Kari Bryan
Guest
Kari Bryan

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

Brent Downey
Admin

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!

Mark Deuel
Guest
Mark Deuel

Awesome post, thanks!

Donald Bohrisch
Guest

That is pretty wicked, thank you for the great insight on this possibility… as always, You Rock!

Brent Downey
Admin

Thanks Donald, but I can’t take credit for this post! It was all Adam this time!

Brian Fey
Guest
Brian Fey

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

Robert Boyd
Guest
Robert Boyd

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!

Brent Downey
Admin

This is awesome Robert! What a cool way to leverage text alerts AND Conga!

Joanne
Guest
Joanne

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?

Joanne
Guest
Joanne

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!

Margot W
Guest
Margot W

Pretty cool! I got it to work! Can’t wait to share it with the team! Thanks so much Adam & Brent!

Brent Downey
Admin

Awesome! So happy it worked for you!

Margot W
Guest
Margot W

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

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

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

Michele
Guest
Michele

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?

Pintu Francis
Guest
Pintu Francis

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. 🙂

Ann
Guest
Ann

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.

Jeremy Thompson
Guest
Jeremy Thompson

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.

Josh High
Guest

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?

Josh High
Guest

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)

Melissa
Guest

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?

Mike Stan.
Guest

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… Read more »

Josh G.
Guest

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… Read more »

Mike Stan.
Guest

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!

SOUNDAR
Guest
SOUNDAR

Hi Adam Marks,

This Is Too Amazing to look, Could You Please anyone Give me a demo video.. because i m new to the salesforce.

sourajking@gmail.com

+91-7418425418

Jean Exil
Guest
Jean Exil

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)

Mike Stan.
Guest

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… Read more »

Mike Stan.
Guest

Also, “my version” of the formula removes the TEXT ( … ). That’s probably more in line with your error.

Brent Downey
Admin

Thanks for your help with this Mike! I hope that works for you Jean!

Jean
Guest
Jean

Mike/Brent, This still does not work for me. Unable to pass syntax checking even after replacing the smart quotes.

ValueText Support
Guest

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… Read more »

Raj
Guest

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… Read more »

Soundar - Orbit Innovations
Guest
Soundar - Orbit Innovations

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 !!

ValueText Support
Guest

You can config your number as sender Id India. If some one reply you can get text directly to your mobile.

You can also refer cheapest way to send Text from salesforce : https://goo.gl/ChiyNb

Emily Smith
Guest

This is Really Nice,By using Smart SMS App, you can send SMS/MMS campaigns from your Salesforce Org hassle free and improve sales figure.

Bob Poliquin
Guest
Bob Poliquin

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)

Sushma
Guest
Sushma

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

ValueText Support
Guest

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… Read more »

Maxime Savart
Guest

This is for now the best tip I’ve ever read about on Salesforce. Thanks a lot ! 😉

http://salesforcemax.fr/

SUBSCRIBE ALREADY!

SUBSCRIBE ALREADY!

Join the bomb diggity Admin Hero email list and never miss a post. Like, never ever!

Hizza! You're subscribed! Nothing but good times ahead!