Blog · SMS Forwarder

An SMS webhook from your iPhone, for developers

SMS Forwarder App Store screenshot: eleven destination icons around the app icon, under the headline One SMS, Every App

SMS Forwarder’s Custom API destination gives you an SMS webhook from your iPhone: every incoming text arrives as a JSON POST at an HTTPS endpoint you control. You add the URL as a rule in the app, set up the Shortcuts automation once, and your server gets a small, predictable payload for each message. This post covers the contract your endpoint has to meet, a minimal receiver, and the parts that aren’t supported yet.

Why get SMS from a phone instead of an SMS provider?

You want a webhook from the phone when the number lives on a SIM card in an iPhone. SMS gateway services give you virtual numbers with an API attached, and if you can choose your number, they’re often the better tool. But sometimes the number is fixed: a business line printed on invoices, a personal number your bank knows, a test device’s SIM that receives real one-time codes.

That last one is a good developer use case. End-to-end tests for a login flow with SMS verification need the code from a real text. Forward the test phone’s texts to an endpoint your test runner can read, and the code is a field in a JSON body (pair it with the verification-code filter from forwarding 2FA codes) instead of something a person types in.

Other uses we’ve had in mind: logging all texts to a business number into a database, turning carrier or courier SMS into events in a pipeline, or feeding texts into a chat bot you already run.

What does the payload look like?

Each forwarded text arrives as one POST with this JSON body:

{
  "from": "+905551112233",
  "from_name": "Acme Bank",
  "message": "Your code is 1234",
  "timestamp": "2026-07-04T12:34:56Z",
  "message_id": "0d5f2c66-9d3e-4c3a-8f0f-1c2b3a4d5e6f"
}
SMS Forwarder’s New Rule screen for Custom API, showing the JSON your server receives, an endpoint URL field and the note that the server must reply with a 2xx within 10 seconds
The Custom API rule screen shows the exact payload before you save.

The message field holds the text body. The timestamp is an ISO 8601 string. Treat from and from_name as optional: they’re omitted when the app doesn’t know them. Those two values come from the optional Sender and Sender Name steps in the Shortcuts automation, so a phone set up without them sends neither. The message_id is a unique ID for this message (a UUID in the example), and it matters for retries, below.

That’s the entire body. There’s no envelope, no version field and no metadata about the device.

The response rules

Your server must reply with a 2xx status within 10 seconds. Anything else counts as a failed delivery: a 4xx or 5xx, a timeout, a TLS error. Failures show up as failed deliveries in the app’s History tab, so the person holding the phone can see that something went wrong.

The practical rule is to acknowledge first and work later. Parse the body, store it or put it on a queue, return 200, then do the slow part (calling other APIs, sending notifications) outside the request.

Retries and message_id

A delivery can be retried, and a retried request carries the same message_id as the original. So a receiver that does anything with side effects should dedupe on it. Store each message_id you’ve processed, and if a request arrives with one you’ve seen, return 200 and do nothing. A unique constraint on that column handles it in one line of SQL.

We don’t publish a retry schedule, so don’t build anything that depends on a particular number of attempts or on their timing.

A minimal receiver in Node

Here’s a receiver with no dependencies. It checks a secret path, validates the body, answers immediately, skips duplicates, and does its real work afterwards:

// receiver.mjs: run with `SMS_SECRET=<long random string> node receiver.mjs`
import { createServer } from "node:http";

const PATH = `/sms/${process.env.SMS_SECRET}`;
const seen = new Set(); // use a database table with a unique index in production

createServer((req, res) => {
  if (req.method !== "POST" || req.url !== PATH) {
    res.writeHead(404).end();
    return;
  }
  let raw = "";
  req.setEncoding("utf8");
  req.on("data", (chunk) => {
    raw += chunk;
    if (raw.length > 100_000) req.destroy(); // real payloads are tiny
  });
  req.on("end", () => {
    let sms = null;
    try {
      sms = JSON.parse(raw);
    } catch {}
    if (typeof sms?.message !== "string" || typeof sms?.message_id !== "string") {
      res.writeHead(400).end();
      return;
    }
    res.writeHead(200).end(); // reply first, well inside 10 seconds
    if (seen.has(sms.message_id)) return; // a retry we already handled
    seen.add(sms.message_id);
    setImmediate(() => handle(sms));
  });
}).listen(process.env.PORT ?? 3000);

function handle(sms) {
  const sender = sms.from_name ?? sms.from ?? "unknown sender";
  console.log(`${sms.timestamp} ${sender}: ${sms.message}`);
}

The in-memory set is fine for a demo and wrong for production: it forgets everything on restart and grows forever. Swap it for a table. The server speaks plain HTTP, so put it behind something that terminates TLS, such as a reverse proxy with a certificate or your platform’s HTTPS front end.

Which URLs are accepted?

The URL has to be public HTTPS. The app refuses localhost, any *.localhost name, and literal private or reserved IP addresses (10/8, 172.16/12, 192.168/16, 127/8, 169.254/16, 0/8, ::1, fc00::/7, fe80::/10). Our backend also blocks hostnames that resolve to private addresses, so a public DNS name pointing at 192.168.1.20 won’t work either.

For local development, that means a public HTTPS tunnel to your machine rather than a LAN address. It’s slightly more setup. The rule exists so that our delivery service can never be aimed at a private network, ours or anyone else’s.

Securing an endpoint without headers or signatures

You can’t add custom headers yet, and we don’t sign requests with HMAC. Until that changes, the simplest protection is a secret in the URL path, as in the example above: a long random segment that nobody can guess. Keep it out of logs where you can, and rotate it if it leaks by changing the path and updating the rule.

Validate the shape of every body, rate-limit the endpoint, and treat the content as untrusted input. That includes the sender. SMS sender names and numbers can be spoofed on the phone network itself, so “Acme Bank” in from_name means the text claimed to be from Acme Bank, nothing more.

The message is encrypted between the iPhone and our server. From our server to yours it travels over HTTPS as readable JSON. The security page has the details.

What isn’t supported yet

As of version 1.5, SMS Forwarder does not support:

  • a custom HTTP method (it’s always POST)
  • custom headers, including Authorization
  • body templates or renamed fields
  • HMAC or any other request signing

You can add several Custom API rules, and each one receives every forwarded text, since all enabled rules get the same messages. Filters are global and match only the body, so you can’t send different senders to different endpoints. And the usual phone-side limits apply: no MMS, and the iPhone must be online when the text arrives, with no offline queue. The full field-by-field reference is in the Custom API webhook guide.

The no-code path

If you’d rather not run a server at all, SMS Forwarder can post straight into Zapier, Make or IFTTT. Each one gives you a webhook URL to paste into a rule, and the Zapier, Make and IFTTT guide covers the differences, including Zapier’s paid-plan requirement for webhooks. Whichever path you take, the phone still needs the automation from the Shortcuts automation guide.

Questions

Frequently asked

What HTTP method does the SMS Forwarder webhook use?

Always POST, with a JSON body. Picking GET, PUT or another verb isn't possible at the moment.

How do I avoid processing the same SMS twice?

Record every message_id you have handled and ignore any request whose ID is already recorded. A unique index on that column in your database does the job cleanly.

Can I point the webhook at localhost while developing?

No. The app refuses localhost and private network addresses, and our backend refuses hostnames that resolve to them. Expose your dev server through a public HTTPS tunnel instead.

Can I verify that a request came from SMS Forwarder?

There is no signature header yet. Until there is, put the endpoint behind a long, random path only you know, and reject bodies that don't have the expected shape.

Guide

Forward SMS to WhatsApp with Shortcuts

Forward SMS to WhatsApp on iPhone by adding WhatsApp's Send Message action to the SMS Forwarder automation. Steps, recipients, and why it's less reliable.