Skip to main content

Send a single message

Use sms.send() to send one SMS message.
import { WrapsSMS } from '@wraps.dev/sms';

const sms = new WrapsSMS();

const result = await sms.send({
  to: '+14155551234',
  message: 'Your verification code is 123456',
});

console.log('Sent:', result.messageId);

Parameters

to
string
required
Destination phone number in E.164 format. Must include country code, e.g. +14155551234.
message
string
required
The text content of the SMS message. Standard SMS segments are 160 characters; longer messages are split and billed per segment.
messageType
'TRANSACTIONAL' | 'PROMOTIONAL'
The message category. Affects routing and throughput limits.
  • TRANSACTIONAL — time-sensitive messages triggered by user actions (OTPs, alerts, confirmations). Higher default throughput.
  • PROMOTIONAL — marketing or bulk messages. Subject to additional carrier filtering.
Defaults to TRANSACTIONAL.

Return value

messageId
string
required
The AWS message ID assigned to the sent message. Use this for delivery tracking.

Send a batch

Use sms.sendBatch() to send multiple messages in a single call.
const result = await sms.sendBatch({
  messages: [
    { to: '+14155551234', message: 'Hello Alice!' },
    { to: '+14155555678', message: 'Hello Bob!' },
  ],
  messageType: 'TRANSACTIONAL',
});

Parameters

messages
object[]
required
Array of message objects to send. Each object accepts the same to and message fields as send().
messageType
'TRANSACTIONAL' | 'PROMOTIONAL'
Message category applied to all messages in the batch. Defaults to TRANSACTIONAL.

Return value

sendBatch() returns an array. Each element corresponds to a message in the input array and contains:
messageId
string
required
The AWS message ID for the sent message.

Sandbox mode

When SMS infrastructure is first deployed, your account is in sandbox mode. In sandbox mode you can only send to phone numbers you have explicitly verified — messages to unverified numbers are rejected.
To verify a destination number before sending:
npx @wraps.dev/cli sms verify-number --phoneNumber +14155551234
You will receive a verification code by SMS. Complete verification by running:
npx @wraps.dev/cli sms verify-number --phoneNumber +14155551234 --code 123456
To list verified numbers:
npx @wraps.dev/cli sms verify-number --list
Once you register a toll-free number and receive carrier approval, sandbox restrictions are lifted. Run wraps sms upgrade to start that process.

Build docs developers (and LLMs) love