Getting started
This guide walks through sending a single formatted message and reading back its delivery status. You need a Texts workspace and a terminal.
1. Create an API key
In the dashboard open Settings → API keys and choose New key. Pick the Sandbox environment for now: sandbox messages go through the whole pipeline but are delivered only to verified test recipients and are never billed.
Keys look like tx_test_4f9c… for sandbox and tx_live_… for production. Store the key in an environment variable rather than in source code:
export TEXTS_API_KEY="tx_test_4f9c2b7e0d1a48c6a3e5"
2. Install an SDK
Pick the language you already use. All SDKs read TEXTS_API_KEY from the environment by default.
# JavaScript / TypeScript
npm install @texts/sdk
# Python
pip install texts-sdk
# Go
go get texts.tg/go@latest
3. Send a message
The body accepts Texts markup: *bold*, _italic_, [label](url) and {{variables}}. The API turns it into the right format for the recipient's channel.
JavaScript
import { Texts } from "@texts/sdk";
const texts = new Texts();
const message = await texts.messages.send({
to: "+15555550123",
body: "Hi {{name}}, your order *#{{order}}* has shipped. [Track it]({{url}})",
variables: { name: "Dana", order: "10482", url: "https://example.com/t/10482" },
});
console.log(message.id, message.status); // msg_01HV8… queued
Python
from texts import Texts
client = Texts()
message = client.messages.send(
to="+15555550123",
body="Hi {{name}}, your order *#{{order}}* has shipped.",
variables={"name": "Dana", "order": "10482"},
)
print(message.id, message.status)
cURL
curl https://api.texts.tg/v3/messages \
-H "Authorization: Bearer $TEXTS_API_KEY" \
-H "Content-Type: application/json" \
-d '{"to": "+15555550123", "body": "Hello from *Texts*"}'
4. Check delivery
New messages start as queued, move to sent once handed to the carrier or mail server, and end as delivered or failed. You can poll:
const latest = await texts.messages.get(message.id);
console.log(latest.status, latest.delivered_at);
In production, prefer webhooks: add an endpoint under Settings → Webhooks and Texts will POST a message.status_changed event for every transition. Each request is signed with an X-Texts-Signature header; the SDKs include a verifyWebhook() helper.
Next steps
- Move your copy into templates so it can be edited without a deploy.
- Read about formatting rules per channel, including the 160-character SMS segments.
- Set an
Idempotency-Keyheader on retries so a network error never sends a message twice.