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
| Property | Returns | Description |
|---|---|---|
| overSMSLimit | 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. |
| smsProviders | List<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.
| Parameter | Description |
|---|---|
recipient | the profile to send the message to |
message | the 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.
| Parameter | Description |
|---|---|
recipient | the profile to send to |
message | the textual message to send |
lead | optional 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.
| Parameter | Description |
|---|---|
smsItem | the SMS item the attempt is recorded against |
statusCode | the provider's status code for this attempt |
statusDescription | the provider's textual description of the status |
now | the time the attempt was made |
sendAttemptUpdated(SmsSendAttempt smsSendAttempt)
Returns: void
Persists changes to an existing SmsSendAttempt record.
| Parameter | Description |
|---|---|
smsSendAttempt | the 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.
| Parameter | Description |
|---|---|
messageId | the 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.
| Parameter | Description |
|---|---|
smsItem | the SMS item to mark as failed |
status | the status text to record against the item |
now | the 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.
| Parameter | Description |
|---|---|
smsItem | the SMS item to mark |
now | the 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.
| Parameter | Description |
|---|---|
smsItem | the SMS item to mark as sent |
now | the 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.
| Parameter | Description |
|---|---|
smsItem | the SMS item to mark as sending |
now | the 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.
| Parameter | Description |
|---|---|
smsItem | the SMS item to mark as delivered |
now | the 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.
| Parameter | Description |
|---|---|
smsItem | the SMS item to retry |
statusText | the status text describing why the attempt failed |
now | the 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.
| Parameter | Description |
|---|---|
smsItem | the 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.
| Parameter | Description |
|---|---|
instanceId | the 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.
| Parameter | Description |
|---|---|
id | the 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.
| Parameter | Description |
|---|---|
recipient | the profile the message will be sent to |