Send SMS from Salesforce

Recently we came across an issue that we want to share with you all and explain the solution. Normally, in Salesforce Test classes, we create test records to test the functionalities of the code.

Send SMS from Salesforce

In this article, we are going see how an SMS can be sent from Salesforce using ‘SMS Magic Interact’ application. Sending SMS notifications to customers makes business processes faster than ever before. Salesforce doesn’t provide any standard feature to send SMS, but we can send SMS notifications to Leads, Accounts and to the records in custom objects. Customer follow-up can be done easily by sending SMS notifications with the help of ‘SMS Magic Interact’ app that is available in Salesforce AppExchange.

App Features: 

  1. Send SMS to standard & custom object’s records.
  2. Easy to Configure and Customize.
  3. Can send Bulk-SMS.
  4. Schedule SMS.

Send SMS: 

SMS can be sent to Lead, Contact, and Users, and also by directly entering Mobile Number via ‘SMS Home’.

Text Box

SMS Template: 

SMS templates can be created to send SMS messages similar to Email template. Before creating an SMS template, we need to create a ‘Template Type’, which specifies to which object the SMS template is created.

SMS History: 

This object holds all SMS records that are sent from Salesforce and is associated with the   corresponding Lead or Account.

Incoming SMS: 

This object holds all SMS records that are received by Salesforce and is associated with the   corresponding Lead or Account. In order to associate an incoming SMS with Lead or Account, we need to configure in ‘Incoming Lookup’ within ‘SMS Settings’ by creating a ‘New Incoming Lookup’ record.

sms magic salesforce

For Ex: 

If there are a list of ‘Phone’ fields (Home Phone, Office Phone, Personal Mobile) on Account, then we need to configure a specific field, and based on that field value the incoming SMS will be associated with the right record.

For example, if ‘Personal Mobile’ field is configured, then the SMS received from ‘Personal Mobile’ field value would be associated with the corresponding Account record. i.e. the record that has the same ‘Personal Mobile’ field value as the incoming SMS.

Action on Incoming SMS: 

When Salesforce receives an ‘Incoming SMS’, the following records can be created:

  1. Lead
  2. Contact
  3. Opportunity
  4. Case
  5. Task

By clicking on ‘New Action on Incoming SMS’ within ‘SMS Settings, you can create a new action.

sms magic salesforce

Opt-out Settings: 

This setting is to prevent sending SMS for Lead or Account who has unsubscribed from receiving SMS.

If Salesforce receives any text which contains the keyword for ‘Unsubscription’, then automatically ‘Opt-out’ setting (‘Opt-out’ field [Checkbox]) for the corresponding Lead or Account would be checked based on the Mobile number from which the SMS is received.

sms magic salesforce

For Ex: 

Stop & Unsubscribe are the keywords configured for Lead to enable ‘Opt-out’. If a Lead replies for the SMS sent from Salesforce with the text containing ‘Stop or Unsubscribe’, then automatically ‘Opt-out’ for the Lead would be enabled and the Lead would not receive any SMS from Salesforce until ‘Opt-out’ is disabled.

Scheduling SMS: 

SMS can be sent when a particular process is complete or at a specific time using ‘SMS on Workflow’. ‘SMS on Workflow’ is an upgrade package used for scheduling the SMS.

1. Go to ‘SMS on Workflow’ tab.

2. Click on [New SMS Workflow] button.

sms magic salesforce

Enter the values as shown below and click the [Create] button. Automatically, ‘Configuration Name’ would be populated as highlighted above.

send sms from salesforce

Sending SMS using Apex API: 

SMS can be sent using the below API from an APEX class, Also, this class can be scheduled and the SMS would be sent when the criteria specified in the class is met.

List <smagicinteract__smsmagic__c>; 

smsObjectList = new List <smagicinteract__smsmagic__c>(); 

String senderId = 'smsMagic'; 

String templateText = 'test SMS by Screen Magic'; // you can fetch the template text by querying the record on smagicinteract__SMS_Template__c object 

smagicinteract__smsMagic__c smsObject = new smagicinteract__smsMagic__c(); 

smsObject.smagicinteract__SenderId__c = senderId; 

smsObject.smagicinteract__PhoneNumber__c = contact.MobilePhone; 

smsObject.smagicinteract__Name__c = contact.Name; // records name 

smsObject.smagicinteract__ObjectType__c = 'Contact'; // record type 

smsObject.smagicinteract__disableSMSOnTrigger__c = 0; // this field either be 0 or 1, if you specify the value as 1 then sms will not get send but entry of sms will get create under SMS History object 

smsObject.smagicinteract__external_field__c = smagicinteract.ApexAPI.generateUniqueKey(); 

smsObject.smagicinteract__SMSText__c = templateText; 

smsObjectList.add(smsObject); 

Database.insert(smsObjectList,false);

SMS template as well as text for sending SMS can be used within this API.

Conclusion: 

SMS Magic Interact offers texting solution in Salesforce.  As a result of it, now businesses can collaborate, follow up, and interact with their customers more efficiently.

Reference Link: 

http://www.screen-magic.com/resources/

About MST

At MST Solutions our cornerstone is to adapt, engage and create solutions which guarantee the success of our clients. The talent of our team and experiences in varied business verticals gives us an advantage over other competitors.

Recent Articles

Work with us.

Our people aren’t just employees, they are key to the success of our business. We recognize the strengths of each individual and allow them time and resources to further develop those skills, crafting a culture of leaders who are passionate about where they are going within our organization.