bird email send-batch
Usage
Contoh kode
bird email send-batch [flags]Description
Send a batch of email messages in one call
The body is a JSON object whose "messages" array holds the send requests
(up to 100). Every message is validated before any is queued, so if one fails
the whole batch is rejected. An item may set "scheduled_at" to go out later, so
one batch can mix scheduled and immediate messages; cancel a scheduled one with
"bird email cancel". Sending is outbound and irreversible: each result reports
"accepted", not "delivered". Read a message back with "bird email get" to
confirm delivery.
Build the request from flags, a JSON EmailMessageBatchRequest body via --body-file ("-" reads
stdin), or both — a flag overrides the matching body field. Run --example to
print a ready-to-edit body, or --dry-run to print the resolved request without
sending it.
Examples
Contoh kode
# print the body shape (no credentials needed)
bird email send-batch --example
# the body it prints:Contoh kode
{
"messages": [
{
"from": {
"email": "noreply@acme.com",
"name": "Acme Support"
},
"subject": "Your receipt for order #1234",
"text": "Thanks for your purchase! Your receipt is attached.",
"to": [
{
"email": "delivered@messagebird.dev",
"name": "Jane Doe"
}
]
},
{
"from": {
"email": "noreply@acme.com",
"name": "Acme Support"
},
"subject": "Your receipt for order #1235",
"text": "Thanks for your purchase! Your receipt is attached.",
"to": [
{
"email": "delivered@messagebird.dev",
"name": "John Roe"
}
]
}
]
}Contoh kode
# send a batch from a JSON body file
bird email send-batch --body-file batch.json
# preview the resolved batch without sending
bird email send-batch --body-file batch.json --dry-run
# pipe the batch in on stdin
cat batch.json | bird email send-batch --body-file -Options
Request
| Name | Description |
|---|---|
| --body-file | Read the JSON request body from this file; "-" reads stdin |
| --example | Print a complete example request body, then exit |
| --dry-run | Print the resolved request without sending it, then exit |
| --idempotency-key | Deduplication key; a retry with the same key won't act twice |
Options
| Name | Description |
|---|---|
| --response-schema | Print the fields this command returns, then exit |
Related
| Name | Description |
|---|---|
| bird email cancel | Cancel a scheduled message |
| bird email content | Get stored message content |
| bird email get | Get a message |
| bird email list | List messages |
| bird email recipients | List recipients of a message |
| bird email send | Send an email message |