# 2Chat — Pipedream Connect

> All-in-one WhatsApp* automation for small teams. Integrate it into your existing workflows easily while you keep using WhatsApp as usual.

- API slug: `_2chat` (use in MCP headers and tool keys)
- Auth: API key (Pipedream-managed)
- Categories: Communication
- Website: https://2chat.co/
- This page (HTML): https://pipedream.com/apps/2chat
- Tools: 4 actions · 3 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: _2chat`

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

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

const { tools } = await mcp.listTools()

// e.g. run Check Phone Number for WhatsApp:
const result = await mcp.callTool({
  name: "_2chat-check-phone-number-whatsapp",
  arguments: {
    fromNumber: "From Phone Number",
    phoneNumber: "Phone Number",
  },
})
```

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

## API proxy

For a 2Chat 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.p.2chat.io/open/contacts/search

curl "https://api.pipedream.com/v1/connect/{project_id}/proxy/aHR0cHM6Ly9hcGkucC4yY2hhdC5pby9vcGVuL2NvbnRhY3RzL3NlYXJjaA?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: "_2chat-check-phone-number-whatsapp",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    _2chat: { authProvisionId: "apn_xxxxxxx" },
    fromNumber: "From Phone Number",
    phoneNumber: "Phone Number",
  },
})
```

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

## Actions (4)

### `_2chat-check-phone-number-whatsapp` — Check Phone Number for WhatsApp (Read-only)

Checks if a given phone number has a WhatsApp account. See the documentation

Full schema: https://pipedream.com/apps/2chat/actions/check-phone-number-whatsapp.md

### `_2chat-create-contact` — Create Contact (Write)

Creates a new contact in 2Chat. See the documentation

Full schema: https://pipedream.com/apps/2chat/actions/create-contact.md

### `_2chat-list-from-number-options` — List From Phone Number Options (Read-only)

Retrieves available options for the From Phone Number field.

Full schema: https://pipedream.com/apps/2chat/actions/list-from-number-options.md

### `_2chat-send-whatsapp-text-message` — Send Whatsapp Text Message (Write)

Sends a text message to a designated whatsapp-enabled phone number. See the documentation

Full schema: https://pipedream.com/apps/2chat/actions/send-whatsapp-text-message.md

## Triggers (3)

### `_2chat-new-conversation-instant` — New Conversation (Instant) (Instant)

Emit new event when a new WhatsApp conversation is started on the user’s 2chat connected number.

Full schema: https://pipedream.com/apps/2chat/triggers/new-conversation-instant.md

### `_2chat-new-message-instant` — New Message (Instant) (Instant)

Emit new event when a new message is either sent or received on 2Chat.

Full schema: https://pipedream.com/apps/2chat/triggers/new-message-instant.md

### `_2chat-new-whatsapp-order-instant` — New WhatsApp Order (Instant) (Instant)

Emit new event when a WhatsApp order is received on user's 2Chat connected number.

Full schema: https://pipedream.com/apps/2chat/triggers/new-whatsapp-order-instant.md

---

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