# Add or Update a contact — Brevo

> Add or Update a contact

- Key: `brevo-add-or-update-contact`
- Type: Action (Write)
- Version: 0.0.6
- App: Brevo (`brevo`) — https://pipedream.com/apps/brevo.md
- This page (HTML): https://pipedream.com/apps/brevo/actions/add-or-update-contact
- Hints: destructive · open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/brevo/actions/add-or-update-contact/add-or-update-contact.mjs

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `providedIdentifier` | `string` | No | Email OR ID of the contact, if not present the contact will be inserted, it will be used to search the contact, if it can be found the contact will be updated else it will be inserted Options are loaded from the connected account. |
| `email` | `string` | Yes | To either be inserted or updated |
| `listIds` | `string[]` | No | Array with the IDs of one or more lists to be either inserted or updated, On update the contact will be removed from previous lists 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": "brevo",
      },
    },
  },
)

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: "brevo-add-or-update-contact",
  arguments: {
    providedIdentifier: "Contact",
    email: "Email",
  },
})
```

**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: "brevo-add-or-update-contact",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    brevo: { authProvisionId: "apn_xxxxxxx" },
    providedIdentifier: "Contact",
    email: "Email",
  },
})

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": "brevo-add-or-update-contact",
    "configured_props": {
      "brevo": { "authProvisionId": "apn_xxxxxxx" },
      "providedIdentifier": "Contact",
      "email": "Email"
    }
  }'
```

---

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