Send Bulk SMS

Use sendBulkSMS() to send the same text message to one or more Salesforce records.

When to use this API

This method is intended for:

  • campaign outreach
  • reminders
  • notifications
  • announcements
  • dynamic or merge-field-driven outbound text messages

When the request is accepted, the SDK creates outbound records on Message History and queues them for delivery.

Method signature

public static ConversiveAPI.MessageResponse sendBulkSMS(
List<Id> contactIds,
String message,
List<String> phoneList,
Id senderId
)

Inputs

ParameterTypeRequiredDescription
contactIdsList<Id>YesSalesforce record IDs that should receive the SMS
messageStringYesText content to send. Can be plain text or include merge fields
phoneListList<String>YesOrdered list of phone field API names to inspect for recipient phone numbers
senderIdIdYesSalesforce ID of the Sender_Id__c record used for outbound messaging

Example inputs

new List<Id>{ con1.Id, con2.Id }
'Hello, Are you interested in our new product launch telecast? Reply YES for confirmation.'
new List<String>{ 'MobilePhone', 'Phone' }
senderRec.Id

How recipient resolution works

The SDK checks the fields in phoneList in order and uses the available phone number for delivery.

That means the developer controls:

  • which fields are checked
  • in what order they are checked

Response type

public class MessageResponse {
public String response; // SUCCESS / ERROR
public String responseMessage; // Human-readable message
}

Response fields

FieldTypeDescription
responseStringIndicates success or failure
responseMessageStringHuman-readable result

Validation rules

A valid request must include:

  • one or more record IDs in contactIds
  • a non-null message
  • at least one phone field in phoneList
  • a valid senderId

Documented validation failures

The Confluence child page documents these failures:

ConditionDocumented result
contactIds is null or emptyresponse = 'ERROR', responseMessage = 'No contacts provided'
phoneList is null or emptyresponse = 'ERROR', responseMessage = 'At least one phone field must be provided.'
senderId is nullresponse = 'ERROR', responseMessage = 'Sender Id is required.'
message is nullresponse = 'ERROR' returned in MessageResponse
Important

The page explicitly says message = null returns ERROR, but it does not document the exact responseMessage string for that case. Do not hard-code a message string unless you verify it in the SDK implementation.

Message processing behavior

When validation passes, the SDK:

  1. validates the input parameters
  2. resolves recipient numbers from phoneList
  3. uses the provided sender record
  4. creates outbound records on Message History
  5. submits the messages to the Conversive platform

Message status lifecycle

The Confluence page documents this status flow on Message History:

StatusMeaning
SubmittedMessage record created and queued for delivery
ERRORDelivery failed during the callout to Conversive

Callout failure behavior

If the SDK successfully creates the record but the callout fails:

  • the message is first stored as Submitted
  • the status is later updated to ERROR

This is important because it separates:

  • input validation failures returned immediately by the API
  • delivery or callout failures that happen after record creation

Example

Contact con1 = new Contact(
LastName = 'Mark Smith',
MobilePhone = '9876543210'
);
Contact con2 = new Contact(
LastName = 'Eugene Taylor',
MobilePhone = '9876543211'
);
insert new List<Contact>{ con1, con2 };
Sender_Id__c senderRec = new Sender_Id__c(
Label__c = 'Sales Cadence',
Phone__c = '9330909119'
);
insert senderRec;
ConversiveAPI.MessageResponse resp =
ConversiveAPI.sendBulkSMS(
new List<Id>{ con1.Id, con2.Id },
'Hello, Are you interested in our new product launch telecast? Reply YES for confirmation.',
new List<String>{ 'MobilePhone', 'Phone' },
senderRec.Id
);
System.debug('Response: ' + resp.response);
System.debug('Message: ' + resp.responseMessage);

Example success response

response = 'SUCCESS'
responseMessage = 'Messages queued for delivery'

Example error responses

No contacts provided

response = 'ERROR'
responseMessage = 'No contacts provided'

Missing sender ID

response = 'ERROR'
responseMessage = 'Sender Id is required.'

Missing phone fields

response = 'ERROR'
responseMessage = 'At least one phone field must be provided.'

What success means here

A successful MessageResponse means the messages were accepted and queued. It does not guarantee final delivery to the carrier or end recipient.

Best practices

  • validate the list of target record IDs before calling the method
  • pass a valid and active sender record
  • pass phone fields that actually exist on the target object
  • test with a small recipient set before large sends
  • inspect both the returned MessageResponse and related Message History records during troubleshooting