Loading...
Skip to main content

Using Environments, API Keys, and Migrating Assets

Explanation of Courier environments, API key settings, and how to move templates and assets between the Live and Test environments.

Production and Test Environments

Every Courier tenant has two notification development environments: Production and Test. The two environments are isolated from one another, and all the assets within them (templates, brands, tags, subscription topics, integrations, API keys, log data, etc.) belong only to that environment.

Any changes made to a template and its associated assets are only applied within the current environment until you migrate the template and overwrite any changes to the corresponding Notification ID and assets in the other environment.

Switching Between Live and Test Environments

Use the Environments Toggle in the lower-left settings menu to switch between your Production and Test environments. Look for the Test Environment indicator at the top of the application window to confirm that you're in the test environment.

Use the Environments Toggle to Switch Between Environments
Info

Simply switching from Production to Test does not impact your notifications in either environment in any way. It just changes the environment you are viewing.

API Keys and Environments

Within each environment, Production and Test, there are two states: draft and published. Each state has its own unique API key, giving you four distinct API keys.

The keys are prefaced in a way that helps you identify which key you are using:

  • pk_prod_ = The API key for your published data in the Production environment
  • dk_prod_ = The API key for your draft data in the Production environment
  • pk_test_ = The API key for your published data in the Test environment
  • dk_test_ = The API key for your draft data in the Test environment
Your Test Environment API Keys

Generate New API Keys

Courier customers have the ability to create new API keys and have more than 2 keys per environment to enable additional development workflows.

Generate New API Keys

Define the Routing Behavior of Custom API Keys

In addition to the ability to create new API Keys, Business Tier customers can define the routing behavior of their API Keys. A mock key will simulate the Courier notification/message lifecycle - but won't invoke the downstream provider. This lets you see how the request flows inside of Courier without incurring any send cost.

Define Routing Behavior for Custom API Keys

Notifications, Assets and Environments

The environments feature allows you to move a template and its associated assets (like brands, tags and subscription topics) between environments. You can move them from Test to Production and from Production to Test. You can also select the destination Tenant when migrating assets.

In order to copy a template between environments. Courier must also copy all dependencies attached to the template to ensure functionality is preserved. After you've copied associated assets once (e.g. Brand, Category), you will have the option to overwrite those in future migrations.

Note

Courier will copy the current template. All other assets copied will be their most recent published version.

Migrating Templates and Assets Between Environments

  1. Open the notification you wish to migration.
  2. Open the dropdown menu in the 'Publish Changes' button.
  3. Select 'Migrate Assets'.
Migrate Your Template and Assets
Click the 'Copy Assets' Button to be Prompted by a Confirmation Modal
  1. Select either 'Copy Assets' or 'Copy And Publish' option.
Copy Templates and Assets Confirmation Modal
Confirm by Selecting 'Copy And Publish'

Migrating Templates to Another Workspace

If you have multiple workspaces, migrating a template between workspaces is as easy as selecting from a dropdown menu.

  1. In the migrate assets modal, choose a Destination Workspace from the dropdown menu.
Select Destination Workspace From Dropdown
  1. Select the workspace you wish to migrate your template to.
Choose the Destination Workspace
  1. The template will be migrated to the selected workspace and environment.
Migrated Template in New Workspace

Event Mapping and Template Migration

If you have an event mapped to a template that you are migrating between environments, the event and its mapping will automatically migrate as well.

If the associated event is already mapped to a different template in the destination environment, then you will receive an error:

Event Mapping Error

Integrations and Environments

Your integrations exist across environments, so you only need to add your integration once and it will be available in both Production and Test.

Adding a Test Environment Configuration

By default, all of your integrations work in both the test and production environments. But, if you'd prefer an extra layer of security, you can add a test API key for your integration that will only send notifications from Courier's test environment.

The Test Configuration means Courier will use this configuration when sending a notification using a test API Key.

Courier Integrations Allow Users to Set An Integration for Both Environments

Data Logs, Metrics, and Environments

Your Data Logs and Metrics are environment-specific. Sends of Notifications using the pk_test_ and dk_test_ keys will only appear in the Data and Metrics dashboard of the Test environment. While pk_prod_ and dk_prod_ sends will only appear in the Data Logs and Metrics for the Production environment.

Courier APIs and Environments

The environment and state-specific API key (pk_prod_, dk_prod_, pk_test_, dk_test_) you use when interacting with Courier's APIs will perform the command for that environment and state only.

In other words, if you create a list via the Lists API using the Draft Test API key (dk_test_), you will create a list that can only be used to send notifications in the draft state in the Test environment.

Segment and Environments

To use Courier environments with Segment, create multiple Courier sources in Segment with different Environment API keys.

One way to implement this could be:

  1. Send your production data from Segment to your Courier production environment using the published Production key pk_prod_.
  2. Set up a second destination to send data from Segment to your Courier Test environment using the published Test key pk_test_.
  3. Map the Track events to your templates in the test environment.

For more details, read: Setting up Courier's Segment integration.

Environments and Billing

Note that billing takes both test and production sends into account.