# Create Contact — CompanyHub

> Creates a new contact. See the documentation

- Key: `companyhub-create-contact`
- Type: Action (Write)
- Version: 0.0.2
- App: CompanyHub (`companyhub`) — https://pipedream.com/apps/companyhub.md
- This page (HTML): https://pipedream.com/apps/companyhub/actions/create-contact
- Hints: open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/companyhub/actions/create-contact/create-contact.mjs

## Description

Creates a new contact. [See the documentation](https://companyhub.com/docs/api-documentation)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `firstName` | `string` | Yes | The first name of the contact |
| `lastName` | `string` | Yes | The last name of the contact |
| `email` | `string` | No | The email address of the contact |
| `companyId` | `string` | No | The ID of the company Options are loaded from the connected account. |
| `phone` | `string` | No | The phone number of the contact |
| `designation` | `string` | No | The designation of the contact |
| `description` | `string` | No | The description of the contact |
| `source` | `string` | No | The source of the contact |
| `nextFollowUpDate` | `string` | No | The next follow up date with the contact. E.g. 2025-03-14T00:00:00 |
| `hasOptedOutOfEmails` | `boolean` | No | Whether the contact has opted out of emails |
| `street` | `string` | No | The street address of the contact |
| `city` | `string` | No | The city where the contact is located |
| `state` | `string` | No | The state or province where the contact is located |
| `country` | `string` | No | The country where the contact is located |
| `postalCode` | `string` | No | The postal code of the contact's address |

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

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: "companyhub-create-contact",
  arguments: {
    firstName: "First Name",
    lastName: "Last Name",
  },
})
```

**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: "companyhub-create-contact",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    companyhub: { authProvisionId: "apn_xxxxxxx" },
    firstName: "First Name",
    lastName: "Last Name",
  },
})

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": "companyhub-create-contact",
    "configured_props": {
      "companyhub": { "authProvisionId": "apn_xxxxxxx" },
      "firstName": "First Name",
      "lastName": "Last Name"
    }
  }'
```

---

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