CONNECT APP
Build with 2Chat
All-in-one WhatsApp* automation for small teams. Integrate it into your existing workflows easily while you keep using WhatsApp as usual.
Communication
- API key
MCP
Give your agent 2Chat tools
Every 2Chat action is exposed as an MCP tool on Pipedream's remote server. Point a client at it with your end user's ID and Connect resolves that user's 2Chat account for each tool call — you store no tokens.
// accessToken: mint a short-lived token with the Connect SDK — see the MCP guide
const transport = new StreamableHTTPClientTransport(
new URL("https://remote.mcp.pipedream.net/v3"),
{
requestInit: {
headers: {
Authorization: `Bearer ${accessToken}`,
"x-pd-project-id": "{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",
},
})# access_token: mint a short-lived token with the Connect SDK — see the MCP guide
headers = {
"Authorization": f"Bearer {access_token}",
"x-pd-project-id": "{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",
}
async with streamablehttp_client("https://remote.mcp.pipedream.net/v3", headers=headers) as (read, write, _):
async with ClientSession(read, write) as session:
await session.initialize()
tools = await session.list_tools()
# e.g. run Check Phone Number for WhatsApp:
result = await session.call_tool("_2chat-check-phone-number-whatsapp", {
"fromNumber": "From Phone Number",
"phoneNumber": "Phone Number",
})API PROXY
Call the 2Chat API directly
For an endpoint with no pre-built tool, the Connect proxy forwards your request to the 2Chat API with the connected user's credentials attached. You store no tokens and write no refresh logic.
const resp = await pd.proxy.get({
externalUserId: "{external_user_id}", // any stable ID for this user in your system
accountId: "apn_xxxxxxx",
url: "https://api.p.2chat.io/open/contacts/search",
})
// Any allowed 2Chat endpoint works here. Pipedream attaches the
// connected account's credentials to the outgoing request.# 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"SDK
Run 2Chat actions from your backend
Connect a user's 2Chat account once, then run Check Phone Number for WhatsApp on their behalf from your own code — TypeScript, Python, or plain HTTP.
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",
},
})from pipedream import Pipedream
pd = Pipedream(
client_id="{oauth_client_id}",
client_secret="{oauth_client_secret}",
project_id="{project_id}",
project_environment="production",
)
result = pd.actions.run(
id="_2chat-check-phone-number-whatsapp",
external_user_id="{external_user_id}", # any stable ID for this user in your system
configured_props={
"_2chat": {"authProvisionId": "apn_xxxxxxx"},
"fromNumber": "From Phone Number",
"phoneNumber": "Phone Number",
},
)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": "_2chat-check-phone-number-whatsapp",
"configured_props": {
"_2chat": { "authProvisionId": "apn_xxxxxxx" },
"fromNumber": "From Phone Number",
"phoneNumber": "Phone Number"
}
}'TOOLS
2Chat actions
On-demand operations your product or agent can configure and run on behalf of a connected user.
-
Check Phone Number for WhatsApp
actionChecks if a given phone number has a WhatsApp account. See the documentationRead-onlyv0.0.2 -
Create Contact
actionCreates a new contact in 2Chat. See the documentationWritev0.0.2 -
List From Phone Number Options
actionRetrieves available options for the From Phone Number field.Read-onlyv0.0.1 -
Send Whatsapp Text Message
actionSends a text message to a designated whatsapp-enabled phone number. See the documentationWritev0.0.2
-
New Conversation (Instant)
triggerEmit new event when a new WhatsApp conversation is started on the user’s 2chat connected number.Instantv0.0.1 -
New Message (Instant)
triggerEmit new event when a new message is either sent or received on 2Chat.Instantv0.0.1 -
New WhatsApp Order (Instant)
triggerEmit new event when a WhatsApp order is received on user's 2Chat connected number.Instantv0.0.1
- App slug
- _2chat
- Authentication
- API key
- Categories
- Communication
- Actions
- 4
- Triggers
- 3
- API proxy
- Available