net/http with connection pooling.
Available on
GitHub
and RubyGems.
Installation
Add to yourGemfile:
bundle install. Requires Ruby 3.2+.
Quick Start
The method is
send_ (with a trailing underscore) because send is a reserved method in Ruby.Authentication
Get your API key from Settings > API Keys in the Courier dashboard. Set it as an environment variable:Sending Notifications
With a template
With inline content
Available Resources
The SDK covers the full Courier API. Every method is documented with Yard docstrings.| Resource | Namespace | Description |
|---|---|---|
| Send | client.send_ | Send messages to one or more recipients |
| Messages | client.messages | Retrieve status, history, and content of sent messages |
| Profiles | client.profiles | Create, update, and retrieve user profiles |
| Users | client.users | Manage preferences, tenants, and push tokens per user |
| Auth | client.auth | Issue JWT tokens for client-side SDK authentication |
| Bulk | client.bulk | Send messages to large recipient lists via jobs |
| Lists | client.lists | Manage subscription lists and their subscribers |
| Audiences | client.audiences | Define and query audience segments |
| Tenants | client.tenants | Manage tenants for multi-tenant setups |
| Automations | client.automations | Invoke multi-step automation workflows |
| Brands | client.brands | Manage brand settings (logos, colors, templates) |
| Notifications | client.notifications | List and inspect notification templates |
| Translations | client.translations | Manage localized content |
Common Operations
Checking Message Status
Managing User Profiles
Issuing JWT Tokens
| Scope | Permission |
|---|---|
user_id:<id> | Which user the token is for (required) |
inbox:read:messages | Read inbox messages |
inbox:write:events | Mark messages as read/archived |
read:preferences | Read notification preferences |
write:preferences | Update notification preferences |
write:user-tokens | Register push notification tokens |
Configuration
Error Handling
The SDK throws typed errors for API failures. All errors extendCourier::Errors::APIError:
Retries
The SDK automatically retries failed requests up to 2 times with exponential backoff.Timeouts
Requests time out after 60 seconds by default. Configure globally or per-request:More Operations
The SDK covers the full Courier REST API. Here are a few more resources beyond what’s documented above:| Resource | Method | Use case |
|---|---|---|
| User preferences | client.users.preferences.retrieve(user_id) | Fetch a user’s notification preferences for your preference center |
| Cancel a message | client.messages.cancel(message_id) | Cancel a delayed or queued message before delivery |
| Push tokens | client.users.tokens.add_single(token, user_id:) | Register a device push token for iOS, Android, or React Native |
| Automations | client.automations.invoke.invoke_ad_hoc(automation:) | Run a multi-step workflow via Automations |
API Reference
Full REST API docs with request/response examples.
Send API
Learn about the Send endpoint, routing, and message options.
Quickstart
Send your first notification in under two minutes.
GitHub
Source code, issues, and changelog.