# Update Customer — ChartMogul

> Updates certain modifiable attributes of a customer object in your ChartMogul account. See the docs here

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

## Description

Updates certain modifiable attributes of a `customer` object in your ChartMogul account. [See the docs here](https://dev.chartmogul.com/reference/update-a-customer)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `customerId` | `string` | Yes | The ChartMogul UUID of the customer that needs to be updated. Specified as part of the URL. Options are loaded from the connected account. |
| `name` | `string` | No | Name of the customer for display purposes. Accepts alphanumeric characters. |
| `email` | `string` | No | Email address of the customer. |
| `status` | `string` | No | The new status of the customer. |
| `company` | `string` | No | The customer's company or organisation. |
| `country` | `string` | No | Country code of customer's location as per ISO-3166 alpha-2 standard. |
| `state` | `string` | No | State code of customer's location as per ISO-3166 alpha-2 standard. |
| `city` | `string` | No | City of the customer's location. |
| `zip` | `string` | No | Zip code of the customer's location. |
| `leadCreatedAt` | `string` | No | Time at which this customer was established as a lead. Must be an ISO 8601 formatted time in the past. The timezone defaults to UTC unless otherwise specified. |
| `freeTrialStartedAt` | `string` | No | Time at which this customer started a free trial of your product or service. Must be an ISO 8601 formatted time in the past. The timezone defaults to UTC unless otherwise specified. This is expected to be the same as, or after the lead_created_at value. |
| `tags` | `string[]` | No | An Array of tags to be added to the customer. |
| `custom` | `string[]` | No | An Array containing the custom attributes to be added to the customer. If sending custom attributes, each custom attribute must be an object and have a type, key, and value. E.g. {"type":"String","key": "key1","value": "value1"} |

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

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: "chartmogul-update-customer",
  arguments: {
    customerId: "Customer UUID",
    name: "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: "chartmogul-update-customer",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    chartmogul: { authProvisionId: "apn_xxxxxxx" },
    customerId: "Customer UUID",
    name: "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": "chartmogul-update-customer",
    "configured_props": {
      "chartmogul": { "authProvisionId": "apn_xxxxxxx" },
      "customerId": "Customer UUID",
      "name": "Name"
    }
  }'
```

---

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