Autorun AI Docs

10. SMS & WhatsApp

Both functions take the same arguments and return the same result object. They require the corresponding provider to be configured for your application.

SMSNotifyAsync(phone, message)

async · returns a delivery result

Prop

Type

const result = await context.functions.SMSNotifyAsync(
  "+385911234567",
  "Your order #" + context.record.ID + " has shipped."
);

if (!result.success) console.error("SMS failed: " + result.error);

WhatsAppNotifyAsync(phone, message)

async · returns a delivery result

Prop

Type

const result = await context.functions.WhatsAppNotifyAsync(
  "+385911234567",
  "Your appointment is confirmed for tomorrow at 10:00."
);

if (!result.success) console.error("WhatsApp failed: " + result.error);

The result object

Unlike the notification and email functions, these return the provider's full response rather than a bare boolean.

Prop

Type

{
  "success": true,
  "messageId": "SM3f8a2b1c9d",
  "error": null,
  "channel": "Sms",
  "timestamp": "2026-03-12T10:24:31.4471820Z",
  "response": { "status": "queued", "to": "+385911234567" }
}

Storing messageId lets you tie a delivery report back to the record that caused it:

const result = await context.functions.SMSNotifyAsync(order.Phone, text);
await context.functions.update("orders", order.ID, {
  SmsMessageId: result.messageId,
  SmsSentAt: result.timestamp,
  SmsStatus: result.success ? "sent" : "failed"
});

One recipient per call

Both functions take a single phone number. Passing an array does not fan out — it is converted to a string and the send fails. Loop instead:

const recipients = await context.functions.get("subscribers", {
  filter: { field: "SmsOptIn", operator: "equal", value: true },
  pagination: { skip: 0, take: 200 }
});

for (const person of recipients.records) {
  const result = await context.functions.SMSNotifyAsync(person.Phone, message);
  if (!result.success) console.error("Failed for " + person.Phone + ": " + result.error);
}
Mind the timeout

Each message is its own network round trip, and the default process timeout is 30 seconds. Raise it with @timeout for larger batches, or send in pages from a scheduled process.

Message length

A single SMS holds about 160 characters, or 70 if it contains non-GSM characters such as Croatian diacritics. Longer text is split into multiple billed segments by the provider.