Create a batch of SMS messages
/v1/sms/batchesconst result = await bird.sms.sendBatch({
messages: [
{
from: "+15557654321",
to: "+15551111111",
text: "Hi Alice!",
category: "marketing",
},
{
from: "+15557654321",
to: "+15552222222",
text: "Hi Bob!",
category: "marketing",
},
],
});batch = client.sms.send_batch(
messages=[
{
"from_": "+15557654321",
"to": "+15551111111",
"text": "Hi Alice!",
"category": "marketing",
},
{
"from_": "+15557654321",
"to": "+15552222222",
"text": "Hi Bob!",
"category": "marketing",
},
]
)
for msg in batch.data:
print(msg.id, msg.status)batch, err := client.Sms.SendBatch(context.Background(), bird.SmsSendBatchParams{
Messages: []bird.SmsSendParams{
{
From: "+15557654321", To: "+15551111111",
Text: "Hi Alice!", Category: bird.SMSCategoryMarketing,
},
{
From: "+15557654321", To: "+15552222222",
Text: "Hi Bob!", Category: bird.SMSCategoryMarketing,
},
},
})
if err != nil {
log.Fatal(err)
}
for _, msg := range batch.Data {
fmt.Println(msg.Id, *msg.Status)
}$batch = $bird->sms->sendBatch(messages: [
(new SMSMessageSendRequest())
->setFrom('+15557654321')
->setTo('+15551111111')
->setText('Hi Alice!')
->setCategory('marketing'),
(new SMSMessageSendRequest())
->setFrom('+15557654321')
->setTo('+15552222222')
->setText('Hi Bob!')
->setCategory('marketing'),
]);
foreach ($batch->getData() ?? [] as $item) {
echo $item->getId(), ' ', $item->getStatus(), "\n";
}curl -X POST "https://us1.platform.bird.com/v1/sms/batches" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"messages": [
{
"to": "+15551111111",
"from": "+15557654321",
"text": "Hi Alice!",
"category": "marketing"
},
{
"to": "+15552222222",
"from": "+15557654321",
"text": "Hi Bob!",
"category": "marketing"
}
]
}'{
"data": [
{
"id": "sms_01krdgeqcxet5s7t44vh8rt9mg",
"direction": "outbound",
"content_type": "mms",
"status": "accepted",
"from": "+12025550123",
"to": "+12025550199",
"text": "Order ready",
"subject": "Order update",
"category": "transactional",
"media": [
{
"mime_type": "application/octet-stream",
"url": "https://example.com/order.jpg"
}
],
"segments": {
"count": 1,
"encoding": "MMS",
"characters": 11
},
"requested_language": null,
"resolved_language": null,
"template_id": null,
"template_version_id": null,
"template_content_hash": null,
"created_at": "2026-05-21T12:00:00Z"
}
],
"summary": {
"accepted_count": 2
}
}
Sends up to 100 independent SMS or MMS messages in one request. Each item is a complete send request with its own recipient, content, ID, status, and cost. For a single message, use Send an SMS message instead.
A nonempty subject or media_urls selects MMS for that item. MMS requires
text or media, a +1 recipient and an MMS-capable number held by the workspace;
it uses one message unit at MMS rates. Templates remain text-only.
Acceptance is all-or-nothing: every item is validated before any is queued,
and one invalid item rejects the whole batch with a 422 (nothing is
sent). A batch from a workspace with no wallet balance fails with a 402.
The 202 response lists the accepted messages in submission order; each
delivers asynchronously and is tracked individually, like a single send.
Items sent to the capacity-test range (+15005551000 to +15005551999) stop
at 202 with no charge, stored record (404 on reads), or webhooks, while
ordinary items in the same batch progress normally.
请求载荷
messagesSMS message send requests, up to 100. Each is an independent send; all are validated before any is queued.
响应载荷
相关资源
继续查看此主题的文档、指南和示例。