# Find or Create Contact — quentn

> Finds or creates a contact. See the docs.

- Key: `quentn-find-or-create-contact`
- Type: Action (Read-only)
- Version: 0.0.2
- App: quentn (`quentn`) — https://pipedream.com/apps/quentn.md
- This page (HTML): https://pipedream.com/apps/quentn/actions/find-or-create-contact
- Hints: read-only · open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/quentn/actions/find-or-create-contact/find-or-create-contact.mjs

## Description

Finds or creates a contact. [See the docs](https://help.quentn.com/hc/en-150/articles/4517835330961-Contact-API).

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `email` | `string` | Yes | The email address of the contact to find. |
| `title` | `string` | No | Possible values: m : Mr. and f : Mrs. |
| `firstName` | `string` | No | First name |
| `lastName` | `string` | No | Last name |
| `company` | `string` | No | Company |
| `jobTitle` | `string` | No | Job title |
| `phoneType` | `string` | No | Possible values: work : Work, home : Home, mobile : Mobile and other : other |
| `phone` | `string` | No | Phone number |
| `skype` | `string` | No | Skype |
| `fb` | `string` | No | Facebook |
| `twitter` | `string` | No | Twitter |
| `street` | `string` | No | Street (Billing Address) |
| `city` | `string` | No | City (Billing Address) |
| `postalCode` | `string` | No | Postal Code (Billing Address) |
| `state` | `string` | No | State (Billing Address) |
| `country` | `string` | No | Country as ISO 3166-1 alpha-2. Example: DE for Germany |
| `dateOfBirth` | `string` | No | Date of birth as ISO 8601. Example: 2004-02-12T15:19:21+00:00 |
| `terms` | `string[]` | No | Tags Options are loaded from the connected account. |

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

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: "quentn-find-or-create-contact",
  arguments: {
    email: "Email",
    title: "Gender",
  },
})
```

**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: "quentn-find-or-create-contact",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    quentn: { authProvisionId: "apn_xxxxxxx" },
    email: "Email",
    title: "Gender",
  },
})

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": "quentn-find-or-create-contact",
    "configured_props": {
      "quentn": { "authProvisionId": "apn_xxxxxxx" },
      "email": "Email",
      "title": "Gender"
    }
  }'
```

---

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