import { CommuneClient } from 'commune-ai';
const commune = new CommuneClient({ apiKey: process.env.COMMUNE_API_KEY });
const messages = await commune.sms.list({
phoneNumberId: 'pn_01abc123',
limit: 20,
});
for (const msg of messages) {
console.log(msg.message_id, msg.direction, msg.content);
}
from commune import CommuneClient
client = CommuneClient()
messages = client.sms.list(
phone_number_id="pn_01abc123",
limit=20,
)
for msg in messages:
print(msg.message_id, msg.direction, msg.content)
list_sms_messages(
phone_number_id="pn_01abc123",
limit=20
)
curl "https://api.commune.email/v1/sms?phone_number_id=pn_01abc123&limit=20" \
-H "Authorization: Bearer comm_..."
commune sms list --phone-number-id pn_01abc123
{
"data": [
{
"message_id": "sms_SMabc123def456",
"thread_id": "a1b2c3d4e5f6789012345678901234ab",
"direction": "outbound",
"content": "Hello from your AI agent!",
"created_at": "2026-02-25T10:00:00.000Z",
"metadata": {
"delivery_status": "delivered",
"from_number": "+18005550001",
"to_number": "+14155559999",
"phone_number_id": "pn_01abc123",
"message_sid": "SMabc123def456",
"credits_charged": 2,
"sms_segments": 1,
"has_attachments": false,
"mms_media": null,
"delivery_data": {
"sent_at": "2026-02-25T10:00:01.000Z",
"delivered_at": "2026-02-25T10:00:03.000Z"
}
}
},
{
"message_id": "sms_SMxyz987",
"thread_id": "a1b2c3d4e5f6789012345678901234ab",
"direction": "inbound",
"content": "Got it, thanks!",
"created_at": "2026-02-25T10:05:00.000Z",
"metadata": {
"delivery_status": "delivered",
"from_number": "+14155559999",
"to_number": "+18005550001",
"phone_number_id": "pn_01abc123",
"message_sid": "SMxyz987",
"credits_charged": 1,
"sms_segments": 1,
"has_attachments": false,
"mms_media": null,
"delivery_data": null
}
}
]
}
SMS
List SMS Messages
List SMS and MMS messages for your organization, optionally filtered by phone number.
GET
/
v1
/
sms
import { CommuneClient } from 'commune-ai';
const commune = new CommuneClient({ apiKey: process.env.COMMUNE_API_KEY });
const messages = await commune.sms.list({
phoneNumberId: 'pn_01abc123',
limit: 20,
});
for (const msg of messages) {
console.log(msg.message_id, msg.direction, msg.content);
}
from commune import CommuneClient
client = CommuneClient()
messages = client.sms.list(
phone_number_id="pn_01abc123",
limit=20,
)
for msg in messages:
print(msg.message_id, msg.direction, msg.content)
list_sms_messages(
phone_number_id="pn_01abc123",
limit=20
)
curl "https://api.commune.email/v1/sms?phone_number_id=pn_01abc123&limit=20" \
-H "Authorization: Bearer comm_..."
commune sms list --phone-number-id pn_01abc123
{
"data": [
{
"message_id": "sms_SMabc123def456",
"thread_id": "a1b2c3d4e5f6789012345678901234ab",
"direction": "outbound",
"content": "Hello from your AI agent!",
"created_at": "2026-02-25T10:00:00.000Z",
"metadata": {
"delivery_status": "delivered",
"from_number": "+18005550001",
"to_number": "+14155559999",
"phone_number_id": "pn_01abc123",
"message_sid": "SMabc123def456",
"credits_charged": 2,
"sms_segments": 1,
"has_attachments": false,
"mms_media": null,
"delivery_data": {
"sent_at": "2026-02-25T10:00:01.000Z",
"delivered_at": "2026-02-25T10:00:03.000Z"
}
}
},
{
"message_id": "sms_SMxyz987",
"thread_id": "a1b2c3d4e5f6789012345678901234ab",
"direction": "inbound",
"content": "Got it, thanks!",
"created_at": "2026-02-25T10:05:00.000Z",
"metadata": {
"delivery_status": "delivered",
"from_number": "+14155559999",
"to_number": "+18005550001",
"phone_number_id": "pn_01abc123",
"message_sid": "SMxyz987",
"credits_charged": 1,
"sms_segments": 1,
"has_attachments": false,
"mms_media": null,
"delivery_data": null
}
}
]
}
import { CommuneClient } from 'commune-ai';
const commune = new CommuneClient({ apiKey: process.env.COMMUNE_API_KEY });
const messages = await commune.sms.list({
phoneNumberId: 'pn_01abc123',
limit: 20,
});
for (const msg of messages) {
console.log(msg.message_id, msg.direction, msg.content);
}
from commune import CommuneClient
client = CommuneClient()
messages = client.sms.list(
phone_number_id="pn_01abc123",
limit=20,
)
for msg in messages:
print(msg.message_id, msg.direction, msg.content)
list_sms_messages(
phone_number_id="pn_01abc123",
limit=20
)
curl "https://api.commune.email/v1/sms?phone_number_id=pn_01abc123&limit=20" \
-H "Authorization: Bearer comm_..."
commune sms list --phone-number-id pn_01abc123
{
"data": [
{
"message_id": "sms_SMabc123def456",
"thread_id": "a1b2c3d4e5f6789012345678901234ab",
"direction": "outbound",
"content": "Hello from your AI agent!",
"created_at": "2026-02-25T10:00:00.000Z",
"metadata": {
"delivery_status": "delivered",
"from_number": "+18005550001",
"to_number": "+14155559999",
"phone_number_id": "pn_01abc123",
"message_sid": "SMabc123def456",
"credits_charged": 2,
"sms_segments": 1,
"has_attachments": false,
"mms_media": null,
"delivery_data": {
"sent_at": "2026-02-25T10:00:01.000Z",
"delivered_at": "2026-02-25T10:00:03.000Z"
}
}
},
{
"message_id": "sms_SMxyz987",
"thread_id": "a1b2c3d4e5f6789012345678901234ab",
"direction": "inbound",
"content": "Got it, thanks!",
"created_at": "2026-02-25T10:05:00.000Z",
"metadata": {
"delivery_status": "delivered",
"from_number": "+14155559999",
"to_number": "+18005550001",
"phone_number_id": "pn_01abc123",
"message_sid": "SMxyz987",
"credits_charged": 1,
"sms_segments": 1,
"has_attachments": false,
"mms_media": null,
"delivery_data": null
}
}
]
}
Query Parameters
string
Filter messages to a specific phone number. Format:
pn_.... If omitted, returns messages across all phone numbers in your organization.number
default:"20"
Maximum number of messages to return. Maximum: 100.
string
Cursor for pagination. Returns messages created before this message ID or timestamp.
string
Cursor for pagination. Returns messages created after this message ID or timestamp.
Response
SmsMessage[]
Array of messages in descending chronological order (newest first).
Hide SmsMessage properties
Hide SmsMessage properties
string
Unique message ID. Format:
sms_SM...string
Conversation thread ID (32 hex characters).
string
One of:
inbound, outbound.string | null
Message body text.
string
ISO 8601 timestamp when the message was created.
object
Show properties
Show properties
string | null
One of:
queued, sent, delivered, failed, undelivered, received, blocked, credit_limit.string | null
Sender phone number in E.164 format.
string | null
Recipient phone number in E.164 format.
string | null
ID of the Commune phone number involved.
string | null
Raw Twilio message SID.
number | null
Credits deducted for this message.
number | null
Number of SMS segments.
boolean
Whether this message contains MMS media attachments.
object[] | null
Last modified on March 19, 2026
Was this page helpful?

