# Create Contact — Pidj

> Initiates a process to add a new contact to your Pidj account. See the documentation.

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

## Description

Initiates a process to add a new contact to your Pidj account. [See the documentation](https://pidj.co/wp-content/uploads/2023/06/Pidj-API-Technical-Document-v3-1.pdf).

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `phoneNumber` | `string` | Yes | Phone number for the contact. This must be in E.164 format. e.g., +18885552222 |
| `emailAddress` | `string` | No | The contact's email address. |
| `firstName` | `string` | No | The contact's first name. |
| `lastName` | `string` | No | The contact's last name. |
| `businessName` | `string` | No | The contact's business name. |
| `displayName` | `string` | No | The contact's display name, if present, and different from first and last name. |
| `groupId` | `string` | No | The Id of the group. Options are loaded from the connected account. |
| `timezone` | `string` | No | Timezone identifier for the contact. If omitted, this will default to the account value. |
| `externalId` | `string` | No | The external ID of the contact from your own system. This may be used in any enabled integrations to cross-identify the contact record. |
| `homeAddressStreet1` | `string` | No | The home street address 1. |
| `homeAddressStreet2` | `string` | No | The home street address 2. |
| `homeAddressCity` | `string` | No | The home city address. |
| `homeAddressState` | `string` | No | The home state address. Must be the standard 2 character abbreviation (ANSI2-letter or USPS). Any other values will be discarded. See further information. |
| `homeAddressPostal` | `string` | No | Valid 5 or 10 digit zipcode (US addresses). British, Canadian, and Australian postal codes also supported. |
| `homeAddressCountry` | `string` | No | Must be either ISO 3166-1 alpha-2 or ISO 3166-1 alpha-3. Any other values will be discarded. See further information. |
| `businessAddressStreet1` | `string` | No | The business street address 1. |
| `businessAddressStreet2` | `string` | No | The business street address 2. |
| `businessAddressCity` | `string` | No | The business city address. |
| `businessAddressState` | `string` | No | The business state address. Must be the standard 2 character abbreviation (ANSI2-letter or USPS). Any other values will be discarded. See further information. |
| `businessAddressPostal` | `string` | No | Valid 5 or 10 digit zipcode (US addresses). British, Canadian, and Australian postal codes also supported. |
| `businessAddressCountry` | `string` | No | Must be either ISO 3166-1 alpha-2 or ISO 3166-1 alpha-3. Any other values will be discarded. See further information. |

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

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: "pidj-create-contact",
  arguments: {
    phoneNumber: "Phone Number",
    emailAddress: "Email Address",
  },
})
```

**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: "pidj-create-contact",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    pidj: { authProvisionId: "apn_xxxxxxx" },
    phoneNumber: "Phone Number",
    emailAddress: "Email Address",
  },
})

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": "pidj-create-contact",
    "configured_props": {
      "pidj": { "authProvisionId": "apn_xxxxxxx" },
      "phoneNumber": "Phone Number",
      "emailAddress": "Email Address"
    }
  }'
```

---

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