Welcome to Courier! In this guide we’ll walk you through the basics for sending your first notification through different methods:

  1. A templated message
  2. An inline message

Courier offers both a web-based notification designer so that anyone, regardless of technical proficiency, can create and edit templates, and a robust API infrastructure that can be used to send messages programmatically through your preferred tech stack.

Creating a Templated Notification

To create your first notification, head to the asset manager and create a notification from the new button. Select Message Template, and follow the prompt to name your notification.

Configure Delivery Channels

After creating your message template, you will need to add the delivery channels you want to use with your template. For now, we’ll use an email channel and select SendGrid as the provider.

Select your channel provider

Delivery Routing Strategy

By default, message templates in the Courier designer will be configured to use the best of routing strategy. This means that if your message template has multiple delivery channels, Courier will send to the first channel in the list and fallback on the following channels if the send request encounters a profile error. Below you can find a brief breakdown of the different routing strategies:

StrategyRouting DescriptionAPI Definition
Best ofCourier will attempt to send to the first channel configured in the message template. Any subsequent channels will be used if the request encounters an INCOMPLETE_PROFILE error, and continue down the list until all options have been exhausted.single
Always send toCourier will send to all configured channels in the message template.all

Create Your Notification Content

Now that you have selected a channel and provider, you can begin creating content to your notification using content blocks. If you’re hitting writer’s block, Courier offers an AI content assistant that can help you draft a message based on the prompt you provide. For this example, we’ll create a message using some text blocks, image blocks, and CTA buttons.

Once you’re happy with the content in your email channel, you can create another channel and repurpose the blocks you’ve already created from the Content Library. Courier dynamically adjusts content blocks to match every channel’s technical specifications. In this case, the SMS channel has created a URL since buttons cannot be rendered for SMS messages.

Preparing a Test Event to Configure Data and Recipients

As a developer-focused product, Courier uses JSON-formatted data payloads to programmatically insert related customer data into your templates such as names, dates, email, phone numbers and other user-specific information that pertains to the recipient. The following breakdown highlights two important aspects of a Courier send request:

JSON ObjectDescriptionAPI Definition
DataThe data object in the send request stores all data about a recipient. This can come from an event like Segment Track, which includes information like date, flight time, name, etc. Placeholder variables inside a message template will reference the key-value pairs in this field. If the template has {name}, then Courier will look for the equivalent key value in the test event "name": "John Doe" and populate the template accordingly.data
ProfileThe profile object contains all your recipient information. This can be an email, phone_number, and not limited to other custom fields. Profile objects can also include names, but if you want to reference data from the profile in your message template, you must format the path like {profile.name}.to

For now, copy and paste this sample test event and use it for your send and replace the email field with your own.

{
  "data": {
    "name": "Spike Spiegel"
  },
  "profile": {
    "email": "REPLACE_WITH_YOUR_EMAIL"
  }
}

Preview and Publish your Notification

After editing your template, you can preview your notification from the preview tab to see how it will render in different email clients. Here you can also see how dynamic variables will render from the test data in your test events.

To make your changes live and ready to use, you need to Publish your changes from the top right corner. Now it’s time to send.

Sending your Templated Notification

Now that you’re happy with your message template, how it looks, and you’ve published it, it’s time to send. We’ll cover 2 ways you can send your notification:

  • Through the send tab in the message template
  • Through an API platform like Postman or Insomnia

Sending from the Designer

Once your template is ready to send, you can head to the send tab and click on the greenSend Test button. Courier will send the notification to the email you provided in the previous test event. You can check the logs to see the status of the send.

Sending from an API Platform

Using an API platform to test your notification sends requires the following to make a successful send:

  • An API endpoint we will be making the request to.
  • Your message template ID. This is an alphanumerical ID in all caps.
  • Your Courier API key from the environment you’re sending from.
  • A configured JSON body consisting of at least a profile.

The send API uses the https://api.courier.com/send endpoint to send messages. Copy this and paste in your API platform editor.

Your message template ID can be found in the main notification settings by clicking on the cog at the top right. Additionally, you can copy your environment API key here and use it in the header of your API request.

Use the example JSON body below and paste it to your API platform editor, replacing the template, and email fields with your own:

Remember, the to object is the same as profile.

// Endpoint: https://api.courier.com/send
// Method: POST
{
	"message": {
		"template": "REPLACE_WITH_YOUR_TEMPLATE_ID",
		"to": {
			"email": "REPLACE_WITH_YOUR_EMAIL"
		},
		"data": {
			"name": "Spike Spiegel"
		}
	}
}