# Add Customer — Mews

> Adds a new customer to the system. See the documentation

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

## Description

Adds a new customer to the system. [See the documentation](https://mews-systems.gitbook.io/connector-api/operations/customers#add-customer)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `overwriteExisting` | `boolean` | Yes | Whether an existing customer should be overwritten in case of duplicity. This applies only to basic personal information |
| `lastName` | `string` | Yes | New last name. |
| `firstName` | `string` | No | New first name. |
| `secondLastName` | `string` | No | New second last name. |
| `title` | `string` | No | Title prefix of the customer |
| `nationalityCode` | `string` | No | ISO 3166-1 code of the Country Options are loaded from the connected account. |
| `sex` | `string` | No | Sex of the customer. |
| `birthDate` | `string` | No | Date of birth in ISO 8601 format (e.g., 1985-09-30) |
| `birthPlace` | `string` | No | Place of birth |
| `occupation` | `string` | No | Occupation of the customer |
| `email` | `string` | No | Email address of the customer |
| `phone` | `string` | No | Phone number of the customer (possibly mobile) |
| `loyaltyCode` | `string` | No | Loyalty code of the customer. |
| `notes` | `string` | No | Internal notes about the customer |
| `carRegistrationNumber` | `string` | No | Registration number of the customer's car (max 255 characters) |
| `dietaryRequirements` | `string` | No | Customer's dietary requirements, e.g. Vegan, Halal (max 255 characters) |
| `taxIdentificationNumber` | `string` | No | Tax identification number of the customer |
| `companyId` | `string` | No | Identifier of the Company. See the documentation Options are loaded from the connected account. |
| `address` | `object` | No | New address details in JSON format with the following properties: Line1 (string, optional): First line of the address Line2 (string, optional): Second line of the address City (string, optional): The city PostalCode (string, optional): Postal code CountryCode (string, optional): ISO 3166-1 code of the Country CountrySubdivisionCode (string, optional): ISO 3166-2 code of the administrative division, e.g. DE-BW Example: { "Line1": "123 Main Street", "Line2": "Apt 4B", "City": "New York", "PostalCode": "10001", "CountryCode": "US", "CountrySubdivisionCode": "US-NY" } |
| `classifications` | `string[]` | No | New classifications of the customer |
| `options` | `string[]` | No | Options of the customer. |
| `italianDestinationCode` | `string` | No | New Italian destination code of customer |
| `italianFiscalCode` | `string` | No | New Italian fiscal code of customer. |

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

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: "mews-add-customer",
  arguments: {
    overwriteExisting: true,
    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: "mews-add-customer",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    mews: { authProvisionId: "apn_xxxxxxx" },
    overwriteExisting: true,
    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": "mews-add-customer",
    "configured_props": {
      "mews": { "authProvisionId": "apn_xxxxxxx" },
      "overwriteExisting": true,
      "lastName": "Last Name"
    }
  }'
```

---

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