# Create or Update Lead — KickoffLabs

> Adds a new lead or modifies an existing lead on your campaign. See the documentation.

- Key: `kickofflabs-create-or-update-lead`
- Type: Action (Write)
- Version: 0.0.2
- App: KickoffLabs (`kickofflabs`) — https://pipedream.com/apps/kickofflabs.md
- This page (HTML): https://pipedream.com/apps/kickofflabs/actions/create-or-update-lead
- Hints: destructive · open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/kickofflabs/actions/create-or-update-lead/create-or-update-lead.mjs

## Description

Adds a new lead or modifies an existing lead on your campaign. [See the documentation](https://dev.kickofflabs.com/create/).

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `email` | `string` | No | Email address of the lead. |
| `phoneNumber` | `string` | No | Phone number of the lead. |
| `ip` | `string` | No | By default, we use the IP address of the request. This is great if your are using ajax to make the request. However, if you are making the request on the server, you may want to include user’s ip address. |
| `url` | `string` | No | The URL which the lead signed up on. |
| `ref` | `string` | No | The referrer url the lead came from. |
| `userAgent` | `string` | No | The user agent of the lead. |
| `source` | `string` | No | This will default to API, but you can change it to something unique. This is helpful if you are sending leads in from various sources. In additional, if source is API, we will not perform duplicate IP address checks. |
| `customFields` | `object` | No | Any additional parameters you include when signing up a lead will be captured as custom fields. |

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

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: "kickofflabs-create-or-update-lead",
  arguments: {
    email: "Email",
    phoneNumber: "Phone Number",
  },
})
```

**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: "kickofflabs-create-or-update-lead",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    kickofflabs: { authProvisionId: "apn_xxxxxxx" },
    email: "Email",
    phoneNumber: "Phone Number",
  },
})

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": "kickofflabs-create-or-update-lead",
    "configured_props": {
      "kickofflabs": { "authProvisionId": "apn_xxxxxxx" },
      "email": "Email",
      "phoneNumber": "Phone Number"
    }
  }'
```

---

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