# Create PinPoint Campaign

**Action ID:** `create_pinpoint_campaign`

## Description

Create a campaign in PinPoint.

## Input Schema

```json
{
  "description": "Import PinPoint campaign node input.",
  "properties": {
    "application_id": {
      "description": "The ID of the application to import the segment to.",
      "title": "Application ID",
      "type": "string"
    },
    "name": {
      "description": "Campaign Name.",
      "title": "Campaign Name",
      "type": "string"
    },
    "description": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": "",
      "description": "Campaign Description.",
      "title": "Campaign Description"
    },
    "segment_id": {
      "description": "Segment ID.",
      "title": "Segment ID",
      "type": "string"
    },
    "email_body": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": "",
      "description": "Email Body.",
      "title": "Email Body"
    },
    "email_html_body": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": "",
      "description": "Email HTML Body.",
      "title": "Email HTML Body"
    },
    "email_title": {
      "description": "Email Title.",
      "title": "Email Title",
      "type": "string"
    },
    "email_from_address": {
      "description": "Email From Address.",
      "title": "Email From Address",
      "type": "string"
    }
  },
  "required": [
    "application_id",
    "name",
    "segment_id",
    "email_title",
    "email_from_address"
  ],
  "title": "CreatePinPointCampaignNodeInput",
  "type": "object"
}
```

## Output Schema

```json
{
  "description": "Create pinpoint campaign node output.",
  "properties": {
    "campaign_id": {
      "description": "The id of the campaign.",
      "title": "Campaign id",
      "type": "string"
    },
    "arn": {
      "description": "The ARN of the campaign.",
      "title": "Campaign ARN",
      "type": "string"
    }
  },
  "required": [
    "campaign_id",
    "arn"
  ],
  "title": "CreatePinPointCampaignNodeOutput",
  "type": "object"
}
```

## How It Works

This node creates email campaigns in AWS Pinpoint by configuring campaign settings and associating them with target segments. It accepts campaign metadata (name, description), segment targeting information, and email content (subject, body, HTML body, sender address). The node communicates with AWS Pinpoint's API to create the campaign resource, configure the email message template, and link it to the specified segment. Upon successful creation, the node returns the campaign ID and ARN for tracking and further operations.

## Usage Examples

### Example 1: Product Launch Email Campaign

**Input:**

```json
{
  "application_id": "a1b2c3d4e5f6",
  "name": "Q4 Product Launch",
  "description": "New product announcement for Q4 2025",
  "segment_id": "seg_premium_customers",
  "email_title": "Introducing Our Revolutionary New Product",
  "email_from_address": "marketing@company.com",
  "email_body": "Dear customer, we're excited to announce our latest innovation...",
  "email_html_body": "<html><body><h1>Introducing Our Revolutionary New Product</h1><p>Dear customer...</p></body></html>"
}
```

**Output:**

```json
{
  "campaign_id": "camp_9876543210",
  "arn": "arn:aws:mobiletargeting:us-east-1:123456789012:apps/a1b2c3d4e5f6/campaigns/camp_9876543210"
}
```

### Example 2: Newsletter Campaign

**Input:**

```json
{
  "application_id": "xyz789abc123",
  "name": "Monthly Newsletter - November",
  "description": "Monthly product updates and company news",
  "segment_id": "seg_all_subscribers",
  "email_title": "November Newsletter: What's New",
  "email_from_address": "newsletter@company.com",
  "email_body": "This month's highlights include new features, customer stories, and upcoming events.",
  "email_html_body": "<html><body><h2>Monthly Newsletter</h2><ul><li>New Features</li><li>Customer Stories</li></ul></body></html>"
}
```

**Output:**

```json
{
  "campaign_id": "camp_1122334455",
  "arn": "arn:aws:mobiletargeting:us-west-2:987654321098:apps/xyz789abc123/campaigns/camp_1122334455"
}
```

### Example 3: Minimal Campaign with Text-Only Email

**Input:**

```json
{
  "application_id": "app_minimal_001",
  "name": "Flash Sale Alert",
  "segment_id": "seg_active_buyers",
  "email_title": "24-Hour Flash Sale - 50% Off",
  "email_from_address": "sales@company.com"
}
```

**Output:**

```json
{
  "campaign_id": "camp_5544332211",
  "arn": "arn:aws:mobiletargeting:eu-west-1:111222333444:apps/app_minimal_001/campaigns/camp_5544332211"
}
```

## Common Use Cases

* **Product Announcements**: Launch new products or features by creating targeted email campaigns to specific customer segments
* **Promotional Campaigns**: Send time-sensitive offers and discounts to engage customers and drive sales during promotional periods
* **Customer Retention**: Re-engage inactive customers with personalized email campaigns based on behavioral segments
* **Newsletter Distribution**: Schedule regular newsletters to keep subscribers informed about company updates and industry news
* **Event Invitations**: Send targeted invitations to specific customer segments for webinars, conferences, or product demos
* **Onboarding Sequences**: Create automated welcome campaigns for new users or customers to guide them through product features
* **Abandoned Cart Recovery**: Trigger campaigns to customers who left items in their cart, encouraging them to complete purchases

## Error Handling

| Error Type              | Cause                                                               | Solution                                                                                 |
| ----------------------- | ------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- |
| Invalid Application ID  | Application ID does not exist in AWS Pinpoint or is malformed       | Verify the application ID exists in your AWS Pinpoint account and is correctly formatted |
| Segment Not Found       | Specified segment\_id does not exist in the application             | Create the segment first or verify the segment ID is correct for the given application   |
| Invalid Email Address   | From address is not verified in AWS SES or is malformed             | Verify the sender email address in AWS SES before using it in campaigns                  |
| Missing Required Fields | Required parameters (name, email\_title, etc.) are not provided     | Ensure all required fields are populated with valid values before submission             |
| Campaign Name Conflict  | Campaign with the same name already exists in the application       | Use a unique campaign name or append timestamp/version identifier to avoid conflicts     |
| AWS Credentials Error   | AWS credentials are invalid, expired, or lack necessary permissions | Update AWS credentials and ensure IAM role has mobiletargeting:CreateCampaign permission |
| Quota Exceeded          | Account has reached maximum number of campaigns allowed             | Delete unused campaigns or request quota increase from AWS support                       |

## Notes

* **AWS Permissions**: Requires AWS IAM permissions for mobiletargeting:CreateCampaign and related Pinpoint operations
* **Email Verification**: The email\_from\_address must be verified in AWS SES before campaigns can be sent successfully
* **HTML vs Plain Text**: Providing both email\_body and email\_html\_body allows email clients to choose the appropriate format
* **Segment Prerequisite**: Segments must be created and populated before associating them with campaigns; empty segments will result in zero recipients
* **Campaign State**: Newly created campaigns are in DRAFT state by default; use additional API calls to schedule or activate the campaign
* **ARN Usage**: The returned ARN can be used for CloudWatch monitoring, IAM policies, and cross-service AWS integrations
* **Cost Considerations**: AWS Pinpoint charges per email sent; monitor campaign size and frequency to manage costs effectively
* **Testing Recommendations**: Always test campaigns with small test segments before sending to large production segments


---

# 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_campaign.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.
