# Create Campaign — Selzy

> Creates a new campaign. See the documentation

- Key: `selzy-create-campaign`
- Type: Action (Write)
- Version: 0.0.2
- App: Selzy (`selzy`) — https://pipedream.com/apps/selzy.md
- This page (HTML): https://pipedream.com/apps/selzy/actions/create-campaign
- Hints: open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/selzy/actions/create-campaign/create-campaign.mjs

## Description

Creates a new campaign. [See the documentation](https://selzy.com/en/support/api/messages/createcampaign/)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `messageId` | `string` | No | Code of the message to be sent. The code returned by the Create Email Message method should be transferred. |
| `startTime` | `string` | No | Campaign launch date and time in the "YYYY-MM-DD hh:mm" format, which do not exceed 100 days from the current date. If the argument is not set, the campaign starts immediately. The time zone specified in the settings of the user's personal account is applied. To explicitly specify a time zone, use the Timezone argument. To provide additional error protection, you should not schedule two sendings of the same message within an hour. |
| `trackRead` | `boolean` | No | Whether to track the fact of reading the email message. The default value is false (do not track). If true, a link to a small image tracking the reference will be added to the email. The Track Read argument is ignored for SMS messages. |
| `trackLinks` | `boolean` | No | To track whether there are any click-throughs in email messages, the default value is false (do not track). If true, all external links will be replaced with special ones that allow you to track the fact of a click-through, and then forward the user to the desired page. The Track Links argument is ignored for SMS messages. |
| `contactsUrl` | `string` | No | Instead of the contacts parameter containing the actual email addresses or phone numbers, in this parameter you can specify the URL of the file from which the addresses (phone numbers) will be read. The URL must start with "http://", "https://" or "ftp://". The file must contain one contact per string, without commas; strings must be separated by "n" or "rn" (Mac format — only "r" — not supported). The file can be deleted after the campaign has shifted to the 'scheduled' status. |
| `trackGa` | `boolean` | No | Whether to enable Google Analytics integration for this campaign. Only explicitly indicated values are valid, default usage parameters are not applied. The default value is false (disabled). |
| `gaMedium` | `string` | No | Integration parameters with Google Analytics (valid if track_ga=1). Only explicitly indicated values are valid, default usage parameters are not applied. |
| `gaSource` | `string` | No | Integration parameters with Google Analytics (valid if track_ga=1). Only explicitly indicated values are valid, default usage parameters are not applied. |
| `gaCampaign` | `string` | No | Integration parameters with Google Analytics (valid if track_ga=1). Only explicitly indicated values are valid, default usage parameters are not applied. |
| `gaContent` | `string` | No | Integration parameters with Google Analytics (valid if track_ga=1). Only explicitly indicated values are valid, default usage parameters are not applied. |
| `gaTerm` | `string` | No | Integration parameters with Google Analytics (valid if track_ga=1). Only explicitly indicated values are valid, default usage parameters are not applied. |

## 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": "selzy",
      },
    },
  },
)

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: "selzy-create-campaign",
  arguments: {
    messageId: "Message ID",
    startTime: "Start Time",
  },
})
```

**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: "selzy-create-campaign",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    selzy: { authProvisionId: "apn_xxxxxxx" },
    messageId: "Message ID",
    startTime: "Start Time",
  },
})

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": "selzy-create-campaign",
    "configured_props": {
      "selzy": { "authProvisionId": "apn_xxxxxxx" },
      "messageId": "Message ID",
      "startTime": "Start Time"
    }
  }'
```

---

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