simtrunkDocs

SMS

Send and receive SMS from phones, the dashboard and the API.

Every line sends and receives SMS on its SIM. simtrunk doesn't charge for SMS; your carrier bills them as usual.

Received SMS

An SMS to the SIM's number shows in the line's conversations, reaches the phones registered to the line as a SIP MESSAGE, and goes to your webhooks as simtrunk.sms.received.

Sending

  • From a phone: send a SIP MESSAGE to a number; it leaves on the line.
  • From the dashboard: open the line's conversations and write.
  • From the API: with a key that has the sms:write scope.
Terminal
curl https://api.simtrunk.com/v1/lines/LINE_ID/sms \  -H "Authorization: Bearer $SIMTRUNK_API_KEY" \  -H "Content-Type: application/json" \  -d '{"to": "+258840000000", "body": "Your order is ready."}'

to is a national or international (+…) number. Long texts go as several parts.

Send an SMS

POST
/v1/lines/{id}/sms

Requires the scope sms:write.

Authorization

apiKey
headerAuthorizationBearer <token>

An API key, or an access token for one, through the API gateway.

Path Parameters

id*string

Request Body

application/json
  1. body
to*string

The number, national or international (+...).

body*string

The text; long ones go as concatenated parts.

Response Body

OK

application/json
  1. response
ok*boolean
curl -X POST 'https://api.simtrunk.com/v1/lines/string/sms' \  -H 'Content-Type: application/json' \  -d '{  "to": "string",  "body": "string"}'
{  "ok": true}

Reading conversations

GET /v1/lines/{id}/threads lists a line's conversations, and GET /v1/lines/{id}/messages a conversation's messages (scope sms:read). Viewers don't see message content.

Webhooks

TopicWhen
simtrunk.sms.receivedAn SMS arrived
simtrunk.sms.sentAn SMS left
simtrunk.sms.failedAn SMS could not be sent

How is this guide?

Last updated on

On this page