# Create New User — Coassemble

> Create a user as a member of your campus or add an existing user to it. See the docs here

- Key: `coassemble-create-new-user`
- Type: Action (Write)
- Version: 0.0.3
- App: Coassemble (`coassemble`) — https://pipedream.com/apps/coassemble.md
- This page (HTML): https://pipedream.com/apps/coassemble/actions/create-new-user
- Hints: open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/coassemble/actions/create-new-user/create-new-user.ts

## Description

Create a user as a member of your campus or add an existing user to it. [See the docs here](https://developers.coassemble.com/api/users#add-users)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `email` | `string` | Yes | The user's email address. |
| `userType` | `string` | No | Add this user to either your learners (student) or trainers (team). |
| `username` | `string` | No | A username for the new user. If omitted, their email address will be used instead. |
| `password` | `string` | No | New user's password. If omitted, they will be prompted to set a password on first login. |
| `firstname` | `string` | No | The new user's first name. If omitted, their email address will be used instead. |
| `lastname` | `string` | No | The new user's last name, if they have one. This is completely optional. |
| `timezone` | `string` | No | The new user's timezone. Will be automatically detected if not provided. |
| `avatar` | `string` | No | URL pointing to the new user's avatar. They can set this later, or not at all, if desired. |
| `emailVerified` | `boolean` | No | Whether you'd like to skip the email verification process for this user. |
| `locale` | `string` | No | The user's locale (language and region). Will be automatically detected if not provided. |
| `active` | `boolean` | No | Whether you'd like to skip activation for this user. Recommended for SSO usage. |
| `disableCourseEnrolmentNotification` | `boolean` | No | Prevent this user from receiving notification emails when enrolled in a course. |

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

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: "coassemble-create-new-user",
  arguments: {
    email: "Email",
    userType: "User type",
  },
})
```

**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: "coassemble-create-new-user",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    coassemble: { authProvisionId: "apn_xxxxxxx" },
    email: "Email",
    userType: "User type",
  },
})

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": "coassemble-create-new-user",
    "configured_props": {
      "coassemble": { "authProvisionId": "apn_xxxxxxx" },
      "email": "Email",
      "userType": "User type"
    }
  }'
```

---

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