# Create Campaign — Mailwizz

> Create a new campaign. See the docs here

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

## Description

Create a new campaign. [See the docs here](https://api-docs.mailwizz.com/?php#create-a-campaign)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `name` | `string` | Yes | Campaign name. |
| `type` | `string` | No | Campaign type. Default is regular. |
| `fromName` | `string` | Yes | The campaign from name. |
| `fromEmail` | `string` | Yes | The campaign from email address. |
| `subject` | `string` | No | The campaign subject. |
| `toName` | `string` | Yes | The subscriber for which we record the bounce. |
| `replyTo` | `string` | Yes | The reply-to email address of the campaign. |
| `sendAt` | `string` | Yes | This will use the timezone which customer selected. |
| `listId` | `string` | Yes | The list uid to which this campaign will be sent. Options are loaded from the connected account. |
| `segmentId` | `string` | No | Narrow down the campaign recipients. Options are loaded from the connected account. |
| `templateId` | `string` | Yes | Template unique id from MailWizz. Options are loaded from the connected account. |
| `inlineCSS` | `boolean` | No | Accept inline css |
| `plainText` | `string` | No | Do not send to autogenerate as default. |
| `autoPlainText` | `boolean` | No | Generate plain text template. |
| `urlTracking` | `boolean` | No | Enable/Disable url tracking. |
| `jsonFeed` | `boolean` | No | Enable/Disable JSON feed. |
| `xmlFeed` | `boolean` | No | Enable/Disable XML feed. |
| `plainTextEmail` | `boolean` | No | Enable/Disable the plain text email. |
| `emailStats` | `string` | No | A valid email address where the stats will be sent. |
| `autoresponderEvent` | `string` | No | The event that is sent after subscribe or after opening the campaign. |
| `autoresponderTimeUnit` | `string` | No | The unit that the autoresponder will be based on. |
| `autoresponderTimeValue` | `integer` | No | The unit time value. |
| `autoresponderOpenCampaignId` | `string` | No | ID of the campaign, only if event is AFTER-CAMPAIGN-OPEN. Options are loaded from the connected account. |
| `cronjob` | `string` | No | If this campaign is advanced recurring, you can set a cron job style frequency. |
| `cronjobEnabled` | `boolean` | No | Enable/Disable cron job frequency. |

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

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: "mailwizz-create-campaign",
  arguments: {
    name: "Name",
    type: "Type",
  },
})
```

**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: "mailwizz-create-campaign",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    mailwizz: { authProvisionId: "apn_xxxxxxx" },
    name: "Name",
    type: "Type",
  },
})

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": "mailwizz-create-campaign",
    "configured_props": {
      "mailwizz": { "authProvisionId": "apn_xxxxxxx" },
      "name": "Name",
      "type": "Type"
    }
  }'
```

---

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