PhoneGap - Send SMS message

Description

Send a SMS message.

Discussion

The PhoneGap - Send SMS message action sends an SMS message in an a PhoneGap application. It uses the PhoneGap SMS plugin to send an SMS message. The plugin is specified in 3rd Party Plugins in the PhoneGap App Builder. This action will also use the PhoneGap native notification plugin if it installed.

The Action Javascript - SMS Message dialog (shown below) is used to configure the PhoneGap - Send SMS message action. Here, you can specify where to send the message (one or more phone numbers) and the message to send. The properties to set are described below.

Message Text 

The Message Text property defines the message to send. The message text must be in the form of a Javascript expression. The expression can be a static message or a dynamic message defined using variables or by calling a JavaScript function

If using a static message or dynamic message with variables, the message text must be enclosed using single quotes.

Example: Static text

'Your order from Acme Rodent Traps has shipped.'

Example: Using a Variable

'Please call us at ' + userPhoneNumber

Example: Specifying a Function

If specifying a function, your JavaScript function must return the message to send. For example:

var getTextMessage = function() {
    var customer = {dialog.object}.getValue('CUSTOMER_NAME');
    var msg = 'Thank you for your order, ' + customer;

    return msg;
};

Send To Phone Number(s) 

The Send To Phone Number(s) defines the phone numbers to deliver the message. The phone number(s) can be a static value or dynamically computed using a JavaScript function.

As with the Message Text property, the Send To Phone Number(s) property is defined as a JavaScript expression, which means the value must be enclosed in single quotes. Multiple numbers are specified as a comma-delimited list.

Example: Specifying one Phone Number

'123-334-0392'

Example: Specifying Multiple Phone Numbers

'617-222-1111,508-123-4444'

Example: Specifying a Function

getPhoneNumbers()

var getPhoneNumbers() = function () {
    var phoneNumber = {dialog.object}.getValue('CUSTOMER_PHONE');

    return phoneNumber;
};

Limitations

PhoneGap Applications Only

See Also