Skip to main content
Use the Courier API to send notifications from your app when important events happen, like a new sign-up, order update, or password reset. Each send request specifies the recipient, content, and delivery channels. Let’s start with a simple example. The example below sends a welcome email using inline content without a template to show how the Send API works over a single channel.
const { requestId } = await courier.send({
  message: {
    to: { email: "[email protected]" },
    content: {
      title: "Welcome!",
      body: "Thanks for signing up, {{name}}"
    },
    data: { name: "John Doe" },
    routing: {
      method: "single",
      channels: ["email"]
    }
  }
});
Courier also supports SDKs to send with popular languages and frameworks. Check out the courier-samples repository for ready-to-run Courier send examples.
As you can see in the example, every send request contains a message object that defines who the message is for, what it should say, and how it should be sent.
Here are the core components:
  • to — Identifies the recipient (email address, phone number, or Courier User object).
  • content — Defines the message content, either inline or through a saved template.
  • routing — Specifies which channels to use and how Courier should deliver the message.
  • data — Provides variables that personalize your message or populate template fields.

Sending Messages with Templates

Templates are an easy way to create, update, and manage notification content in Courier without changing your code. The template parameter accepts either a template ID or a template alias. Template IDs are permanent unique identifiers, while aliases are human-readable names you can give a template (eg welcome-email).
{
  "message": {
    "template": "JN96DHQ99CMNZ5KVQ2RXJ1XYJRHT",
    "to": { "user_id": "user_123" },
    "data": {
      "name": "John Doe",
      "company": "Acme Corp"
    }
  }
}

Sending to Users

Send to a Courier User by specifying their user_id in the to field. Courier automatically looks up the user’s stored identifiers (email, phone, push tokens, chat handles) and applies your routing rules to deliver the message through the best available channels. Use profile variables from the user object in your templates or channel conditions to personalize message content and control which channels are used.
{
  "user_id": "user_123",
  "profile": {
    "email": "[email protected]",
    "phone_number": "+1234567890",
    "custom": {
      "name": "John Doe",
      "subscription_tier": "premium",
      "company": "Acme Corp",
      "role": "admin"
    }
  }
}

Sending to Multiple Channels

You can send a single message across multiple channels using routing rules. In this example, Courier will try each channel in order until the message is successfully delivere
{
  "message": {
    "to": { "user_id": "user_123" },
    "template": "order-confirmation", // Template alias
    "routing": {
      "method": "priority",
      "channels": ["email", "sms", "push"]
    },
    "data": {
      "order_id": "ORD-12345",
      "total": "$99.99"
    }
  }
}
Courier supports three routing strategies that define how messages flow across channels:
  • single — Send through the best available channel for the user, such as email or SMS.
  • priority — Try channels in the listed order until one succeeds. Ideal for fallback delivery (for example, try push first, then email).
  • all — Send through every listed channel at once so users receive the message everywhere they’re active.
Routing rules help you balance reach and reliability, ensuring each message is delivered on the right channel at the right time.

What Channels does Courier Support?

Courier supports sending through multiple channel types. Each channel can connect to one or more providers that you configure in your workspace. Each channel is configured independently. You can include any combination of channels in a single send request and control delivery order or fallback behavior using routing rules.

Sending to Multiple Users

Send the same message to multiple recipients in a single API call by using an array in the to field:
{
  "message": {
    "to": [
      { "email": "[email protected]" },
      { "email": "[email protected]" },
      { "email": "[email protected]" }
    ],
    "template": "FRH3QXM9E34W4RKP7MRC8NZ1T8V8",
    "data": {
      "payload": "Example payload"
    }
  }
}
When sending to multiple users, Courier processes each recipient individually. Each user receives their own personalized message based on their profile data and the template variables you provide. The data object applies to all recipients. For user-specific personalization, ensure your template uses profile-based variables ({{profile.variable}}).
Pro Tip: Start with simple sends and gradually add complexity. Use Courier’s message logs to monitor delivery success and identify areas for optimization.