# iMessage API for AI agents · Mapier Convo

**An iMessage API for AI agents, on Macs we run.** Apple publishes no iMessage API. Mapier Convo runs Macs signed into Apple accounts and puts one API in front of them: your agent sends commands and reads events, with no Apple hardware of its own.

[Book a demo](https://cal.com/mapier-homin/30min) · [Read the docs](https://docs.mapier.ai/convo) · [Index for agents](https://mapier.ai/convo/llms.txt)

## Send, reply, react and run group chats through one API

Your agent works in the iMessage thread your customers already have open.

- Text, to a person or into a thread: send to a new address or into a one-to-one conversation your line already has open.
- Threaded replies: quote an earlier message, so the reply lands on the line it answers.
- Tapbacks: the six classic tapbacks, added or removed, on any message in a direct or group thread.
- Group chats: create a group with its opening message, rename it, add participants.
- Reachability check: ask whether an address can receive iMessage before you send, with a reason when not.

A thread on a live line (Larkspur Support):

- **Recipient:** hi, did order 2481 ship?
- **Larkspur Support:** It did — this morning, arriving Thursday. I'll text you here the moment it's out for delivery.
- **Recipient:** perfect, thanks 🙏 (Larkspur Support reacted: love)

## A request, and the events it settles with

Your agent sends a command and reads what became of it on the event stream. Retries never double-send: the same Idempotency-Key is adopted, not sent twice.

`curl`:

```bash
curl -sS -X POST "$MAPIER_BASE_URL/v1/commands/message.send" \
  -H "Authorization: Bearer $MAPIER_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: order-2481-shipped" \
  -d '{
    "target": {
      "channel": "imessage",
      "recipient": "+15555550100"
    },
    "payload": {
      "text": "Order 2481 shipped. Reply here if anything is off."
    }
  }'
# 202 { "commandId": "…", "status": "queued",
#       "disposition": "queued" }
```

`stream.ts`:

```ts
const base = process.env.MAPIER_BASE_URL;

const response = await fetch(`${base}/v1/response_stream`, {
  headers: {
    authorization: `Bearer ${process.env.MAPIER_API_KEY}`,
    accept: "text/event-stream",
    // Resume where you left off. Frames replay for 90 days.
    "last-event-id": lastEventId,
  },
});

for await (const frame of sseFrames(response.body)) {
  if (frame.event === "message") {
    // { conversationId, from, text, externalId,
    //   replyToExternalId, occurredAt, attachmentIds }
    const inbound = JSON.parse(frame.data);
    await send({
      target: { conversationId: inbound.conversationId },
      payload: { text: await reply(inbound.text) },
    });
  }
  if (frame.event === "command") {
    // { commandId, logicalActionId, status,
    //   errorCode, conversationId }
    // status: succeeded | failed | ambiguous |
    //         no_effect | cancelled | expired
  }
}
```

[Read the quickstart](https://docs.mapier.ai/convo/guides/get-started/quickstart)

## The fleet behind the line

iMessage lines run on Mac minis we rebuild as blade servers and rack in data centres. We run the hardware, so a line is ours to keep healthy.

- 450 Mac servers
- 3,300 iMessage lines

## Questions about the iMessage API

### Does my agent need a Mac?

No. iMessage lines run on Mac minis we rebuild as blade servers and rack in data centres. Each Mac is signed into an Apple account, and your application calls one HTTP API with no Apple hardware to run.

### Can my agent check an address before it sends?

Yes. Ask first: a reachability check returns whether the address can receive and, when it cannot, why.

### Which languages can call it?

Any. The API is plain HTTPS with an OpenAPI description, so there is no SDK to install and nothing to run on your side but your own code.

### What happens when a send is retried?

Add an Idempotency-Key to a send and a retry is adopted: the original result comes back and nothing goes out twice.

### Can I build without reaching a real number?

Yes. A test key reaches a sandbox with a simulated phone — sends and reactions settle there as they would on a live line — and can never reach a real number.

### How is it priced?

On three plans: Pro, Ultra Scale and Enterprise. The pricing page sets them side by side, with what each includes.

## More on the iMessage API

- [iMessage API pricing](https://mapier.ai/convo/pricing): Three plans, side by side, and the questions about them.
- [Quickstart](https://docs.mapier.ai/convo/guides/get-started/quickstart): Create a project and a test key, send a command, listen for events.
- [What is an iMessage API?](https://mapier.ai/blog/what-is-an-imessage-api): What runs underneath one, how it works, and what to check before you build on it.
- [iMessage API providers compared](https://mapier.ai/blog/imessage-api-providers-compared): Where each runs, which channels it has, group chats, and where each fits better.
- [How to give an AI agent an iMessage line](https://mapier.ai/blog/how-to-give-an-ai-agent-an-imessage-line): Request a line, open the event stream, reply by conversation.

## Give your agent a real line

Talk to the people who build it.

- [Book a demo](https://cal.com/mapier-homin/30min)
- [Read the docs](https://docs.mapier.ai/convo)

The home page, as Markdown: https://mapier.ai/convo/index.md
