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?

ATTENTION!!!! - Urgent Action Required

There have been new changes by the TCR that require companies sending application-to-person (A2P) SMS or Text messages within the United States to register their Brand and 10-digit long code (10DLC) numbers they are using.

The goal is to build trust within the system while delivering high customer engagement. SMS Text Messages will start failing if you don't comply with these regulations.

SMS Magic team wants to help you complete this process so you can continue serving your customers.

Please click on the below link to complete the form, and our team will start the registration process.