# Import Message — Front

> Appends a new message into an inbox. See the documentation.

- Key: `frontapp-import-message`
- Type: Action (Write)
- Version: 0.1.13
- App: Front (`frontapp`) — https://pipedream.com/apps/frontapp.md
- This page (HTML): https://pipedream.com/apps/frontapp/actions/import-message
- Hints: open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/frontapp/actions/import-message/import-message.mjs

## Description

Appends a new message into an inbox. [See the documentation](https://dev.frontapp.com/reference/import-inbox-message).

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `inboxId` | `string` | Yes | Id of the inbox into which the message should be append. Options are loaded from the connected account. |
| `handle` | `string` | Yes | Handle used to reach the contact. Can be an email address, a twitter, handle, a phone number, custom handle ... |
| `name` | `string` | No | Name of the contact. |
| `authorId` | `string` | No | ID of the teammate who is the author of the message. Ignored if the message is inbound. Options are loaded from the connected account. |
| `to` | `string[]` | Yes | List of recipient handles who received the message. |
| `cc` | `string[]` | No | List of recipient handles who received a copy of the message. |
| `bcc` | `string[]` | No | List of the recipeient handles who received a blind copy of the message. |
| `subject` | `string` | No | Subject of the message. |
| `body` | `string` | Yes | Body of the message. |
| `bodyFormat` | `string` | Yes | Format of the message body. Ignored if the message type is not email. Can be one of: 'html', 'markdown'. (Default: 'markdown') |
| `externalId` | `string` | Yes | External identifier of the message. Front won't import two messages with the same external ID. |
| `createdAt` | `integer` | Yes | Date at which the message has been sent or received. A timestamp is expected as in 1655507769 |
| `type` | `string` | No | Type of the message to import. Can be one of: email, sms, intercom, custom. (Default: email) |
| `assigneeId` | `string` | No | ID of the teammate who will be assigned to the conversation. Options are loaded from the connected account. |
| `tags` | `string[]` | No | List of tag names to add to the conversation (unknown tags will automatically be created) Options are loaded from the connected account. |
| `threadRef` | `string` | No | Custom reference which will be used to thread messages. If you omit this field, we'll thread by sender instead. Options are loaded from the connected account. |
| `isInbound` | `boolean` | Yes | Whether or not the message is received (inbound) or sent (outbound) by you |
| `isArchive` | `boolean` | No | Whether or not the message should be directly archived once imported. (Default: true) |
| `shouldSkipRules` | `boolean` | No | Whether or not the rules should apply to this message. (Default: true) |

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

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: "frontapp-import-message",
  arguments: {
    inboxId: "Inbox ID",
    handle: "Handle",
  },
})
```

**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: "frontapp-import-message",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    frontapp: { authProvisionId: "apn_xxxxxxx" },
    inboxId: "Inbox ID",
    handle: "Handle",
  },
})

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": "frontapp-import-message",
    "configured_props": {
      "frontapp": { "authProvisionId": "apn_xxxxxxx" },
      "inboxId": "Inbox ID",
      "handle": "Handle"
    }
  }'
```

---

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