Skip to main content

How to Design a Notification with the API

Overview

Learn how to create notification templates programmatically using Courier’s API, including template structure, variables, and content blocks.

Key Concepts

  • Template Structure: Understanding the JSON schema for notifications
  • Content Blocks: Using text, image, action, and other block types
  • Variables: Inserting dynamic data into your templates
  • Branding: Applying consistent styling across templates
  • Versioning: Managing template updates and rollbacks

When to Use This

Use this approach when you need to create templates programmatically, integrate with existing workflows, or manage templates through code.

Quick Example

{
  "notification": {
    "id": "welcome-email",
    "title": "Welcome to our platform!",
    "content": {
      "blocks": [
        {
          "type": "text",
          "text": "Hello {{user.name}}, welcome to our platform!"
        },
        {
          "type": "action",
          "text": "Get Started",
          "url": "{{user.onboarding_url}}"
        }
      ]
    }
  }
}

Next Steps