/* Error on https://tenali.sms-magic.com/static/css/chatbot.css?ver=5.5.15 : Something went wrong: cURL error 6: Could not resolve host: tenali.sms-magic.com */

Send Bulk SMS Messages

Follow the steps below to sending SMS messages in bulk for all records that correspond to a particular Contact object.
  1. Create a List of type smagicinteract__smsMagic__c.
  2. Iterate the contact list.
  3. Create an object of smagicinteract__smsMagic__c.
  4. Assign fields to the object.
  5. Iterate through and perform the SMSCallout to send the SMS.
  6. Finally, use database.insert to insert the object list.

Here is some example code that sends bulk SMS messages.
List smsObjectList = new List();
List  conList; //List of contact populated from the visual force page or fetch from the database.
String templateText = 'test SMS by Screen Magic';
String senderId = 'smsMagic'; // Please replace the 'smsMagic' with your relevant sender ID.
for(Contact contact :conList){
smagicinteract__smsMagic__c smsObject = new smagicinteract__smsMagic__c();
if(contact.MobilePhone != null){
smsObject.smagicinteract__SenderId__c = senderId;
smsObject.smagicinteract__PhoneNumber__c = contact.MobilePhone;
smsObject.smagicinteract__Name__c = contact.Name;
smsObject.smagicinteract__ObjectType__c = 'Contact';
smsObject.smagicinteract__disableSMSOnTrigger__c = 1;
smsObject.smagicinteract__external_field__c =
smsObject.smagicinteract__SMSText__c = templateText;
* Note : When you are using pushSMSCallout method to send the SMS
*        please make sure that smagicinteract__disableSMSOnTrigger__c
*        should have value as 1.
String response = smagicinteract.ApexAPI.pushSMSCallout(smsObjectList);

Was This Article Helpful?

Important Announcement!

URGENT! Please register the 10-digit business phone number (e.g. 555-555-5555) that your organization uses to send texts to consumers in the U.S. Failure to register may cause heavy penalties and disruption to all your text messaging communications.