# Element — Pipedream Connect

> Secure collaboration and messaging

- API slug: `element` (use in MCP headers and tool keys)
- Auth: API key (Pipedream-managed)
- Categories: Communication
- Website: https://element.io/en
- This page (HTML): https://pipedream.com/apps/element
- Tools: 9 actions · 0 triggers

## Connect via MCP (recommended)

- Endpoint: `https://remote.mcp.pipedream.net/v3`
- Headers: `Authorization: Bearer <token>` · `x-pd-project-id` · `x-pd-environment` · `x-pd-external-user-id` · `x-pd-app-slug: element`

```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": "element",
      },
    },
  },
)

const mcp = new Client({ name: "my-agent", version: "1.0.0" })
await mcp.connect(transport)

const { tools } = await mcp.listTools()

// e.g. run Ban User:
const result = await mcp.callTool({
  name: "element-ban-user",
  arguments: {
    roomId: "Room ID",
    userId: "User ID",
  },
})
```

Docs: [MCP guide](https://pipedream.com/docs/connect/mcp/developers.md)

## API proxy

For a Element endpoint with no pre-built tool, the proxy forwards your request with the connected user's credentials attached.

```bash
# The path segment is the target URL, URL-safe base64 encoded:
# https://api.example.com/v1/me

curl "https://api.pipedream.com/v1/connect/{project_id}/proxy/aHR0cHM6Ly9hcGkuZXhhbXBsZS5jb20vdjEvbWU?external_user_id={external_user_id}&account_id=apn_xxxxxxx" \
  -H "Authorization: Bearer {access_token}" \
  -H "x-pd-environment: production"
```

Docs: [API proxy guide](https://pipedream.com/docs/connect/api-proxy.md)

## SDK

```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: "element-ban-user",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    element: { authProvisionId: "apn_xxxxxxx" },
    roomId: "Room ID",
    userId: "User ID",
  },
})
```

Docs: [Managed auth guide](https://pipedream.com/docs/connect/managed-auth/quickstart.md) · [Tools guide](https://pipedream.com/docs/connect/components.md)

## Actions (9)

### `element-ban-user` — Ban User (Write)

Ban a user from a room, also kicking them if they are currently joined. A banned user cannot rejoin or be invited back until the ban is lifted with Unban User — use Kick User instead to remove someone without blocking their return. The connected account must be in the room with a power level high…

Full schema: https://pipedream.com/apps/element/actions/ban-user.md

### `element-create-room` — Create Room (Write)

Create a new room, optionally inviting other users to it right away. Returns the new room's ID, which can be passed into Send Message or Invite User. Set Room Alias Name to give the room a memorable local alias (e.g. thepub becomes #thepub:matrix.org on matrix.org). If you omit Preset, Visibility…

Full schema: https://pipedream.com/apps/element/actions/create-room.md

### `element-invite-user` — Invite User (Write)

Invite a user to an existing room. The connected account must already be joined to the room and have permission to invite. Optionally include a Reason, which is stored on the membership event. See the documentation

Full schema: https://pipedream.com/apps/element/actions/invite-user.md

### `element-kick-user` — Kick User (Write)

Remove a user from a room without banning them. A kicked user can be invited back with Invite User, and can rejoin on their own if the room's join rules allow it — use Ban User instead to also block their return. The connected account must be in the room with a power level high enough to kick…

Full schema: https://pipedream.com/apps/element/actions/kick-user.md

### `element-leave-room` — Leave Room (Write)

Leave a room the connected account has joined, or reject a pending invite to it. After leaving, the account stops receiving new events in the room; rejoining an invite-only room requires a fresh invite, so treat this as hard to undo. Use List Rooms to find the room ID. See the documentation

Full schema: https://pipedream.com/apps/element/actions/leave-room.md

### `element-list-rooms` — List Rooms (Read-only)

List the Matrix rooms the connected account has joined. The Matrix API only returns room IDs from this endpoint (no name or topic) — pass a returned ID directly into Send Message or Invite User. Because the IDs are opaque, prefer Resolve Room Alias when you know the room by an alias such as…

Full schema: https://pipedream.com/apps/element/actions/list-rooms.md

### `element-resolve-room-alias` — Resolve Room Alias (Read-only)

Look up the room ID that a human-readable room alias points to, e.g. #engineering:matrix.org. Every other action in this app takes a room ID (!OGEhHVWSdvArJzumhm:matrix.org) and rejects aliases, so use this first whenever you only know the alias. Aliases can be re-pointed to a different room over…

Full schema: https://pipedream.com/apps/element/actions/resolve-room-alias.md

### `element-send-message` — Send Message (Write)

Send a text message to a room. The room must be one the connected account has already joined, and must be identified by room ID rather than alias — use List Rooms to find it. Returns the event_id of the sent message. See the documentation

Full schema: https://pipedream.com/apps/element/actions/send-message.md

### `element-unban-user` — Unban User (Write)

Lift a ban on a user in a room, reversing Ban User. Unbanning does not put the user back in the room — it only allows them to be invited again, and to rejoin if the room's join rules would otherwise let them. The connected account must have a power level high enough to unban, otherwise the API…

Full schema: https://pipedream.com/apps/element/actions/unban-user.md

---

- All apps: https://pipedream.com/apps — index: https://pipedream.com/llms.txt
- Pipedream docs for agents: https://pipedream.com/docs/llms.txt
