← Instagram DM guides
🧑‍💻 Guide

OpenAI Codex and Instagram: an integration in five minutes

Last reviewed:

Short answer

Codex can call MCP servers. Add DMowl to ~/.codex/config.toml as [mcp_servers.dmowl] with url = "https://dmowl.com/mcp", then run codex mcp login dmowl and click Allow. Codex can then read and change your Instagram automations, contacts and campaigns while it writes code for you.

Why connect Codex to Instagram?

Codex is OpenAI’s coding agent. Connected to DMowl it works with live data from your Instagram account instead of guessing, which helps whenever your code and your DMs meet:

  • Build a landing page and the comment-to-DM automation that sends people to it, in one session.
  • Write a script that pushes new Instagram leads (with email) into your CRM or database.
  • Wire Shopify or Stripe orders back to the DM that caused them, using DMowl’s conversion tracking.
  • Generate test data and check your webhook endpoint with real event shapes.
  1. 1
    Connect Instagram to DMowl

    Create a DMowl account and connect your Instagram professional account.

  2. 2
    Add the server

    Open ~/.codex/config.toml (or .codex/config.toml in a trusted project) and add: [mcp_servers.dmowl] and on the next line url = "https://dmowl.com/mcp".

  3. 3
    Log in

    Run codex mcp login dmowl. Your browser opens the DMowl Allow page; sign in and confirm.

  4. 4
    Try it

    Start Codex and ask: “Use DMowl to list my active automations and their click rates.”

Setup with an API key (CI and servers)

Where no browser is available, create an API key in DMowl under Settings → API & MCP and keep it in an environment variable, for example DMOWL_API_KEY. In config.toml add bearer_token_env_var = "DMOWL_API_KEY" below the url. Codex sends it as Authorization: Bearer.

Never commit the key. Codex reads it from the environment, so the config file itself stays safe to share.

Codex or the REST API?

UseWhen
Codex + MCPWhile building: exploring data, creating automations, trying things out
REST APIIn production code: scheduled jobs, your backend, webhooks. Same features at dmowl.com/api/v1
WebhooksWhen DMowl should notify your system: new email, link click, giveaway entry, opt-out, order

Questions? Answers.

Does Codex get access to my Instagram password?

No. Instagram is connected to DMowl through Meta’s login. Codex gets a revocable DMowl token or uses your API key.

Can I use the same setup in ChatGPT?

Yes, ChatGPT uses the same server URL. See our guide on managing Instagram DMs with ChatGPT.

What if codex mcp login is not available?

Update Codex to a current version, or use the API key setup with bearer_token_env_var, which works without a browser.

Free tools for this

Try it on your own Instagram

Free for up to 100 active contacts. No credit card, set up in two minutes.

Start for free

More guides

Looking for how a DMowl feature works? DMowl documentation →