# Create PinPoint Email Template

**Action ID:** `create_pinpoint_email_template`

## Description

Create a new email template for Amazon Pinpoint.

## Input Schema

```json
{
  "description": "Create PinPoint email template node input.",
  "properties": {
    "template_name": {
      "description": "The name of the message template.",
      "title": "Template Name",
      "type": "string"
    },
    "html": {
      "description": "The message body, in HTML format, to use in email messages that are based on the message template.",
      "title": "The message body, in HTML format.",
      "type": "string"
    },
    "text": {
      "description": "The message body, in plain text format, to use in email messages that are based on the message template.",
      "title": "The message body, in plain text format.",
      "type": "string"
    },
    "subject": {
      "description": "Email subject.",
      "title": "Email subject",
      "type": "string"
    },
    "template_description": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "A custom description of the message template.",
      "title": "Template description"
    }
  },
  "required": [
    "template_name",
    "html",
    "text",
    "subject"
  ],
  "title": "CreatePinPointEmailTemplateNodeInput",
  "type": "object"
}
```

## Output Schema

```json
{
  "description": "Create Pinpoint email template node output.",
  "properties": {
    "arn": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The Amazon Resource Name (ARN) of the message template that was created",
      "title": "The Amazon Resource Name (ARN) of the message template that was created"
    },
    "message": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The message that's returned from the API for this request",
      "title": "The message that's returned from the API for this request"
    },
    "request_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The unique identifier for the request",
      "title": "The unique identifier for the request"
    }
  },
  "title": "CreatePinpointEmailTemplateNodeOutput",
  "type": "object"
}
```

## How It Works

This node creates a reusable email template in Amazon Pinpoint that can be used across multiple email campaigns. You provide the template name, HTML body, plain text version, and subject line. The node communicates with the AWS Pinpoint API to store your template in your AWS account, making it available for use in future email campaigns. The template supports personalization variables and can be referenced by name when creating campaigns.

## Usage Examples

### Example 1: Welcome Email Template

**Input:**

```
template_name: "welcome_email_v1"
subject: "Welcome to {{User.UserAttributes.CompanyName}}!"
html: "<html><body><h1>Welcome {{User.UserAttributes.FirstName}}!</h1><p>We're excited to have you on board.</p><a href='{{User.UserAttributes.ActivationLink}}'>Activate Account</a></body></html>"
text: "Welcome {{User.UserAttributes.FirstName}}! We're excited to have you on board. Activate your account: {{User.UserAttributes.ActivationLink}}"
template_description: "New user welcome email with account activation link"
```

**Output:**

```
arn: "arn:aws:mobiletargeting:us-east-1:123456789012:templates/welcome_email_v1/EMAIL"
message: "Template created successfully"
request_id: "abc123-def456-ghi789"
```

### Example 2: Order Confirmation Template

**Input:**

```
template_name: "order_confirmation_2024"
subject: "Order #{{User.UserAttributes.OrderNumber}} Confirmed"
html: "<html><body><h2>Thank you for your order!</h2><p>Order Number: {{User.UserAttributes.OrderNumber}}</p><p>Total: ${{User.UserAttributes.OrderTotal}}</p><p>Estimated Delivery: {{User.UserAttributes.DeliveryDate}}</p></body></html>"
text: "Thank you for your order! Order Number: {{User.UserAttributes.OrderNumber}}. Total: ${{User.UserAttributes.OrderTotal}}. Estimated Delivery: {{User.UserAttributes.DeliveryDate}}"
template_description: "Transactional email for order confirmations"
```

**Output:**

```
arn: "arn:aws:mobiletargeting:us-east-1:123456789012:templates/order_confirmation_2024/EMAIL"
message: "Template created successfully"
request_id: "xyz789-abc123-def456"
```

### Example 3: Newsletter Template

**Input:**

```
template_name: "monthly_newsletter"
subject: "Your Monthly Update - {{User.UserAttributes.Month}}"
html: "<html><body><h1>What's New This Month</h1><div>{{User.UserAttributes.NewsletterContent}}</div><footer>Unsubscribe: {{User.UserAttributes.UnsubscribeLink}}</footer></body></html>"
text: "What's New This Month\n\n{{User.UserAttributes.NewsletterContent}}\n\nUnsubscribe: {{User.UserAttributes.UnsubscribeLink}}"
template_description: "Monthly newsletter template with dynamic content"
```

**Output:**

```
arn: "arn:aws:mobiletargeting:us-east-1:123456789012:templates/monthly_newsletter/EMAIL"
message: "Template created successfully"
request_id: "lmn456-opq789-rst012"
```

## Common Use Cases

* **Transactional Emails**: Create templates for order confirmations, shipping notifications, password resets, and account updates
* **Marketing Campaigns**: Design reusable templates for newsletters, product announcements, and promotional campaigns
* **User Onboarding**: Build welcome email series templates with personalized content for new users
* **Automated Notifications**: Set up templates for automated alerts, reminders, and status updates
* **A/B Testing**: Create multiple template versions to test subject lines, content, and calls-to-action
* **Multi-Language Support**: Develop templates for different languages and regions with dynamic content substitution
* **Branded Communications**: Maintain consistent branding across all email communications with standardized templates

## Error Handling

| Error Type              | Cause                                              | Solution                                                                     |
| ----------------------- | -------------------------------------------------- | ---------------------------------------------------------------------------- |
| Template Already Exists | Template with the same name already exists         | Use a different template name or delete the existing template first          |
| Invalid Template Name   | Template name contains invalid characters          | Use only alphanumeric characters, hyphens, and underscores in template names |
| Missing HTML Body       | HTML content is empty or null                      | Provide valid HTML content for the email body                                |
| Missing Subject Line    | Subject field is empty or null                     | Provide a subject line for the email template                                |
| Invalid HTML Syntax     | HTML contains malformed tags or syntax errors      | Validate and fix HTML syntax before creating template                        |
| AWS Credentials Error   | AWS credentials are invalid or missing permissions | Verify AWS credentials have pinpoint:CreateEmailTemplate permission          |
| Template Size Limit     | Template content exceeds AWS Pinpoint size limits  | Reduce template size by optimizing HTML or removing unnecessary content      |

## Notes

* **Personalization Variables**: Use `{{User.UserAttributes.VariableName}}` syntax to insert personalized data in templates
* **HTML and Text Versions**: Always provide both HTML and plain text versions for better email client compatibility
* **Subject Line Personalization**: Subject lines support the same personalization variables as the email body
* **Template Naming**: Use descriptive, version-controlled names (e.g., "welcome\_email\_v2") for easy template management
* **Character Encoding**: Templates automatically use UTF-8 encoding to support international characters
* **Template Updates**: After creating a template, use the update template API to modify it without creating duplicates
* **Best Practices**: Keep HTML simple and table-based for better rendering across email clients
* **Testing**: Test templates with sample data before using in production campaigns to verify personalization works correctly


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.agenticflow.ai/reference/nodes/create_pinpoint_email_template.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
