Introduction
The send API lets you send a message to one or more recipients with a single call. Messages are sent asynchronously, so when you call the send API, the response will contain a request ID that you can use to check the status of your message later.
Recipients come in several forms:
- User - A single user
- List - A pre-defined list of users stored with Courier
- List pattern - A pattern that can target multiple lists of users at once
- Audience - A Courier audience containing users.
You may also pass an array containing any combination of the above.
For ad-hoc users:
{
"message": {
"to": {
"email": "darth@vader.com",
"phone_number": "+123456789"
}
}
}
For ad-hoc lists:
{
"message": {
"to": [
{"email": "example1@courier.com"},
{"email": "example2@courier.com"}
]
}
}
There are two styles of notification sending:
- by template
- ad-hoc
To send by template, first create a notification using Courier Studio, then pass the template ID in your send call. To send ad-hoc, include the content of the notification directly in the send call using Elemental.