Skip to content
DashboardRequest access

SMS

client.sms sends and tracks text messages. Back to the SDK Reference.

MethodSignature
sendsend(input: SendSmsInput, options?: SendOptions): Promise<SmsMessageResponse>
sendBatchsendBatch(messages: SendSmsInput[], options?: SendOptions): Promise<BatchSmsResponse>
getget(id: string): Promise<SmsMessageResponse>
listlist(query?: SmsListQuery): Promise<SmsListResponse>
const sms = await client.sms.send({
  to: '+15551234567',
  body: 'Your code is 481516.',
  tags: ['otp'],
});

const { results, created, errors } = await client.sms.sendBatch([
  { to: '+15551234567', body: 'Hello' },
  { to: '+15557654321', templateName: 'reminder', variables: { name: 'Sam' } },
]);

const page = await client.sms.list({ status: 'delivered', limit: 50 });
const next = await client.sms.list({ cursor: page.nextCursor ?? undefined });

Input rules

Idempotency

send and sendBatch each generate an Idempotency-Key unless you pass options.idempotencyKey. SMS keys are namespaced separately from email keys, so the same key on /v1/emails and /v1/sms doesn't collide.

Suppressed numbers

Sending to a suppressed number doesn't fail. The API answers 200 (rather than 201) with status: 'suppressed', and nothing is sent.

Statuses

SMS_STATUSES / SmsStatus lists every status: queued, sending, sent, delivered, deferred, failed and suppressed.