# Send Campaign — Campaign Cleaner

> Send in a campaign to be processed and analyzed. See the documentation

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

## Description

Send in a campaign to be processed and analyzed. [See the documentation](https://api-docs.campaigncleaner.com/#540a9e44-bd17-4bb4-ac8f-150ecbc8066a)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `campaignHtml` | `string` | Yes | The full HTML of your campaign. |
| `campaignName` | `string` | Yes | The name of your campaign - campaign name must pass our sanitization checks. |
| `adjustFontColors` | `boolean` | No | If true, certain bright colors are spam triggers, like red or #FF0000, will be adjusted to a slightly different color like #FF0101, it will look the same, but won't trigger some spam filters. |
| `adjustFontSize` | `boolean` | No | If true, you will be able to define the min and max font size allowed in pixels. If your newsletter contains larger or small font's it will adjust them to the min/max you define. |
| `convertHToPTags` | `boolean` | No | If true, this will change all the H tags to P tags and set the correct font-size. |
| `convertTablesToDivs` | `boolean` | No | This is an experimental feature to convert all the tables to divs, in certain instances with a complicated table structure you might need to edit the HTML. We recommend leaving this as false or not setting it. |
| `customInfo` | `string` | No | This field is for you to pass any additional data you want to send us, it will also be passed back to you when you call the get_campaign API. It's limited to 500 characters. - It must pass our sanitization checks. |
| `imageMaxWidth` | `integer` | No | When this is specified, it will add an max-width style to all images. it is not desirable for the image width to exceed the default campaign width. |
| `minFontSizeAllowed` | `integer` | No | The Min Font Size must be smaller or equal to the Max Font Size in pixels. |
| `maxFontSizeAllowed` | `integer` | No | The Max Font Size must be smaller or equal to the Min Font Size in pixels. |
| `minifyHtml` | `boolean` | No | If true, removes all whitespace, tabs, etc. Condensing the HTML. |
| `removeClassesAndIds` | `boolean` | No | If true, removes all the class and ID attributes after CSS Inlining. |
| `removeComments` | `boolean` | No | If true, comments are stripped from both CSS and HTML. Comments are invisible in html and can trigger spam filters. |
| `removeCssInheritance` | `boolean` | No | If true, removes all elements of CSS that are inherited. Once CSS is inlined, the inherited CSS will be removed, for example if font-size of a parent tag is 15 pixels, there is no need for the font-size of the child tag to be specified as 15 pixels because it's inherited or computed from the parent tag, this reduces the size of your HTML Campaign. |
| `removeControlNonPrintable` | `boolean` | No | If true, all non-printable and control characters are removed. |
| `removeImageHeight` | `boolean` | No | if true, the height style is removed from all images, preventing any image distortions. Only the width property should be set on images sent in emails. |
| `removeLargeWidthsOver` | `integer` | No | Experimental: If sets removes all defined widths over the value set on non images and table tags. |
| `removeSuccessivePunctuation` | `boolean` | No | if true, this will remove succession punctuation like ..., !!!!, $$$ to a single occurrence. |
| `relativeLinksBaseUrl` | `string` | No | If set this needs to be a full base URL like "https://campaigncleaner.com/", if your email campaign has any relative paths, it will be converted to an absolute URL. In most instances, you won't need to set this. |
| `replaceDiacritics` | `boolean` | No | If true, replaces diacritic characters like á with normal characters equivalent, if you're sending emails in English emails, this is a must. |
| `replaceNonAsciiCharacters` | `boolean` | No | If true, replaces all non-ascii characters with their ascii equivalent. For example, ❝ will be replaced with ". Non-ascii characters is of of the major spam trigger. |
| `maxWitdh` | `string` | No | The Max Width style applied to the surrounding "div" can be specified in pixels as an integer value. It is typically set to the desired maximum width of the campaign, which is commonly either 600 or 900 pixels. |
| `textAlign` | `string` | No | All content within the surrounding "div" will be aligned according to your specified style. However, you can use the "text-align" property on inner tags within the "div" to customize the appearance of your email. |
| `fontSize` | `string` | No | The pixel size that you want everything in the surrounding div to adhere to, setting this, will add an "!important" to the font-size in the surrounding "div". Font sizes that are set on any tag in the HTML will retain their original size. While all unspecified font sizes to the size you chose. |
| `centerToParent` | `boolean` | No | Using this feature will enable the surrounding "div" to be centered in any parent tags in which it is placed. This is particularly helpful when inserting an HTML snippet into a template. |
| `treatAsFragment` | `boolean` | No | If true, all information before and after and including the body tag is removed. |
| `webhookUrl` | `string` | No | An endpoint that you provide us and when your campaign is fully processed we will send the results back that is found in the Get Campaign API. You can utilize the webhook section under API Management to troubleshoot and test your endpoint. |

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

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: "campaign_cleaner-send-campaign",
  arguments: {
    campaignHtml: "Campaign HTML",
    campaignName: "Campaign Name",
  },
})
```

**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: "campaign_cleaner-send-campaign",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    campaign_cleaner: { authProvisionId: "apn_xxxxxxx" },
    campaignHtml: "Campaign HTML",
    campaignName: "Campaign Name",
  },
})

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": "campaign_cleaner-send-campaign",
    "configured_props": {
      "campaign_cleaner": { "authProvisionId": "apn_xxxxxxx" },
      "campaignHtml": "Campaign HTML",
      "campaignName": "Campaign Name"
    }
  }'
```

---

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