Courier Create is designed to be simple to embed and customize within your React application. This guide walks you through the basic setup and advanced usage patterns for integrating the Template Editor.
The token prop on TemplateProvider accepts a JWT issued by the Courier API. Generate this token server-side and pass it to your frontend; never expose your API key in the browser.
The example above grants access to all tenants. To restrict the token to a single tenant, use tenant-scoped scopes like tenant:tenant-123:read instead. See the Authentication page for the full list of available scopes.
You can restrict which channels appear in the template editor by using the routing.channels prop. This is useful when your application only uses specific channels (e.g., email-only workflows).To show only email (hiding Slack, SMS, push, etc.):
The channels array controls which channels appear in the editor - any channels not in that array will be hidden. You can include multiple channels if needed:
If your application lets users select which template to edit (for example, from a dropdown or list), pass the selected template ID to TemplateProvider. The provider creates templates automatically if they don’t exist, so you don’t need to check beforehand.
The key prop on TemplateProvider forces React to remount the component when the template changes. Without it, the editor may show stale content from the previous template because the internal state does not fully reset on prop changes alone.
Always include the key prop when templateId changes dynamically. This applies whether the editor is on a regular page, inside a modal, or in any other context.
Courier Create works inside modals and dialogs. The same key prop pattern applies; React portals (used by most modal libraries) can prevent proper state updates when props change.
Variables are placeholders in your template that get replaced with actual data when the email is sent. For example, instead of writing Hello customer you can write Hello {{user.firstName}}, which will display the recipient’s actual name.The Courier Embeddable editor supports nested variable structures:
This forces React to remount the provider and reset its internal state. This issue is most common when the editor is inside a modal or dialog (React portal), but can occur in any context where templateId changes dynamically.
Verify that TemplateProvider receives a valid token when the modal opens. If you generate the JWT lazily, the token may not be ready on first render. Either generate the token before opening the modal or conditionally render the provider: