Why use Lists?
Many times there are groups of users you want to message with the same notification triggered by the same event. In the past, this meant tens or sometimes thousands of API calls, triggering the same notification over and over. With Courier’s Lists API, you’re able to create lists, subscribe recipient profiles to them and send to every user on the list with a single Send API call. When you send to a list, Courier handles the message fan-out following user preferences and your channel priorities–to deliver across Push, Email, SMS, Messaging Apps, and more. With the Lists API, you can easily do things like:- Reach every user in a shared workspace.
- Notify all users who follow a specific project.
- Alert users subscribed to a blog category
- Message users who opt into specific notifications.
What are Lists and Lists Patterns?
A list usually represents some kind object in your system. Once you’ve created a List, you can send a message to all the recipients you subscribed to that List with a single Send API call (Courier handles the fan-out). When naming your Courier Lists, we recommend you follow our List Pattern guidelines. Using this pattern will allow you to use wildcarding to send to multiple Lists with a single Send API call.Understanding and defining List ID Patterns
Courier supports List IDs with up to four parts to enable wildcard sending. Thinking about how to structure your List IDs according to Courier’s List pattern support (up to four parts in a List) will allow you to send to multiple List parts within a related pattern using a single API call. **Follow this basic pattern when defining List IDs.part1part1.part2part1.part2.part3part1.part2.part3.part4
part1.part2 as the List id when creating a List, that’s a single List with the id of part1.part2
Example: subscribing a user to part1.part2 does not automatically subscribe users to part1
List Pattern Examples
As an example, let’s apply this relational pattern to Pokémon:pokemonpokemon.typepokemon.type.generationpokemon.type.generation.evolution
pokemonpokemon.grasspokemon.firepokemon.grass.gen1pokemon.grass.gen2pokemon.fire.gen1pokemon.fire.gen2pokemon.grass.gen1.evolution1pokemon.fire.gen1.evolution1
Using Patterns and wildcards to send to multiple Lists at a time
Following this four-part List pattern allows you to send to more than one List at the same time by using wildcards. You can wildcard up to 3 of the 4 parts within a List pattern. Using a single asterisk* will wildcard every List within that part.
Using a double asterisk ** will wildcard every List in every part that follows the first part. IE it’s like saying “all List that start with”.
Here are a few wildcard examples using our Pokemon Lists:
pokemon.*.gen1
pokemon.*.gen1 would only send to the unique users subscribed to these exact lists:
pokemon.grass.gen1pokemon.fire.gen1
pokemon.grass.* would only send to the unique users subscribed to these exact lists:
pokemon.grass.gen1pokemon.grass.gen2
pokemon.fire.** would only send to the unique users subscribed to these exact lists:
pokemon.fire.gen1pokemon.fire.gen2pokemon.fire.gen1.evolution1
pokemon.** would send to every unique user subscribed to any list below pokemon.
pokemon.grasspokemon.firepokemon.grass.gen1pokemon.grass.gen2pokemon.fire.gen1pokemon.fire.gen2pokemon.grass.gen1.evolution1pokemon.fire.gen1.evolution1
Invalid Lists, List Patterns and Wildcards
Sending to a list or list pattern
To send to a list or list pattern use thePOST /send endpoint
SEND APIPOST /send