Send a MMS Message from Apex

For sending MMS through a dev console or custom code, the following things are required:

  1. SMS History record is to be created with smagicinteract__Message_Type__c field as ‘MMS’
  2. The MMS Detail record is to be created with a lookup of the SMS History record that was created in the previous step 

Refer the below sample script to send MMS:

smagicinteract__smsMagic__c smsobj = new smagicinteract__smsMagic__c();
smsobj.smagicinteract__PhoneNumber__c = '919623197650';
smsobj.smagicinteract__Unformatted_Phone_Number__c = '919623197650';
smsobj.smagicinteract__SenderId__c = 'SMSSenderId';
smsobj.smagicinteract__disableSMSOnTrigger__c = 0;
smsobj.smagicinteract__SMSText__c = 'testSMS 2';
smsObj.smagicinteract__Message_Type__c = 'MMS';
smsObj.smagicinteract__MMS_Subject__c = 'Some random subject';
smsobj.smagicinteract__external_field__c = ApexAPI.generateUniqueKey();
insert smsObj;
smagicinteract__MMS_Detail__c mmsObj = new smagicinteract__MMS_Detail__c();
mmsObj.smagicinteract__MMS_Filename__c = 'Image';
mmsObj.smagicinteract__MMS_Url__c = ';
mmsObj.smagicinteract__SMS_History__c =;
insert mmsObj;

Was This Article Helpful?


Leave a comment

Your email address will not be published. Required fields are marked *

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.