Sign inGet started

bird email send-batch

Usage

Code example
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

Code example
# print the body shape (no credentials needed)
bird email send-batch --example

# the body it prints:
Code example
{
  "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"
        }
      ]
    }
  ]
}
Code example
# 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

NameDescription
--body-fileRead the JSON request body from this file; "-" reads stdin
--examplePrint a complete example request body, then exit
--dry-runPrint the resolved request without sending it, then exit
--idempotency-keyDeduplication key; a retry with the same key won't act twice

Options

NameDescription
--response-schemaPrint the fields this command returns, then exit
NameDescription
bird email cancelCancel a scheduled message
bird email contentGet stored message content
bird email getGet a message
bird email listList messages
bird email recipientsList recipients of a message
bird email sendSend an email message