/

Run a Private Codex Agent in iMessage, Hosted on Render

Leila Maleki

Julie

No headings found on page

Start building
with Photon

Deploy AI agents
across every channel

Learn more about Photon

Preface

Preface

TL;DR: Render has a new one-click template that deploys a private Codex coding agent you can text from your iPhone, using Photon for the messaging. Click "Deploy to Render," set everything up in a browser dashboard, and in about 10 minutes you'll have Codex answering from a Photon iMessage number. You don't need a Mac server or a personal Apple ID, and you never paste a secret into a config file.

Why your coding agent belongs in iMessage

Coding agents mostly live in terminals and IDEs, so they're only useful while you're at your desk. Real work doesn't stop there. A deploy breaks while you're out, a teammate asks about a function while you're on the train, or you think of a fix at 11pm and don't want to open a laptop.

Your phone is always with you, and iMessage is the app you already open all day. The trouble is that iMessage was never built as a bot platform, and Apple has no official API for it. Photon fills that gap with managed iMessage infrastructure in the cloud, so your agent appears natively in Messages with typing indicators and read receipts.

Why Render + Photon is a natural fit

A coding agent isn't a stateless chatbot. It needs a workspace that persists, credentials that survive a restart, and a way to handle long jobs without dropping messages. Render supplies that infrastructure and Photon supplies the channel. The template wires the two together.

1. One-click infrastructure. A single Render Blueprint provisions everything the agent needs:

  • Web service (Node): runs the Photon agent and the setup dashboard

  • PostgreSQL: the main database and the backend for a pg-boss job queue

  • 1 GB persistent disk at /var/data: stores Codex credentials and workspaces across restarts and redeploys

2. Durable by default. Messages come in through Photon Spectrum's spectrum-ts stream and go straight into a pg-boss queue in Postgres instead of being processed inline. If Codex spends several minutes on a task, or the service restarts partway through, the work stays in the queue.

3. Private by design. Only one phone number can reach the agent. You set it in the dashboard, and messages from anyone else are rejected before they reach the model. Your number is encrypted at rest with a 256-bit APP_ENCRYPTION_KEY that's generated at provision time. Codex credentials never leave the persistent disk.

4. No secrets at deploy time. You enter nothing when the Blueprint applies. The owner's phone number, Photon credentials, and ChatGPT sign-in are all set up afterward in the browser.

The message flow:

iMessage → Photon Spectrum → pg-boss queue (Postgres) → Codex → ChatGPT / OpenAI


How to set up

1. Deploy the template. Click Deploy to Render on the template page. This forks the repo and shows the resources it will create.


2. Wait for the service to go Live. This takes about 5 to 10 minutes.

3. Finish setup in the dashboard. Open your service's public *.onrender.com URL, then:

  • Save your phone number

  • Authenticate with Photon

  • Connect ChatGPT


4. Check that it's ready. GET /readyz should return 200.

5. Text your agent. Send a message from your phone to the Photon number.

By default, Codex signs in through a ChatGPT device login. To use an OpenAI API key instead, set these:

CODEX_AUTH_MODE=api_key

OPENAI_API_KEY=sk-...

For long-term memory across conversations, you can optionally add a SUPERMEMORY_API_KEY.


Cost: about $3 to $5 per month on Render (Starter web service, Basic Postgres, and disk), plus your Photon plan. The persistent disk limits the service to a single instance. If you run out of memory on heavy workloads, upgrade to Standard.

Agents should live where people already are

Photon is built on a simple belief: the next generation of AI agents shouldn't make people come to them. Agents should meet people in the apps they already open a hundred times a day. For developers, that means your coding agent is one text away, not one laptop away.

About Photon

Photon is a unified messaging API that puts AI agents in the apps people already use: iMessage, WhatsApp, Telegram, SMS/RCS, Slack, Discord, and more. It's free to start and scales as your agent grows.

Docs · Render template · GitHub · Discord


Subscribe Photon Newsletter

Subscribe
Photon Newsletter