Sends SMS messages to profiles and tracks their delivery status, delegating the actual sending to whichever SMS provider app is installed and enabled for the account. Registered in scripting contexts as smsManager, so app developers call it directly from server-side JS to build and send messages via SmsBuilder, look up sms items by provider message id, and record status transitions such as sending, sent, delivered, failed, retry and no-phone. Also enforces the account's configured daily SMS limit.

Group: Managers


Properties

PropertyReturnsDescription
overSMSLimitbooleanChecks whether the number of SMS messages sent by the current tenant account in the last 24 hours exceeds the account's configured daily message limit. Returns false if no limit (zero) is configured.
smsProvidersList<ISmsProvider>Lists the SMS provider apps that are installed and enabled for the current tenant account.

Methods

send(Profile recipient, String message) · send(Profile recipient, String message, Lead lead) · hasSmsProvider() · addSendAttempt(SmsItem smsItem, String statusCode, String statusDescription, Date now) · sendAttemptUpdated(SmsSendAttempt smsSendAttempt) · getSmsByMessageId(String messageId) · setSmsFailed(SmsItem smsItem, String status, Date now) · setSmsNoPhone(SmsItem smsItem, Date now) · setSmsSent(SmsItem smsItem, Date now) · setSmsSending(SmsItem smsItem, Date now) · setSmsDelivered(SmsItem smsItem, Date now) · setSmsRetry(SmsItem smsItem, String statusText, Date now) · smsItemUpdated(SmsItem smsItem) · getSmsProviders() · isOverSMSLimit() · findSmsProvider() · getSmsProviderFromId(String instanceId) · getSmsItem(Long id) · newSmsBuilder(Profile recipient)

send(Profile recipient, String message)

Returns: SmsItem

Sends an SMS message to a recipient using the account's default SMS provider, with no linked lead. Equivalent to calling the three-argument overload with a null lead.

ParameterDescription
recipientthe profile to send the message to
messagethe text of the message to send

send(Profile recipient, String message, Lead lead)

Returns: SmsItem

Sends an SMS message to a recipient using the account's default SMS provider, optionally linking the resulting SmsItem to a funnel lead.

ParameterDescription
recipientthe profile to send to
messagethe textual message to send
leadoptional lead to link the SmsItem to via a FunnelEdm; may be null

hasSmsProvider()

Returns: boolean

Checks whether an SMS provider app is installed and enabled for the current account.

addSendAttempt(SmsItem smsItem, String statusCode, String statusDescription, Date now)

Returns: SmsSendAttempt

Records a delivery attempt against an SmsItem and persists both the item and the new attempt.

ParameterDescription
smsItemthe SMS item the attempt is recorded against
statusCodethe provider's status code for this attempt
statusDescriptionthe provider's textual description of the status
nowthe time the attempt was made

sendAttemptUpdated(SmsSendAttempt smsSendAttempt)

Returns: void

Persists changes to an existing SmsSendAttempt record.

ParameterDescription
smsSendAttemptthe send attempt to save

getSmsByMessageId(String messageId)

Returns: SmsItem

Finds the SmsItem for the current tenant account whose provider message id matches the given value.

ParameterDescription
messageIdthe provider's message id to search for; if blank, no lookup is performed

setSmsFailed(SmsItem smsItem, String status, Date now)

Returns: void

Marks an SmsItem as failed, records the given status text and time, saves the item, and fires the search index update and SmsDeliveryEvent Failed events.

ParameterDescription
smsItemthe SMS item to mark as failed
statusthe status text to record against the item
nowthe time the failure was recorded

setSmsNoPhone(SmsItem smsItem, Date now)

Returns: void

Marks an SmsItem as unsendable because the recipient has no phone number, saves the item, and fires the search index update and SmsDeliveryEvent Failed events.

ParameterDescription
smsItemthe SMS item to mark
nowthe time the status change was recorded

setSmsSent(SmsItem smsItem, Date now)

Returns: void

Marks an SmsItem as sent, saves the item, and fires the search index update and SmsDeliveryEvent Sent events.

ParameterDescription
smsItemthe SMS item to mark as sent
nowthe time the send was recorded

setSmsSending(SmsItem smsItem, Date now)

Returns: void

Marks an SmsItem as currently sending, saves the item, and fires the search index update event.

ParameterDescription
smsItemthe SMS item to mark as sending
nowthe time the status change was recorded

setSmsDelivered(SmsItem smsItem, Date now)

Returns: void

Marks an SmsItem as delivered, saves the item, and fires the search index update and SmsDeliveryEvent Delivered events.

ParameterDescription
smsItemthe SMS item to mark as delivered
nowthe time the delivery was recorded

setSmsRetry(SmsItem smsItem, String statusText, Date now)

Returns: void

Schedules a retry for an SmsItem that failed to send, delegating to SmsApp for the retry backoff logic. After three failed attempts the item is marked failed instead of being retried again.

ParameterDescription
smsItemthe SMS item to retry
statusTextthe status text describing why the attempt failed
nowthe time the retry was recorded

smsItemUpdated(SmsItem smsItem)

Returns: void

Saves an SmsItem and fires the search index update event for it, without changing its status. Used to notify the platform of other changes made to the item.

ParameterDescription
smsItemthe SMS item that was updated

getSmsProviders()

Returns: List<ISmsProvider>

Lists the SMS provider apps that are installed and enabled for the current tenant account.

isOverSMSLimit()

Returns: boolean

Checks whether the number of SMS messages sent by the current tenant account in the last 24 hours exceeds the account's configured daily message limit. Returns false if no limit (zero) is configured.

findSmsProvider()

Returns: ISmsProvider

Returns the first available SMS provider app for the current tenant account.

getSmsProviderFromId(String instanceId)

Returns: ISmsProvider

Finds an active SMS provider app for the current tenant account by its application instance id.

ParameterDescription
instanceIdthe application instance id of the provider to find

getSmsItem(Long id)

Returns: SmsItem

Fetches an SmsItem by its id, scoped to the current tenant account.

ParameterDescription
idthe id of the SMS item to fetch

newSmsBuilder(Profile recipient)

Returns: SmsBuilder

Creates a new SmsBuilder for composing and sending a message to the given recipient.

ParameterDescription
recipientthe profile the message will be sent to
To get full access to the Kademi Hub existing customers can login here, or new customers can register here.