To send SMS from a data warehouse, select the recipients with a query that filters on consent, give each send a deterministic idempotency key built from the campaign and the user, send in controlled batches, and write every outcome to a ledger table. The deterministic key is what makes it safe to re-run a job that crashed halfway.
We make Ready, so the send uses the Ready REST API and only the request shape we document. A warehouse is a good place to decide who to text and a poor place to be the system of record for consent, so read the consent section before anything else.
Consent first
The query is where texting mistakes begin. Join on a consent table that your application maintains, and exclude opt-outs. Ready honors a STOP and refuses opted-out numbers up front without charging, but your warehouse may be hours behind. Don't text a list that is a day old without checking.
SELECT u.user_id, u.phone_e164, u.first_name
FROM users u
JOIN sms_consent c ON c.user_id = u.user_id AND c.revoked_at IS NULL
LEFT JOIN sms_ledger l ON l.user_id = u.user_id AND l.campaign = 'winback-2027-02'
WHERE u.inactive_days BETWEEN 30 AND 60
AND l.user_id IS NULL; The LEFT JOIN ... IS NULL skips anyone already sent this campaign, so a re-run doesn't repeat. You also need the opt-out list from the API (GET /v1/opt-outs, which lists only opted-out contacts on this account, so check a single number with GET /v1/opt-outs/:phone before a send), synced into the warehouse on a schedule, and the opt-out sync post explains the details. A text to a purchased or rented list isn't allowed, so only use users who agreed to hear from you.
One key per user per campaign
import uuid, requests, os
def send_row(row, campaign):
key = str(uuid.uuid5(uuid.NAMESPACE_URL, f"{campaign}:{row['user_id']}"))
res = requests.post(
"https://api.tryready.com/v1/messages",
json={"to": row["phone_e164"], "body": f"Hi {row['first_name']}, we saved your plan. Pick it up: https://app.example/back", "consent_attested": True},
headers={"X-API-Key": os.environ["READY_API_KEY"], "Idempotency-Key": key},
timeout=15,
)
return key, res.status_code uuid5 is deterministic: the same campaign and user always produce the same key. A repeated key means the request isn't sent twice, so even if the ledger write failed after the send, a re-run soon after doesn't text that person again. Keys are remembered for at least 7 days, so the key is a short-term backstop, not a long-term record. A 5xx answer is stored under the key and replayed (Idempotent-Replayed: true) on every re-run until it expires. Before minting a new key, check GET /v1/messages to see whether the text went out, then append an attempt number to the uuid5 name. See Idempotency in the docs.
Personalized or identical?
| Text | Endpoint | Batch size |
|---|---|---|
| Different per person (names, dates) | POST /v1/messages, one per row | Pace to your throughput |
| Identical for everyone | POST /v1/messages/bulk | Up to 100 recipients per call |
For the bulk case, split the list into batches of at most 100 and use a key per batch built from the campaign, the batch number and a stable sort of the recipients. Our chunking guide goes through partial failures.
Pace the job
A fresh registered campaign sends about 1 to 4 segments a second, and higher use-case tiers send tens, so a 50,000-row job isn't a sub-minute job. Estimate before you start: at an assumed 10 segments a second, 50,000 one-segment texts take about 83 minutes. Our throughput explainer has the details. Messages in quiet hours are held or refused, so run the job at a time that is inside the window for most of the list.
The ledger
Write one row per attempt: campaign, user, key, status, time. Mark success only on an accepted answer. It is the long-term record: check it, not the key, before re-running a campaign after a week. This table answers every later question ("did we text her?") and feeds the exclusion join above. Delivery results arrive by webhook later and belong in the same table.
FAQ
Can I use a reverse ETL tool instead?
Yes, if it can set a custom header and a stable key per row. Check that before you buy, since many tools don't expose headers.
Should I scrub the list first?
Consider it. Known TCPA-litigator and DNC numbers can be screened out before send, and our scrub API post covers how.
How do I do a dry run?
Use a test key, which simulates every send with no card, number or charge.
The short version
Consent in SQL, uuid5 keys, batches that match your throughput and a ledger. The bulk messages docs have the batch limit.
Cost and registration
A segment on the Standard rate is $0.0075 plus a $0.0045 carrier fee, passed through at cost, excluding optional screening. An account can send up to 500 texts a month before it registers for 10DLC, and most approvals take 2 to 7 days. See pricing for the full list.