# Mail PDF Document — OnlineCheckWriter

> Mails a PDF document to a destination. See the documentation.

- Key: `onlinecheckwriter-mail-pdf-document`
- Type: Action (Write)
- Version: 0.1.3
- App: OnlineCheckWriter (`onlinecheckwriter`) — https://pipedream.com/apps/onlinecheckwriter.md
- This page (HTML): https://pipedream.com/apps/onlinecheckwriter/actions/mail-pdf-document
- Hints: open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/onlinecheckwriter/actions/mail-pdf-document/mail-pdf-document.mjs

## Description

Mails a PDF document to a destination. [See the documentation](https://apiv3.onlinecheckwriter.com/#878daf05-e36e-44a2-bce8-15f24d72f82e).

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `documentTitle` | `string` | No | The title of the document. |
| `filePath` | `string` | Yes | The PDF file to upload. Provide either a file URL or a path to a file in the /tmp directory (for example, /tmp/myFile.pdf) |
| `shippingTypeId` | `string` | Yes | Must be a valid shipping type ID. |
| `senderName` | `string` | No | The name of the sender. |
| `senderCompany` | `string` | No | The company of the sender. |
| `senderAddress1` | `string` | No | The first line of the sender's address. |
| `senderAddress2` | `string` | No | The second line of the sender's address. |
| `senderCity` | `string` | No | The city of the sender. |
| `senderState` | `string` | No | The state of the sender. |
| `senderZip` | `string` | No | The zip code of the sender. |
| `senderPhone` | `string` | No | The phone number of the sender. |
| `senderEmail` | `string` | No | The email address of the sender. |
| `destinationName` | `string` | Yes | The name of the recipient. |
| `destinationCompany` | `string` | No | The company of the recipient. |
| `destinationAddress1` | `string` | Yes | The first line of the recipient's address. |
| `destinationAddress2` | `string` | No | The second line of the recipient's address. |
| `destinationCity` | `string` | Yes | The city of the recipient. |
| `destinationState` | `string` | Yes | The state of the recipient. Use 2 characters Eg. Tx instead of Texas for example. |
| `destinationZip` | `string` | Yes | The zip code of the recipient. |
| `destinationPhone` | `string` | No | The phone number of the recipient. |
| `destinationEmail` | `string` | No | The email address of the recipient. |
| `syncDir` | `dir` | No | SyncDir |

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

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: "onlinecheckwriter-mail-pdf-document",
  arguments: {
    documentTitle: "Document Title",
    filePath: "File Path or URL",
  },
})
```

**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: "onlinecheckwriter-mail-pdf-document",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    onlinecheckwriter: { authProvisionId: "apn_xxxxxxx" },
    documentTitle: "Document Title",
    filePath: "File Path or URL",
  },
})

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": "onlinecheckwriter-mail-pdf-document",
    "configured_props": {
      "onlinecheckwriter": { "authProvisionId": "apn_xxxxxxx" },
      "documentTitle": "Document Title",
      "filePath": "File Path or URL"
    }
  }'
```

---

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