# Create Email Campaign — Constant Contact

> Create a new email campaign. See the documentation

- Key: `constant_contact-create-email-campaign`
- Type: Action (Write)
- Version: 0.0.1
- App: Constant Contact (`constant_contact`) — https://pipedream.com/apps/constant-contact.md
- This page (HTML): https://pipedream.com/apps/constant-contact/actions/create-email-campaign
- Hints: open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/constant_contact/actions/create-email-campaign/create-email-campaign.mjs

## Description

Create a new email campaign. [See the documentation](https://developer.constantcontact.com/api_reference/index.html#tag/Email-Campaigns/operation/createEmailCampaignUsingPOST)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `name` | `string` | Yes | The unique and descriptive name that you specify for the email campaign |
| `emailCampaignActivities` | `string[]` | Yes | Array of objects that describe the email campaign activities for the email campaign. Example: [{ "format_type": 5, "from_name": "Name Test", "subject": "Test Email", "from_email": "test@example.com", "reply_to_email": "test@example.com", "html_content": "<html><body>Hello, world!</body></html>" }] See the documentation for more information |

## Run it

**MCP**

```ts
import { Client } from "@modelcontextprotocol/sdk/client/index.js"
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js"
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const accessToken = await pd.rawAccessToken

const transport = new StreamableHTTPClientTransport(
  new URL("https://remote.mcp.pipedream.net/v3"),
  {
    requestInit: {
      headers: {
        Authorization: `Bearer ${accessToken}`,
        "x-pd-project-id": process.env.PIPEDREAM_PROJECT_ID!,
        "x-pd-environment": "production",
        "x-pd-external-user-id": "{external_user_id}", // any stable ID for this user in your system
        "x-pd-app-slug": "constant_contact",
      },
    },
  },
)

const mcp = new Client({ name: "my-agent", version: "1.0.0" })
await mcp.connect(transport)

const { tools } = await mcp.listTools()

// listTools() hands your model this tool's input schema, so it can
// fill the arguments itself:
const result = await mcp.callTool({
  name: "constant_contact-create-email-campaign",
  arguments: {
    name: "Name",
    emailCampaignActivities: ["Email Campaign Activities"],
  },
})
```

**TypeScript**

```ts
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const result = await pd.actions.run({
  id: "constant_contact-create-email-campaign",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    constant_contact: { authProvisionId: "apn_xxxxxxx" },
    name: "Name",
    emailCampaignActivities: ["Email Campaign Activities"],
  },
})

console.log(result)
```

**cURL**

```bash
curl -X POST https://api.pipedream.com/v1/connect/{project_id}/actions/run \
  -H "Content-Type: application/json" \
  -H "X-PD-Environment: production" \
  -H "Authorization: Bearer {access_token}" \
  -d '{
    "external_user_id": "{external_user_id}",
    "id": "constant_contact-create-email-campaign",
    "configured_props": {
      "constant_contact": { "authProvisionId": "apn_xxxxxxx" },
      "name": "Name",
      "emailCampaignActivities": ["Email Campaign Activities"]
    }
  }'
```

---

- App: https://pipedream.com/apps/constant-contact.md · All apps: https://pipedream.com/apps
