Hosted SIM API

Quickstart

You need your AccountSid and AuthToken from the console, and a line on your account. The examples use the made-up numbers +61491570156 (your line) and +61491570157 (the person you're texting or calling).

Before you start

Send a text

curl -X POST "https://api.dongleswithwings.com/2010-04-01/Accounts/$ACCOUNT_SID/Messages.json" \
  --data-urlencode "To=+61491570157" \
  --data-urlencode "From=+61491570156" \
  --data-urlencode "Body=Hello from my own SIM" \
  -u "$ACCOUNT_SID:$AUTH_TOKEN"
const sid = process.env.ACCOUNT_SID, token = process.env.AUTH_TOKEN;
const res = await fetch(`https://api.dongleswithwings.com/2010-04-01/Accounts/${sid}/Messages.json`, {
  method: "POST",
  headers: { Authorization: "Basic " + Buffer.from(`${sid}:${token}`).toString("base64") },
  body: new URLSearchParams({ To: "+61491570157", From: "+61491570156", Body: "Hello from my own SIM" }),
});
console.log(res.status, await res.json());
import os, requests

sid, token = os.environ["ACCOUNT_SID"], os.environ["AUTH_TOKEN"]
r = requests.post(f"https://api.dongleswithwings.com/2010-04-01/Accounts/{sid}/Messages.json",
                  data={"To": "+61491570157", "From": "+61491570156", "Body": "Hello from my own SIM"},
                  auth=(sid, token), timeout=30)
print(r.status_code, r.json())

The answer is 201 with the Message, status queued. From must be your line's own number, or the answer is 21606.

Place a call

curl -X POST "https://api.dongleswithwings.com/2010-04-01/Accounts/$ACCOUNT_SID/Calls.json" \
  --data-urlencode "To=+61491570157" \
  --data-urlencode "From=+61491570156" \
  --data-urlencode "Twiml=<Response><Play>https://example.com/hello.mp3</Play></Response>" \
  -u "$ACCOUNT_SID:$AUTH_TOKEN"

The answer is 201 with the Call, status queued. Its TwiML runs once the call is answered.

Receive calls and texts

Set your line's VoiceUrl and SmsUrl (see Phone numbers). We POST each incoming call or text there; your answer is TwiML. See Webhooks, and check every request's signature.