ftos.messaging.sendSMS

IMPORTANT!  
Starting with v24.3.0, this is renamed from server.messaging.sendSMS to ftos.messaging.sendSMS.

Sends an SMS message to a specified mobile number using a configured communication provider (such as FtosApiSms).

This is suitable for business logic modules of business service components.

NOTE  
Do not use GatewaySmsOTP. It is deprecated and must no longer be used. Use an updated provider such as FtosApiSms.

Syntax

Copy
function ftos.messaging.sendSMS(phoneNumber: string, message: string, options: ISendSMSOption): void
 
Parameter Type Description
phoneNumber string Telephone number of the recipient.
IMPORTANT!  
The telephone number must include the country dialing code.
message string Contents of the SMS message.
options object
  • from - string - (Optional) The sender ID or name displayed on the recipient device. Depending on local telecommunications regulations, this may be an alphanumeric name or an approved short code.

  • provider - (Optional) The communication provider identifier (for example, "FtosApiSms"). If omitted, the platform uses the system default provider. For information on how to configure SMS service providers, see the Platform User Guide.

Return Value

Code Example

This example demonstrates how to send an SMS notification using the FtosApiSms communication provider:

  1. Defines the payload: Sets the destination mobile phone number in international format (+40712345678) and the verification message text.

  2. Configures the delivery options:

    • Specifies "FtosTest" as the sender name (from) displayed to the recipient.

    • Designates "FtosApiSms" as the delivery channel (provider), directing the platform to route the message through the service endpoint and credentials defined in the FtosApiSmsProvider configuration.

  3. Dispatches the SMS: Calls ftos.messaging.sendSMS(...) with the destination, body, and options to trigger message delivery.

Copy
const recipient = "+40712345678";
const smsText = "Your verification code is: 482910";

const smsOptions: ISendSMSOption = {
    from: "FtosTest",
    provider: "FtosApiSms"
};

ftos.messaging.sendSMS(recipient, smsText, smsOptions);