# Generate email from template

**Action ID:** `generate_email_from_template_gxs`

## Description

Quickly create an email content by filling in pre-written content from a template.

## Input Parameters

| Name            | Type     | Required | Default           | Description                                                                                                                      |
| --------------- | -------- | :------: | ----------------- | -------------------------------------------------------------------------------------------------------------------------------- |
| email\_template | dropdown |     -    | Credit/debit card | The email template to use for generating the email content. Available options: CardX, Credit/debit card, Promotion, Tech Product |
| email\_content  | string   |     ✓    | -                 | The email content to include in the template.                                                                                    |
| hero\_image     | string   |     ✓    | -                 | The hero image to include in the email. Accepts JPEG, PNG, SVG, WebP, GIF formats.                                               |
| cta             | string   |     ✓    | -                 | The call to action link to include in the email.                                                                                 |

<details>

<summary>View JSON Schema</summary>

**Input Schema**

```json
{
  "description": "Generate email from template node input.",
  "properties": {
    "email_template": {
      "default": "Credit/debit card",
      "description": "The email template to use for generating the email content.",
      "enum": [
        "CardX",
        "Credit/debit card",
        "Promotion",
        "Tech Product"
      ],
      "title": "Email template",
      "type": "string"
    },
    "email_content": {
      "description": "The email content to include in the template.",
      "title": "Email content",
      "type": "string"
    },
    "hero_image": {
      "description": "The hero image to include in the email.",
      "title": "Hero image",
      "type": "string"
    },
    "cta": {
      "description": "The call to action link to include in the email.",
      "title": "Call to action",
      "type": "string"
    }
  },
  "required": [
    "email_content",
    "hero_image",
    "cta"
  ],
  "title": "GenerateEmailFromTemplateNodeInput",
  "type": "object"
}
```

</details>

## Output Parameters

| Name           | Type   | Description                                          |
| -------------- | ------ | ---------------------------------------------------- |
| file\_url      | string | URL to the generated email file (HTML format)        |
| email\_content | string | The content of the email generated from the template |

<details>

<summary>View JSON Schema</summary>

```json
{
  "description": "Generate email from template node output.",
  "properties": {
    "file_url": {
      "title": "File generated",
      "type": "string"
    },
    "email_content": {
      "description": "The content of the email generated from the template",
      "title": "Email content",
      "type": "string"
    }
  },
  "required": [
    "file_url",
    "email_content"
  ],
  "title": "GenerateEmailFromTemplateNodeOutput",
  "type": "object"
}
```

</details>

## How It Works

This node takes your email content, hero image, and call-to-action, then combines them with a professionally designed GXS email template. The node processes your inputs, applies the selected template styling and layout optimized for various product types, inserts your content and images, and generates both an HTML email file and returns the complete email content ready for distribution through email platforms.

## Usage Examples

### Example 1: CardX Premium Launch

**Input:**

```
email_template: "CardX"
email_content: "Experience the future of digital banking with CardX Premium. Enjoy unlimited cashback, premium concierge service, and exclusive airport lounge access. Join the elite today."
hero_image: "https://example.com/images/cardx-premium.jpg"
cta: "https://gxs.com/cardx-premium/apply"
```

**Output:**

```
file_url: "https://storage.example.com/emails/cardx-premium.html"
email_content: "<!DOCTYPE html><html>...complete formatted HTML email with CardX template styling...</html>"
```

### Example 2: Tech Product Announcement

**Input:**

```
email_template: "Tech Product"
email_content: "Introducing the GXS SmartPay Terminal - revolutionizing in-store payments with AI-powered fraud detection, instant settlement, and seamless integration with your existing systems."
hero_image: "https://example.com/images/smartpay-terminal.jpg"
cta: "https://gxs.com/business/smartpay"
```

**Output:**

```
file_url: "https://storage.example.com/emails/smartpay-launch.html"
email_content: "<!DOCTYPE html><html>...complete formatted HTML email with Tech Product template styling...</html>"
```

### Example 3: General Banking Promotion

**Input:**

```
email_template: "Promotion"
email_content: "Limited time offer! Earn 5% interest on your savings account for the first 3 months. No minimum balance required. Open your account in minutes and start growing your wealth today."
hero_image: "https://example.com/images/savings-promo.jpg"
cta: "https://gxs.com/savings/open-account"
```

**Output:**

```
file_url: "https://storage.example.com/emails/savings-promo.html"
email_content: "<!DOCTYPE html><html>...complete formatted HTML email with Promotion template styling...</html>"
```

## Common Use Cases

* **CardX Marketing**: Promote GXS CardX products with specialized templates designed for digital card offerings
* **Tech Product Launches**: Announce innovative fintech products and solutions with modern, tech-focused templates
* **Credit Card Campaigns**: Market traditional credit and debit card products with banking-optimized layouts
* **Promotional Campaigns**: Create engaging promotional emails for special offers, seasonal campaigns, or limited-time deals
* **Product Updates**: Inform customers about new features, upgrades, or enhancements to existing products
* **Customer Acquisition**: Design compelling emails to attract new customers with clear value propositions
* **Cross-Selling**: Promote complementary products to existing customers using targeted email campaigns

## Error Handling

| Error Type                 | Cause                                          | Solution                                                                   |
| -------------------------- | ---------------------------------------------- | -------------------------------------------------------------------------- |
| Invalid Image URL          | Hero image URL is inaccessible or invalid      | Verify the image URL is publicly accessible and returns a valid image file |
| Invalid Image Format       | Image format not supported                     | Use supported image formats: JPEG, PNG, SVG, WebP, or GIF                  |
| Missing Required Fields    | One or more required fields are empty          | Ensure email\_content, hero\_image, and cta fields are all provided        |
| Invalid CTA URL            | Call-to-action URL is malformed                | Provide a valid URL starting with http\:// or https\://                    |
| Template Generation Failed | System error during email generation           | Retry the request or check that all inputs are properly formatted          |
| File Upload Failed         | Unable to save generated email file            | Check storage service availability and retry                               |
| Content Too Long           | Email content exceeds reasonable length limits | Shorten the email content to a more concise message                        |

## Notes

* **GXS Branding**: Templates are designed specifically for GXS brand identity with appropriate styling, colors, and layouts.
* **Template Selection**: Choose "CardX" for digital card products, "Tech Product" for fintech innovations, "Credit/debit card" for traditional cards, or "Promotion" for general offers.
* **Hero Images**: Use high-quality images (minimum 600px wide) that align with GXS brand guidelines and product messaging.
* **Call-to-Action**: Ensure your CTA URL directs users to the appropriate landing page with seamless user experience.
* **Email Content**: Write clear, benefit-focused content that resonates with your target audience. Keep paragraphs short for readability.
* **File Output**: The file\_url provides a hosted HTML version of the email compatible with major email service providers.
* **Mobile Optimization**: All templates are responsive and optimized for mobile devices, tablets, and desktop viewing.
* **Brand Consistency**: Templates maintain GXS brand standards while offering flexibility for different product categories and campaigns.


---

# 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/generate_email_from_template_gxs.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.
