July 26, 2026 · 5 min read

How to send iMessage from an AI agent

Connect the reply listener first, check that it is ready, send one controlled message, then keep the agent online until the matching reply arrives. That last step proves the thread works in both directions.

1ConnectStart the agent’s WebSocket consumer before sending.
2CheckContinue only when connection readiness returns true.
3SendMessage one phone you control through the REST API.
4ReceiveKeep listening until the matching reply reaches the agent.

The shortest reliable route is to treat iMessage as a two-way API dependency. Your agent sends through REST, but it must already have an inbound path through WebSocket. Approved managed setups may use a configured webhook instead. This order prevents a common false finish where the outbound message is delivered but the reply has nowhere to go.

1. Connect the inbound listener

Start the listener before the first send and keep it running through the reply. WebSocket is the default path for a long-running agent process. Approved managed setups can use a configured webhook. Framework packages wrap the same boundary in their own tool or node.

2. Check readiness before sending

Use the API key in the authorization header, never in the URL. The readiness check tells you whether a receiver is connected:

curl https://claw-messenger.onrender.com/api/agent/readiness \
  -H "Authorization: Bearer cm_live_YOUR_API_KEY"

Continue only when the response includes "ready": true. If it returns "action": "connect_agent", start or restart the listener and check again.

3. Send one controlled message

Use a phone number you control and can answer during the test. Send a plain message first, before adding tools, scheduled jobs, or business logic. Claw Messenger chooses the available iMessage, RCS, or SMS route, so the agent should not force a service.

curl -X POST https://claw-messenger.onrender.com/api/agent/send-message \
  -H "Authorization: Bearer cm_live_YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"phone_number":"+15551234567","text":"Reply with: agent loop works","claim_route":false}'

4. End on the matching reply

Reply from the controlled phone and leave the listener connected until that message appears inside the agent, webhook, or backend. Accepted, delivered, and read states are useful outbound diagnostics. They do not prove that your AI agent can receive a reply.

Not finished

Outbound status only

The API accepted the request or the carrier reported delivered or read, but no reply reached the agent.

Working thread

Reply received by your agent

The controlled phone replied and the matching inbound message reached the connected tool, consumer, webhook, or backend.

Use the setup path that matches your agent

Every route uses the same send-and-reply proof. The difference is how the framework holds its inbound connection.

Frequently asked questions

Does an AI agent need a Mac to send iMessage?

Not when it uses a managed API such as Claw Messenger. Your agent can run on Linux, Windows, Docker, or a VPS while the messaging bridge is operated separately.

Does delivered status prove the agent can receive replies?

No. Delivered describes the outbound message. The setup works in both directions only when the matching reply reaches the agent, webhook, or backend.

One proof before production

Put your agent in a working text thread

Start the trial, connect the listener, and finish when the matching reply reaches your agent.

Start the 7-day trial

Try Claw Messenger free for 7 daysiMessage API for AI agents. No Mac required.