# Trigger Journey — Mailmodo

> Adds a new user to the journey. See the docs here

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

## Description

Adds a new user to the journey. [See the docs here](https://www.mailmodo.com/developers/YXBpOjQ3MzIwNjUx-user-journeys/7de134cb5967c-add-a-new-user-to-the-journey)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `journeyId` | `string` | Yes | Please see the docs to see how to find journey ID |
| `email` | `string` | Yes | Email of the user |
| `data` | `object` | No | Key value pairs for the personalization. e.g. {"first_name": "John"} |
| `allowDuplicateEmail` | `boolean` | No | Set true to allow multiple instances of the journey for the same email id. |

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

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: "mailmodo-trigger-journey",
  arguments: {
    journeyId: "Journey ID",
    email: "Email",
  },
})
```

**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: "mailmodo-trigger-journey",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    mailmodo: { authProvisionId: "apn_xxxxxxx" },
    journeyId: "Journey ID",
    email: "Email",
  },
})

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": "mailmodo-trigger-journey",
    "configured_props": {
      "mailmodo": { "authProvisionId": "apn_xxxxxxx" },
      "journeyId": "Journey ID",
      "email": "Email"
    }
  }'
```

---

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