You can send SMS via apex by creating a record at the “Message Bucket” Object.
You can also send the bot questions with mapping bot element id to the Message Bucket field, for this please refer to the below section.
Example: Sending SMS from contact update.
Trigger SendSMSOncontact on Contact (after update){
List smsForSending=new List();
for(contact c: trigger.new){
rsplus__SMS_Bucket__c sms=new rsplus__SMS_Bucket__c();
sms.rsplus__Number__c =c.MobilePhone; // required to send sms
sms.rsplus__Sender_ID__c=’VluTxt’; // sender id is required to send sms
sms.rsplus__Message__c =’Welcome to ValueText’; // message body is required to send sms
OR // You have to select rsplus__Message__c or rsplus__Template_ID__c or Bot element
sms.rsplus__Template_ID__c =’T0001’; // Template ID bust be name (API field of SMS Templates) of the Template
OR
sms.rsplus__Bot_Element__c=’a1b0I000003s1jZQAQ’;// Please refer for how to add Bot Element.
sms.rsplus__Related_To__c=c.id; // Optional – id of the the record.
smsForSending.add(sms);
}// end of for
Database.insert(smsForSending,false);
}// end of trigger
How to add Bot Element Id to the rsplus__Bot_Element__c field of the message bucket:
1. Choose the bot that you want to send as an SMS.
Salesforce > Bot Tab > Choose One bot and open > you can see the Bot Element Lookup up field open it.
2. On click of lookup filed on bot record it opens the bot element record and you copy the id from URL and map it to the rsplus__Bot_Element__c field.