# Add or Update User — AcyMailing

> Creates a new user or updates an existing user in AcyMailing. If the user exists, will update the user's data with provided information. See the documentation

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

## Description

Creates a new user or updates an existing user in AcyMailing. If the user exists, will update the user's data with provided information. [See the documentation](https://docs.acymailing.com/v/rest-api/users#create-or-update-a-user)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `email` | `string` | Yes | The email address is used when updating an existing user. |
| `name` | `string` | No | Any character should be available. |
| `active` | `boolean` | No | Defaults to true. |
| `confirmed` | `boolean` | No | The confirmation is related to the "Require confirmation" option in the configuration, tab "Subscription". |
| `cmsId` | `integer` | No | The cms_id must match the ID of the corresponding Joomla/WordPress user. |
| `customFields` | `object` | No | An object of field Ids and values. |
| `triggers` | `boolean` | No | Defaults to true. Defines if the saving of the user triggers automated tasks like follow-up campaigns and automations. |
| `sendConf` | `boolean` | No | Defaults to true. Defines if the confirmation email should be sent when a new user is created. |

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

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: "acymailing-add-update-user",
  arguments: {
    email: "Email",
    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: "acymailing-add-update-user",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    acymailing: { authProvisionId: "apn_xxxxxxx" },
    email: "Email",
    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": "acymailing-add-update-user",
    "configured_props": {
      "acymailing": { "authProvisionId": "apn_xxxxxxx" },
      "email": "Email",
      "name": "Name"
    }
  }'
```

---

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