Sends a message from one of this org's own numbers.
Sends a message from one of this org's own numbers.
POST /v1/tel/messages
| Address | https://api.hanzo.ai/v1/tel/messages |
| Method | POST |
| Operation | post_tel_messages |
| Auth | Authorization: Bearer $HANZO_API_KEY |
Sends a message from one of this org's own numbers.
from must be a number the org HOLDS, checked against the store rather than
taken on trust — a caller that could send from any number could impersonate
one, and the carrier would deliver it. to is required, and the body needs
text or media, because a message with neither is delivered as nothing and
billed as something.
Request
4 fields, body application/json (required).
| Field | In | Type | Required | Description |
|---|---|---|---|---|
from | body | string | — | From is the number to send FROM, in E.164. |
media | body | string[] | — | Media are URLs to attach. |
text | body | string | — | Text is the message body. |
to | body | string | — | To is the number to send to, in E.164. |
Response
| Status | Body | Meaning |
|---|---|---|
201 | SMS | created |
201 body — 6 fields.
| Field | In | Type | Always | Description |
|---|---|---|---|---|
from | body | string | — | From is the sending number in E.164, and must be one this org holds. |
id | body | string | — | ID is the carrier's handle for the message. |
org | body | string | — | Org is the tenant the message was sent for or received by. |
status | body | string | — | Status is where the message is: "queued", "sent", "delivered" or "failed". |
text | body | string | — | Text is the message body. |
to | body | string | — | To is the receiving number in E.164. |
Failure carries the platform error shape — see Errors.
Examples
hanzo tel messages createimport { Configuration, TelApi } from 'hanzoai';
const api = new TelApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.postTelMessages({ from: "<from>", media: ["<media>"] });from hanzoai.cloud import ApiClient, Configuration
from hanzoai.cloud.api import TelApi
client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = TelApi(client).post_tel_messages(from="<from>", media=["<media>"])cfg := cloud.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := cloud.NewAPIClient(cfg)
resp, _, err := client.TelAPI.PostTelMessages(context.Background()).Execute()
if err != nil {
return err
}use hanzo_cloud::apis::{configuration::Configuration, tel_api};
let mut cfg = Configuration::new();
cfg.bearer_access_token = std::env::var("HANZO_API_KEY").ok();
let result = tel_api::post_tel_messages(&cfg, Default::default()).await?;import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.TelApi;
ApiClient client = new ApiClient();
client.setRequestInterceptor(b -> b.header("Authorization", "Bearer " + System.getenv("HANZO_API_KEY")));
var result = new TelApi(client).postTelMessages();curl -X POST https://api.hanzo.ai/v1/tel/messages \
-H "Authorization: Bearer $HANZO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"from": "<from>",
"media": [
"<media>"
]
}'The door reaches tel through the tel tool, which names its 10 operations with its own verbs — this one among them, under a name only the door declares. describe explains any of them:
curl -X POST https://api.hanzo.ai/v1/mcp \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "describe",
"arguments": {
"op": "list_tel_calls"
}
}
}'How is this guide?