Send SMS
Summary
- Internal name:
SendSMS - Category: SMS
- Purpose: Send a plain-text SMS message to a phone number from the Android device.
- Task type: Normal
Compatibility
-
Minimum AndroMate version:
1.1.0 -
Maximum AndroMate version:
1.1.0 -
Minimum Android:
Android 13 (API 33) -
Maximum Android tested:
Android 16 (API 36) -
Supported manufacturers:
- ✅ Samsung (One UI 6.x / 7.x / 8.x)
- ✅ Google Pixel (Android Stock)
- ⚠️ Other manufacturers — not tested
-
Required permissions:
SEND_SMS
Detailed description
The Send SMS task sends a plain-text SMS message to a destination phone number using the Android SmsManager API. The message is sent from the device's default SIM card.
Before sending, the task validates:
- The destination number (
msisdn) must follow the E.164 international format (e.g.+33612345678). Numbers without a+country code or in local format are rejected. - The message body (
message_body) must not be blank. - The message body must not exceed 100 characters.
Input parameters
| Parameter | Type | Required | Possible values | Android Compatibility | AndroMate Compatibility | Default |
|---|---|---|---|---|---|---|
msisdn |
String | Yes | E.164 format: + followed by 2–15 digits (e.g. +33612345678) — supports $variable |
Android 13 (API 33) → Android 16 (API 36) | 1.1.0 → 1.1.0 | "" |
message_body |
String | Yes | Any string ≤ 100 characters — supports $variable references |
Android 13 (API 33) → Android 16 (API 36) | 1.1.0 → 1.1.0 | "" |
E.164 format
The msisdn field must strictly match the E.164 international format:
- Starts with
+followed by the country code - Followed by the subscriber number
- Total length: 2 to 15 digits after
+
Valid examples: +33612345678, +12125551234, +447911123456
Invalid examples: 0612345678 (no country code), 33612345678 (missing +), +1 (too short)
Output parameters
This task produces no output variables. It returns VoidResult.
| Field | Type | Trigger condition | Default |
|---|---|---|---|
| — | VoidResult | Always | — |
Exceptions
| Code | Exception Name | Description |
|---|---|---|
SMS-TASK-001 |
Invalid MSISDN | The msisdn value does not match the E.164 format (+ followed by 2–15 digits). |
SMS-TASK-002 |
Empty Message Body | The message_body is blank or empty. |
SMS-TASK-003 |
Message Body Too Long | The message_body exceeds the 100-character limit. |
ERROR-000 |
Other Error | An unexpected runtime error occurred during execution. |
Execution flowchart
The following diagram illustrates the actual implementation based on the Android code:
flowchart TD
Start([Start SendSmsTask]) --> ResolveParams[🔄 Resolve msisdn + message_body\nfrom workflow context]
ResolveParams --> ValidateMsisdn{msisdn matches\nE.164 regex?}
ValidateMsisdn -->|No| E1[❌ SMS-TASK-001\nInvalid MSISDN]
ValidateMsisdn -->|Yes| ValidateBody{message_body\nnot blank?}
ValidateBody -->|No| E2[❌ SMS-TASK-002\nEmpty message body]
ValidateBody -->|Yes| ValidateLength{message_body\nlength ≤ 100?}
ValidateLength -->|No| E3[❌ SMS-TASK-003\nMessage too long]
ValidateLength -->|Yes| Send[📤 SmsManager.sendTextMessage\nmsisdn, message_body]
Send --> Success([✅ VoidResult])
E1 --> Error([❌ Exception])
E2 --> Error
E3 --> Error
style Start fill:#e3f2fd
style Success fill:#c8e6c9
style Error fill:#ffcdd2
style E1 fill:#ffcdd2
style E2 fill:#ffcdd2
style E3 fill:#ffcdd2
style ResolveParams fill:#fff9c4
style Send fill:#c8e6c9
How it works:
- Resolve parameters:
msisdnandmessage_bodyare resolved from the workflow context - Validate MSISDN: checks E.164 format — throws
SMS-TASK-001if invalid - Validate body: checks the message is not blank — throws
SMS-TASK-002if empty - Validate length: checks message does not exceed 100 characters — throws
SMS-TASK-003if too long - Send: delegates to
SmsManager.sendTextMessage()via the Android telephony API - Result: returns
VoidResulton success
Code examples
Example 1 — Send a static message
{
"SendSMS": [
{
"id": "1",
"title": "Send test SMS",
"msisdn": "+33612345678",
"message_body": "AndroMate test message"
}
]
}
Example 2 — Send using workflow variables
{
"SendSMS": [
{
"id": "2",
"title": "Report ping result",
"msisdn": "$target_number",
"message_body": "Ping result: $ping_output"
}
]
}
Input parameter details
1. Input parameter: msisdn
The phone number to send the SMS to. Must strictly follow the E.164 international format:
- Starts with +
- Followed by the country code (1–3 digits)
- Followed by the subscriber number
- Total: 2–15 digits after +
Supports $workflow_variable references.
| Valid | Invalid |
|---|---|
+33612345678 |
0612345678 (no country code) |
+12125551234 |
33612345678 (missing +) |
+447911123456 |
+1 (too short) |
- Default:
""— triggersSMS-TASK-001if not valid E.164
2. Input parameter: message_body
The content of the SMS to send. Supports $workflow_variable references — resolved at runtime.
- Maximum length: 100 characters — triggers
SMS-TASK-003if exceeded - Cannot be blank — triggers
SMS-TASK-002if empty - Supports variables: Yes