You are currently viewing ChatGPT WhatsApp MCP: Connect Codex and ChatGPT to WaBot

ChatGPT WhatsApp MCP: Connect Codex and ChatGPT to WaBot

You build with Codex or live in ChatGPT, and the thing you keep doing by hand is WhatsApp: sending yourself a test order message, setting up a keyword reply, checking whether a customer answered.

Here is the honest answer for ChatGPT + WhatsApp over MCP. Codex CLI, the Codex IDE extension and the ChatGPT desktop app can connect to WaBot’s WhatsApp MCP server today: they share one config.toml, and it can send WaBot’s two login headers from environment variables. ChatGPT on the web can’t connect to it yet: it doesn’t read that config and gets remote tools only through plugins, with no documented way to add your own server with custom headers. Setup and three working prompts below. New to MCP? Read the WhatsApp MCP server overview first.

What Codex and ChatGPT are, for this purpose

ChatGPT is OpenAI’s assistant, on the web, on mobile and as a desktop app. Codex is OpenAI’s coding agent, which you use from the terminal (Codex CLI), inside your editor (the IDE extension) or in the ChatGPT desktop app. OpenAI’s MCP documentation says the ChatGPT desktop app, Codex CLI and the IDE extension share one MCP configuration, stored in ~/.codex/config.toml (or .codex/config.toml inside a trusted project), and that “ChatGPT web doesn’t read local Codex configuration files”.

OpenAI appConnects to WaBot?How
Codex CLIYes, directly[mcp_servers.wabot] in config.toml
Codex IDE extensionYes, directlySame config.toml
ChatGPT desktop appYes, directlySame config.toml
ChatGPT on the webNot yetRemote MCP tools come through plugins; no documented custom-header option

Step 1: get your WaBot credentials

In the WaBot app open Developer → Developer Credentials. Copy the Client ID and Client Secret (there’s also a Copy MCP config button). WaBot’s server authenticates with exactly two headers, clientid and clientsecret; there’s no OAuth sign-in and no bearer token, so Codex’s OAuth and bearer_token_env_var options don’t apply.

Step 2: put the secrets in environment variables

Keep the secret out of config.toml and out of git. Set two environment variables where Codex runs:

# macOS / Linux (add to ~/.zshrc or ~/.bashrc)
export WABOT_CLIENT_ID="<Client ID>"
export WABOT_CLIENT_SECRET="<Client Secret>"

# Windows PowerShell (then open a new terminal)
setx WABOT_CLIENT_ID "<Client ID>"
setx WABOT_CLIENT_SECRET "<Client Secret>"

Step 3: add WaBot to config.toml

Open ~/.codex/config.toml and add the block below. Per OpenAI’s docs, url sets a Streamable HTTP server and env_http_headers maps header names to environment variable names, so Codex reads the values at runtime and the file holds no secrets.

[mcp_servers.wabot]
url = "https://api.wabot.shop/mcp"
env_http_headers = { "clientid" = "WABOT_CLIENT_ID", "clientsecret" = "WABOT_CLIENT_SECRET" }
default_tools_approval_mode = "writes"
  • default_tools_approval_mode = "writes" makes Codex ask before any tool not marked read-only. WaBot’s tools don’t carry read-only markings, so Codex asks before every WaBot call. That’s what you want while you learn what the agent does.
  • Restart Codex, then check: in Codex CLI type /mcp (or run codex mcp list); in the ChatGPT desktop app type /mcp in the composer.

The ChatGPT desktop app has Settings → MCP servers → Add server, but OpenAI’s docs describe only a name, a transport and a URL in that form, not headers. Use config.toml for WaBot; the desktop app reads the same file. codex mcp add --url has no documented header flag either.

Use case 1: send a test order update while you build

You’re building checkout or booking code and want to see the real WhatsApp message on your own phone.

Using the wabot tools, send the approved template order_update to my test number +91 98xxx xxxxx with variables 1 = Asha and 2 = #SR1042. Show me the call before you send. Then wait for my reply and print it.
  • Tools Codex calls: list_channels (your number’s ID), send_template_message, then wait_for_reply (2 to 30 seconds per call).
  • What you see: an approval prompt with the exact recipient and variables, the message on your phone a moment later, and your reply (“Got it, thanks”) printed in the terminal. A template is needed because this is the first message in the conversation; within 24 hours of your reply Codex can use send_session_message instead.

Use case 2: an auto-reply for “price”

Check that my template price_list is approved. Then create an automation: when a customer's message includes the word price, send price_list. Leave it switched off and show me a diagram.
  • Tools Codex calls: get_template_status (with sync: true), create_simple_autoflow with matchText: "price" and matchOperator: "includes", then preview_workflow_schematic.
  • What you see: a new, inactive workflow and a Mermaid diagram of it. When it looks right, say “switch it on” and Codex calls set_workflow_status. More ideas in WhatsApp auto-reply for business.

Use case 3: a three-step follow-up chain

Build a 3-step WhatsApp chain for Spice Route Café: when someone sends "menu", send template menu_intro (with buttons Veg and Non-veg); when they tap Veg, send veg_menu; when they tap Non-veg, send nonveg_menu. Keep it inactive and draw it.
  • Tools Codex calls: list_templates to confirm the three templates exist and are approved, create_chained_autoflow (2 to 10 steps; later steps match the button title by default), then preview_workflow_schematic.
  • What you see: one master workflow with three child steps and its diagram. Test it by sending “menu” from your own phone after you switch it on.

Stay safe

  1. Keep default_tools_approval_mode = "writes" and read every approval prompt: recipient, template, variables.
  2. Test on your own number before any customer number.
  3. Respect WhatsApp’s rules: templates outside 24 hours, marketing only with opt-in.
  4. Automations are created off; switch them on only after reading the diagram.
  5. If the secret leaks (for example, committed by mistake), contact WaBot support to replace it.

Limits

  • 60 requests a minute per Client ID, and every tool call is written to WaBot’s audit log. Don’t ask Codex to poll in a tight loop; wait_for_reply exists for that.
  • Reply notifications from subscribe_replies only reach clients that keep MCP’s event stream open. OpenAI’s MCP page doesn’t say Codex does, so rely on wait_for_reply.
  • Not available through MCP: campaigns and broadcast scheduling, campaign analytics, segments, deleting workflows, and advanced workflow steps (branching, webhooks, agent handoff, code). Use the WaBot app for those.

Full tool reference: WaBot MCP guide. Using Claude or VS Code instead? See the Claude guide or the VS Code guide.

Frequently asked questions

Can ChatGPT send WhatsApp messages through MCP?

The ChatGPT desktop app can, together with Codex CLI and the Codex IDE extension, by adding WaBot to ~/.codex/config.toml. ChatGPT on the web can’t connect to WaBot yet, because it doesn’t read that file and has no documented way to add a custom MCP server with custom headers.

How do I add a custom header to an MCP server in Codex?

In config.toml, use http_headers for fixed values or env_http_headers to map header names to environment variable names. For WaBot, map clientid and clientsecret to WABOT_CLIENT_ID and WABOT_CLIENT_SECRET.

Why not use bearer_token_env_var?

That sends an Authorization: Bearer header. WaBot’s MCP server expects clientid and clientsecret headers instead, so use env_http_headers.

Will Codex message my customers without asking?

Not with default_tools_approval_mode set to writes: Codex then asks before every WaBot tool call. Review the recipient and message each time, and test on your own number first.

The bottom line

If you use Codex, in the terminal, your editor or the ChatGPT desktop app, WaBot’s WhatsApp tools are four lines of config.toml away, with the secrets kept in environment variables. ChatGPT on the web has to wait. Start with a test message to your own phone, then build auto-replies and chains that stay off until you’ve checked the diagram.

Leave a Reply