Send an SMS through the API.
Publish one SMS attempt, simulate it over the API, and inspect the result before sending a live test.
Before you start
- A Tremi workspace on Basic or a paid plan, and an owner or admin who can manage connections, publish workflows, and create API keys.
- Your own Twilio account with a Messaging Service. Connect it in Connections and confirm that the service appears among the imported resources.
- A terminal with cURL. Keep the API key in your local environment or server-side secret store.
This simulation sends no messages, uses 0 credits, and keeps results inside Tremi. To test external delivery, explicitly select a result webhook in the console simulation options.
Step 1
Publish one SMS attempt
Open Workflows, choose Create workflow, and enter these values:
- Workflow name
- Quickstart SMS
- Workflow description
- Open Workflow details, enter Send one test SMS and inspect its run evidence., then choose Save details.
- Attempt
- Choose Add attempt, select SMS, and select your Twilio Messaging Service.
- Message
Hi {{first_name}}, this is your Tremi test message.- Timing
- Keep the single attempt immediate, with no delay.
- Variable
- In Integrations → Workflow inputs, select
first_name. Keep String, enter Recipient first name. as its description, use User as the example, and choose Save input.
Choose Review publish, then Publish v1. Publishing saves a fixed version; it does not send the message.
Open the workflow's API contract and check its slug. A new workflow named Quickstart SMS uses quickstart-sms; substitute your actual slug in the command below.
Step 2
Create an API key
In Settings → API keys, create a key with workflows:run and runs:read. Copy the secret when it appears, then replace the placeholder in your terminal:
export TREMI_API_KEY='<YOUR_KEY>'
export TREMI_WORKFLOW_SLUG='quickstart-sms'workflows:run authorizes this REST simulation. The separate workflows:simulate scope is for MCP simulations.
Step 3
Simulate the run
Send the published workflow a recipient and the first_name variable. Keep mode set to simulation.
curl --request POST \
"https://www.tremi.ai/api/v1/workflows/$TREMI_WORKFLOW_SLUG/runs" \
--header "Authorization: Bearer $TREMI_API_KEY" \
--header "Content-Type: application/json" \
--header "Idempotency-Key: quickstart-sms-simulation-001" \
--data '{
"recipient": {
"externalId": "quickstart-contact-001",
"phone": "+15555550123",
"timezone": "America/New_York"
},
"variables": {
"first_name": "User"
},
"mode": "simulation"
}'A successful request returns 202 Accepted with a run ID. Your ID and timestamp will differ:
Step 4
Inspect the result
Replace the placeholder with the returned run ID and retrieve its evidence:
export TREMI_RUN_ID='RUN_ID_FROM_THE_RESPONSE'
curl "https://www.tremi.ai/api/v1/runs/$TREMI_RUN_ID" \
--header "Authorization: Bearer $TREMI_API_KEY"The run completes asynchronously. If it is still queued or running, retrieve it again. For the one-step workflow above, expect these fields:
{
"state": "completed",
"outcome": "sequence_exhausted",
"workflowVersion":
Step 5
Send a live test
When the simulation looks right:
- Confirm that Twilio is active, its Messaging Service has a sending number, and its messaging setup is ready for your test destination.
- Replace the fictional phone number with a test number you control and are authorized to message. Set its actual time zone and the intended message variables.
- Change
modetoliveand use a new idempotency key, such asquickstart-sms-live-001, before sending the request. - Retrieve the new run and inspect the actual provider evidence. Live SMS can wait for the recipient's sending window.
A live workflow start uses 1 Tremi credit. A provider-accepted SMS attempt uses 1 more; Twilio bills its usage separately.