# Import PinPoint Segment

**Action ID:** `import_pinpoint_segment`

## Description

Import PinPoint segment.

## Input Parameters

| Name            | Type     | Required | Default | Description                                                             |
| --------------- | -------- | :------: | ------- | ----------------------------------------------------------------------- |
| application\_id | string   |     ✓    | -       | The ID of the Amazon Pinpoint application to import the segment to      |
| segment\_name   | string   |     ✓    | -       | The name for the imported segment                                       |
| format          | dropdown |     ✓    | -       | The format of the endpoint data to import. Available options: CSV, JSON |
| data            | string   |     ✓    | -       | The endpoint data to import in the specified format                     |

<details>

<summary>View JSON Schema</summary>

```json
{
  "description": "Import PinPoint segment node input.",
  "properties": {
    "application_id": {
      "description": "The ID of the application to import the segment to.",
      "title": "Application ID",
      "type": "string"
    },
    "segment_name": {
      "description": "Segment name.",
      "title": "Segment Name",
      "type": "string"
    },
    "format": {
      "description": "The format of the files that contain the endpoint definitions to import.",
      "enum": [
        "CSV",
        "JSON"
      ],
      "title": "Format",
      "type": "string"
    },
    "data": {
      "description": "The data to import.",
      "title": "Data",
      "type": "string"
    }
  },
  "required": [
    "application_id",
    "segment_name",
    "format",
    "data"
  ],
  "title": "ImportPinPointSegmentNodeInput",
  "type": "object"
}
```

</details>

## Output Parameters

| Name        | Type   | Description                                                           |
| ----------- | ------ | --------------------------------------------------------------------- |
| segment\_id | string | The unique identifier of the newly created segment in Amazon Pinpoint |

<details>

<summary>View JSON Schema</summary>

```json
{
  "description": "Import pinpoint node output.",
  "properties": {
    "segment_id": {
      "description": "The id of the segment.",
      "title": "Segment id",
      "type": "string"
    }
  },
  "required": [
    "segment_id"
  ],
  "title": "ImportPinpointSegmentNodeOutput",
  "type": "object"
}
```

</details>

## How It Works

This node imports customer endpoint data into Amazon Pinpoint as a new segment, allowing you to create targeted audience groups for your marketing campaigns. It accepts endpoint data in either CSV or JSON format, processes the data according to Pinpoint's requirements, creates a new segment with the specified name, and returns the segment ID for use in subsequent campaign or targeting operations.

## Usage Examples

### Example 1: Import Customer Segment from CSV

**Input:**

```
application_id: "a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6"
segment_name: "Q4_2024_High_Value_Customers"
format: "CSV"
data: |
  ChannelType,Address,User.UserId,User.UserAttributes.FirstName,User.UserAttributes.LastName
  EMAIL,john.doe@example.com,user_001,John,Doe
  SMS,+12125551234,user_002,Jane,Smith
  EMAIL,alice.johnson@example.com,user_003,Alice,Johnson
```

**Output:**

```
segment_id: "seg-1a2b3c4d5e6f7g8h9i0j1k2l3m4n5o6p"
```

### Example 2: Import Mobile Users from JSON

**Input:**

```
application_id: "a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6"
segment_name: "Mobile_App_Beta_Testers"
format: "JSON"
data: |
  [
    {
      "ChannelType": "APNS",
      "Address": "device_token_abc123",
      "User": {
        "UserId": "user_101",
        "UserAttributes": {
          "AppVersion": ["2.0.0-beta"],
          "BetaTester": ["true"]
        }
      }
    },
    {
      "ChannelType": "GCM",
      "Address": "device_token_xyz789",
      "User": {
        "UserId": "user_102",
        "UserAttributes": {
          "AppVersion": ["2.0.0-beta"],
          "BetaTester": ["true"]
        }
      }
    }
  ]
```

**Output:**

```
segment_id: "seg-7h8i9j0k1l2m3n4o5p6q7r8s9t0u1v2w"
```

### Example 3: Import Email Campaign Audience

**Input:**

```
application_id: "a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6"
segment_name: "Newsletter_Subscribers_2024"
format: "CSV"
data: |
  ChannelType,Address,User.UserId,User.UserAttributes.SubscriptionDate,User.UserAttributes.Interests
  EMAIL,sarah.wilson@example.com,user_201,2024-01-15,Technology
  EMAIL,mike.brown@example.com,user_202,2024-02-20,Marketing
  EMAIL,lisa.garcia@example.com,user_203,2024-03-10,Business
```

**Output:**

```
segment_id: "seg-3x4y5z6a7b8c9d0e1f2g3h4i5j6k7l8m"
```

## Common Use Cases

* **Customer List Imports**: Import customer contact lists from CRM systems or databases into Pinpoint for targeted campaigns
* **Audience Segmentation**: Create specific audience segments based on customer attributes, behaviors, or demographics
* **Campaign Targeting**: Build segments for email, SMS, or push notification campaigns with filtered customer data
* **Mobile App User Groups**: Import device tokens and user data for targeted mobile push notifications
* **A/B Testing Groups**: Create controlled segments for marketing experiments and campaign testing
* **Re-engagement Campaigns**: Import lists of inactive users or lapsed customers for win-back campaigns
* **VIP Customer Management**: Create segments of high-value customers for exclusive offers and communications

## Error Handling

| Error Type              | Cause                                                 | Solution                                                                        |
| ----------------------- | ----------------------------------------------------- | ------------------------------------------------------------------------------- |
| Invalid Application ID  | The application\_id doesn't exist or is inaccessible  | Verify the Pinpoint application ID exists and you have proper permissions       |
| Malformed Data          | Data format doesn't match CSV or JSON structure       | Ensure data is properly formatted according to Pinpoint endpoint specifications |
| Missing Required Fields | Endpoint data missing required ChannelType or Address | Include all required fields: ChannelType, Address, and optionally User data     |
| Duplicate Segment Name  | A segment with this name already exists               | Use a unique segment name or delete the existing segment first                  |
| Invalid Channel Type    | ChannelType value is not supported                    | Use valid channel types: EMAIL, SMS, APNS, GCM, ADM, or BAIDU                   |
| Import Size Exceeded    | Data contains too many endpoints for a single import  | Split the data into smaller batches and import multiple segments                |
| Permission Denied       | Insufficient IAM permissions for Pinpoint operations  | Ensure your AWS credentials have pinpoint:CreateImportJob permissions           |

## Notes

* **Data Format**: Ensure your data follows Amazon Pinpoint's endpoint definition format with proper headers for CSV or correct JSON structure.
* **Channel Types**: Valid channel types include EMAIL, SMS, APNS (iOS push), GCM (Android push), ADM (Amazon Device Messaging), and BAIDU.
* **User Attributes**: You can include custom user attributes in the format User.UserAttributes.AttributeName for enhanced segmentation.
* **Import Limits**: Amazon Pinpoint has limits on segment size and import frequency; consult AWS documentation for current limits.
* **Segment Availability**: After import, it may take a few moments for the segment to be fully available for use in campaigns.
* **Data Validation**: Pinpoint validates endpoint data during import; invalid records may be skipped with warnings.
* **CSV Headers**: For CSV format, ensure headers match Pinpoint's naming conventions exactly, including dot notation for nested attributes.
* **Idempotency**: The segment\_id can be used to reference this segment in campaign nodes and targeting operations.


---

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