Two-way SMS
Receive replies, reserve keywords, answer automatically and handle STOP.
Two-way lets people text you. Inbound messages show in your conversations and reach your webhook. Keywords and auto-replies answer for you.
Numbers (short codes and long numbers) are set up by the operator. GET /v1/two-way shows the numbers your account can use.
curl -X GET "https://api.sms.jtnoble.com/v1/two-way" \
-H "Authorization: Bearer $JTSMS_API_KEY"const resp = await fetch('https://api.sms.jtnoble.com/v1/two-way', {
method: 'GET',
headers: { Authorization: `Bearer ${process.env.JTSMS_API_KEY}` },
});
console.log(resp.status, await resp.text());import os
import requests
resp = requests.get(
"https://api.sms.jtnoble.com/v1/two-way",
headers={"Authorization": f"Bearer {os.environ['JTSMS_API_KEY']}"},
timeout=30,
)
print(resp.status_code, resp.text)<?php
$ch = curl_init('https://api.sms.jtnoble.com/v1/two-way');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('JTSMS_API_KEY')],
]);
$body = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_RESPONSE_CODE), ' ', $body, PHP_EOL;{
"numbers": [
{ "id": 1, "number": "5050", "kind": "short_code", "mode": "shared", "label": null, "is_active": true }
],
"keywords": [],
"settings": { "default_reply_enabled": false, "default_reply": null, "stop_reply": null }
}Who gets an inbound message
- A number dedicated to an account goes to that account.
- On a shared number, the account that reserved the keyword gets it.
- Otherwise, the account that last messaged this person, within 30 days.
If none of these fits, the message is not stored.
Keywords
The first word of the message picks the keyword. A keyword is one word, 2 to 30 characters, stored in capitals.
curl -X POST "https://api.sms.jtnoble.com/v1/two-way/keywords" \
-H "Authorization: Bearer $JTSMS_API_KEY" \
-H "Content-Type: application/json" \
-d '{"keyword":"FEES","reply_text":"Thanks, we got your message."}'const resp = await fetch('https://api.sms.jtnoble.com/v1/two-way/keywords', {
method: 'POST',
headers: { Authorization: `Bearer ${process.env.JTSMS_API_KEY}`, 'Content-Type': 'application/json' },
body: JSON.stringify({"keyword":"FEES","reply_text":"Thanks, we got your message."}),
});
console.log(resp.status, await resp.text());import os
import requests
resp = requests.post(
"https://api.sms.jtnoble.com/v1/two-way/keywords",
headers={"Authorization": f"Bearer {os.environ['JTSMS_API_KEY']}"},
json={"keyword":"FEES","reply_text":"Thanks, we got your message."},
timeout=30,
)
print(resp.status_code, resp.text)<?php
$ch = curl_init('https://api.sms.jtnoble.com/v1/two-way/keywords');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('JTSMS_API_KEY'), 'Content-Type: application/json'],
CURLOPT_POSTFIELDS => '{"keyword":"FEES","reply_text":"Thanks, we got your message."}',
]);
$body = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_RESPONSE_CODE), ' ', $body, PHP_EOL;| Field | Required | Meaning |
|---|---|---|
keyword | Yes | The word. |
number_id | No | Keep it to one number. |
reply_text | No | Auto-reply, up to 612 characters. |
forward_url | No | Send matching messages to this public URL instead of your inbound webhook. |
is_active | No | Default true. |
HTTP 201:
{ "id": 1, "keyword": "FEES", "number_id": null, "number": null, "reply_text": "Thanks, we got your message.", "forward_url": null, "is_active": true, "hits": 0, "last_hit_at": null }Reserved words cannot be keywords (HTTP 400, code keyword_reserved): STOP, STOPALL, UNSUBSCRIBE, CANCEL, END, QUIT, OPTOUT, LEKA, START, UNSTOP, SUBSCRIBE, RESUME, OPTIN, HELP. A word already in use answers HTTP 409, code keyword_taken.
Auto-replies
curl -X PUT "https://api.sms.jtnoble.com/v1/two-way/settings" \
-H "Authorization: Bearer $JTSMS_API_KEY" \
-H "Content-Type: application/json" \
-d '{"default_reply_enabled":true,"default_reply":"Thanks for your message.","stop_reply":"You will get no more messages."}'const resp = await fetch('https://api.sms.jtnoble.com/v1/two-way/settings', {
method: 'PUT',
headers: { Authorization: `Bearer ${process.env.JTSMS_API_KEY}`, 'Content-Type': 'application/json' },
body: JSON.stringify({"default_reply_enabled":true,"default_reply":"Thanks for your message.","stop_reply":"You will get no more messages."}),
});
console.log(resp.status, await resp.text());import os
import requests
resp = requests.put(
"https://api.sms.jtnoble.com/v1/two-way/settings",
headers={"Authorization": f"Bearer {os.environ['JTSMS_API_KEY']}"},
json={"default_reply_enabled":True,"default_reply":"Thanks for your message.","stop_reply":"You will get no more messages."},
timeout=30,
)
print(resp.status_code, resp.text)<?php
$ch = curl_init('https://api.sms.jtnoble.com/v1/two-way/settings');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'PUT',
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('JTSMS_API_KEY'), 'Content-Type: application/json'],
CURLOPT_POSTFIELDS => '{"default_reply_enabled":true,"default_reply":"Thanks for your message.","stop_reply":"You will get no more messages."}',
]);
$body = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_RESPONSE_CODE), ' ', $body, PHP_EOL;default_replyanswers any message with no keyword, whendefault_reply_enabledis true.stop_replyanswers a STOP.
An auto-reply is a normal outgoing SMS and is charged like one.
STOP and START
STOP and START always work. A person who sends a stop word is added to your opt-out list, and you can no longer send to them (HTTP 403, code recipient_opted_out). A start word removes them.
Manage the list with GET, POST and DELETE /v1/opt-outs, POST /v1/opt-outs/import and GET /v1/opt-outs/export.
Inbound webhook
Set mo_url with PUT /v1/webhooks. Each inbound message is sent there, signed like every webhook:
{
"event": "message.inbound",
"message_id": "d7aa94ff-351d-4d29-99f2-9de9a5b41f78",
"from": "+2348031000111",
"to": "5050",
"text": "FEES hello",
"keyword": "FEES",
"opt_out": false,
"environment": "live",
"livemode": true,
"received_at": "2026-11-07T10:00:00+00:00"
}keyword is the word that matched, or STOP and the like for a stop or start word. opt_out is true when this message opted the person out.
Conversations
| Method | Path | What it does |
|---|---|---|
GET | /v1/conversations | Your conversations, newest first, and the unread total. |
GET | /v1/conversations/{phone} | All messages with one person. |
POST | /v1/conversations/{phone}/reply | Reply. Charged like a normal SMS. |
PATCH | /v1/conversations/{phone} | Mark read or archive. |
Test it
POST /v1/two-way/simulate pretends someone texted you. Nothing leaves the platform, and the conversation, keyword and webhook all run with "livemode": false. Read the conversation with ?environment=test.
curl -X POST "https://api.sms.jtnoble.com/v1/two-way/simulate" \
-H "Authorization: Bearer $JTSMS_API_KEY" \
-H "Content-Type: application/json" \
-d '{"from":"+2348031000111","text":"FEES hello"}'const resp = await fetch('https://api.sms.jtnoble.com/v1/two-way/simulate', {
method: 'POST',
headers: { Authorization: `Bearer ${process.env.JTSMS_API_KEY}`, 'Content-Type': 'application/json' },
body: JSON.stringify({"from":"+2348031000111","text":"FEES hello"}),
});
console.log(resp.status, await resp.text());import os
import requests
resp = requests.post(
"https://api.sms.jtnoble.com/v1/two-way/simulate",
headers={"Authorization": f"Bearer {os.environ['JTSMS_API_KEY']}"},
json={"from":"+2348031000111","text":"FEES hello"},
timeout=30,
)
print(resp.status_code, resp.text)<?php
$ch = curl_init('https://api.sms.jtnoble.com/v1/two-way/simulate');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('JTSMS_API_KEY'), 'Content-Type: application/json'],
CURLOPT_POSTFIELDS => '{"from":"+2348031000111","text":"FEES hello"}',
]);
$body = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_RESPONSE_CODE), ' ', $body, PHP_EOL;{ "status": "received", "attributed_to": "3f0c7a52-6d1e-4b9a-8f21-7c5e2a9d1b40", "action": null, "keyword": "FEES", "message_id": "d7aa94ff-351d-4d29-99f2-9de9a5b41f78" }action is opted_out or opted_in for a stop or start word.
See the two-way routes.