SMS engineering

SMS API Integration Checklist for Engineering Teams

A go-live checklist for integrating an SMS API: number handling, templates, sending architecture, retries, webhooks, fraud limits, monitoring, testing, and compliance.

Updated · 3 min read

Sending your first SMS through an API takes ten minutes. Running SMS reliably in production takes a bit more thought. Use this checklist before you go live, or to audit an integration that has grown over time.

Numbers and input

  1. Store every number in E.164. Normalize input, convert non-Latin digits, strip trunk zeros. See E.164 validation.
  2. Validate mobile numbers for the countries you serve, so you never pay to send to a landline.
  3. Default the country code from the user's context, and let them change it.

Templates and content

  1. Keep templates in one place, versioned, with a language per template.
  2. Check encoding and segment count with realistic variable values. See SMS character limits.
  3. Tag each template as transactional or promotional. See transactional vs promotional SMS.
  4. Register sender IDs in every country that requires it. See alphanumeric sender IDs.

Sending architecture

  1. Send asynchronously. Put messages on a queue; do not call the SMS API inside a user's HTTP request, except for OTPs where the user is waiting.
  2. Prioritise transactional traffic over campaigns, with separate queues if volumes are large.
  3. Respect throughput limits. Spread bulk sends, and handle 429 responses with backoff.
  4. Use idempotency keys if your provider supports them, so a retried request does not send twice.
  5. Retry only safe failures. Retry network errors and 5xx responses with backoff; do not retry validation errors.

Delivery tracking

  1. Store the provider's message ID with your own record of the message.
  2. Receive delivery webhooks, verify signatures, process idempotently, and handle out-of-order events. See handling SMS webhooks.
  3. Define a timeout after which an undelivered OTP triggers fallback. See SMS to WhatsApp failover.

Security and abuse

  1. Rate-limit OTP and any user-triggered SMS per number, IP, and device.
  2. Restrict destinations to countries you serve, and set spending alerts. See SMS pumping prevention.
  3. Keep API keys in a secret manager, rotate them, and use separate keys per environment.

Monitoring

  1. Dashboards and alerts for: send volume, delivery rate, delivery time, OTP conversion, and spend, each by country and network.

Testing and compliance

  1. Test on real devices in your main countries, with real sender IDs and templates, before launch and after any provider change.

And for promotional traffic: consent records, opt-out handling, and sending-hour rules. See opt-out handling, GDPR and SMS marketing, and TCPA basics.

A minimal send function

async function sendSms({ to, templateId, vars, priority = 'transactional' }) {
  const phone = normalizeToE164(to)
  if (!phone) throw new Error('Invalid phone number')

  const message = await db.messages.create({ phone, templateId, vars, priority, status: 'queued' })
  await queue.publish(priority, { messageId: message.id })
  return message.id
}

The worker then renders the template, calls the provider with an idempotency key, stores the provider's message ID, and lets webhooks update the status.