What's the Best Way to Add iMessage to Your AI Agent?
Four ways to add iMessage to an AI agent you already have: a Mac relay, Apple Messages for Business, an iMessage line provider, or Keiki. What each costs you.

Short answer: The best way to add iMessage to an AI agent you already have is to put it on a hosted iMessage line and keep your agent loop where it runs today, instead of running a Mac relay or applying for Apple Messages for Business. Keiki connects your existing agent to a hosted line and runs delivery, bursts of messages, history and traces around it.
You already have an agent. It answers questions, calls your APIs and maybe books things. It runs in a Next.js route or a worker, and people reach it through a chat widget or an app. Now customers keep asking whether they can just text it, and the channel they mean is iMessage.
The model loop isn't the hard part here, because you've already built it. The hard part is the pipe: getting blue-bubble messages into the agent you have and its replies back out, reliably, without rebuilding the agent around a new platform. This guide compares the four realistic ways to do that:
- A Mac you run yourself, with a bridge such as BlueBubbles
- Apple Messages for Business
- An iMessage line provider with an API and webhooks
- Keiki, which connects the agent you already have to a hosted iMessage line
If you're starting from nothing, read Building iMessage agents, our complete guide. This post assumes the agent exists and you want to add iMessage to it.
Why adding iMessage isn't like adding Slack or Telegram
On Slack or Telegram you register a bot, get a token and receive webhooks. iMessage has no public bot API for an ordinary phone number. Apple's support guide to iMessage, RCS and SMS describes iMessage as messaging between Apple devices, encrypted end to end, with RCS or SMS used when iMessage isn't available. Every route onto iMessage is either Apple's own business channel or a real Apple device signed in to an account somewhere.
Unofficial shortcuts don't last. In December 2023, Beeper Mini let Android phones send iMessages directly. Within days, Apple said it had blocked "techniques that exploit fake credentials in order to gain access to iMessage" and would "continue to make updates in the future," as reported by The Verge. Whatever you choose, don't build a product on a protocol trick.
Option 1: A Mac relay you run yourself
You sign a Mac in to an Apple ID, run a bridge that watches the Messages app, and point your agent at the bridge's API. BlueBubbles is the best-known open-source example. Its server documentation is direct about the constraint: it "cannot run as an ordinary Linux or Windows container," because it relies on the macOS Messages app, its chat.db database and AppleScript. The same project keeps a separate guide just for preventing macOS from sleeping.
What you keep: full control, and no per-line fee beyond the Mac.
What you take on: a computer that has to stay awake, signed in and online. Updates, power cuts and sign-outs are outages with no failover. Every customer texts one Apple ID, so more traffic means more Macs. And the bridge only moves messages. Grouping three texts sent in a row, retries and delivery status are still yours to build.
Choose it when the agent is for you or a small group of friends. We cover what breaks in production, and how to avoid it, in how to run an iMessage agent without a Mac.
Option 2: Apple Messages for Business
Apple Messages for Business is Apple's official customer service channel in Messages. It is a real option for an existing agent, with three conditions you should know before you start.
- You go through an approved provider. Apple's Messages for Business FAQ says a company "requires the services of an Apple-approved Messaging Service Provider (MSP)," and that "automation and virtual agents must connect to Apple Messages for Business through an Apple-approved MSP — not through a direct technical connection." Your agent becomes a bot inside the provider's platform.
- A person must be available. The same FAQ says "a clear escalation path to a live agent is mandatory — deployments without live agent support will not be approved."
- The customer starts the conversation. People reach you through entry points such as Maps, Safari, Siri, Search and your own site or app, as Apple Support describes. Once a customer ends a conversation, the FAQ says, "the customer must initiate a new conversation to receive further messages."
What you keep: Apple's verified business identity and built-in features like Apple Pay and scheduling pickers.
What you take on: registration and review, a contract with a provider, a staffed live-agent desk, and conversations that start from Apple surfaces rather than a phone number a customer saves as a contact.
Choose it when you're a large brand that already runs a contact center and wants Apple's official channel.
Option 3: An iMessage line provider
Companies such as Linq and Photon run the line infrastructure and give you an HTTP API for sending and webhooks for receiving. Linq's webhook guide, for example, covers events for messages sent and received, delivery status, reactions and typing indicators, with retries on failed deliveries.
This is the closest thing to a Telegram-style bot API for iMessage, and it's a reasonable choice if you want to own everything above the pipe. Be clear about what "everything above the pipe" means for an agent you already have:
- Bursts. People send "hey", "can I move my booking" and "to Friday" as three messages. A webhook per message means three turns and three answers unless you queue and merge them.
- Messages that arrive mid-answer. The customer adds "actually Saturday" while the model is still running. Something has to get that into the turn that's already in progress.
- Delivery and retries. Sent, delivered, read and failed are events you store and act on.
- History and identity. Which customer is this, and what did they say last week?
- Line health. Apple doesn't publish sending rules. Bursts, one-way traffic and cold outreach get lines flagged, as our iMessage best practices explain, so pacing is part of the job.
Choose it when you have the engineering time to build and run that layer yourself.
Option 4: Keiki, with your agent where it is
Keiki gives you a hosted iMessage line and runs the layer between it and your agent. You don't have to move the agent. With the external harness, Keiki receives each message, groups bursts into one turn, sends your app a signed turn request, and delivers whatever your app replies. Your model, prompts and provider keys stay in your app.
If your agent uses the Vercel AI SDK, the AI SDK integration is one route handler:
import { createKeikiHandler } from '@onkeiki/ai-sdk'
import { waitUntil } from '@vercel/functions'
import { streamText } from 'ai'
import { openai } from '@ai-sdk/openai'
export const POST = createKeikiHandler({
waitUntil,
onTurn: async ({ instructions, messages, tools, prepareStep, abortSignal }) =>
streamText({
model: openai('gpt-4.1-mini'),
instructions,
messages,
tools: await tools(),
prepareStep,
abortSignal,
}),
})
The handler accepts the turn, runs your model, and streams the reply back to Keiki for delivery. Passing prepareStep pulls messages that arrived mid-turn into the next step, so "actually Saturday" reaches the model before it answers. The tools function adds Keiki's tools for the turn, including tapbacks and threaded replies. With no signing secret set, the handler verifies Keiki's platform signature, so your app doesn't have to store a Keiki secret.
Not on the AI SDK? The external harness takes any HTTP app in push mode. If your agent can't receive requests, inbox mode lets it poll for work instead and send replies through the turn API. Or you can rebuild the agent as a hosted cloud agent and let Keiki run the loop too.
To finish the setup, open the agent's Channels in the dashboard and add an iMessage line. You can buy a dedicated line in Keiki, import Linq lines you already have, or connect a Photon account. Then text the number.
What you keep: your agent, your model and your keys, plus a phone number customers save like any contact.
What you take on: a platform between your agent and the line. Each turn is recorded with what the agent read, the tools it called and what it cost, so you can see what that platform did.
Choose it when the agent is customer-facing and you want it on iMessage this week without building the message layer.
What works on each line
Native features are part of why iMessage is worth the effort. On Keiki:
- Tapbacks, threaded replies and screen or bubble effects work on every iMessage line, imported lines included.
- Polls and voice notes that play in a bubble work on iMessage lines.
- App cards need a dedicated line bought in Keiki and the iMessage Apps add-on. A tool can then open a booking page or checkout as a card in a direct conversation, with no iOS app to ship.
- Delivery status is tracked for every message. If no iMessage device receives one within about 10 minutes, the dashboard marks it Not delivered.
Since iOS 18, iPhones also support RCS. Apple's RCS guide notes that it depends on the carrier, and that RCS messages appear in green bubbles like SMS. Plan for some customers to be on green bubbles, and keep your agent's replies readable as plain text.
How to choose
| | Mac relay | Messages for Business | Line provider | Keiki | |---|---|---|---|---| | Keeps your agent where it runs | Yes | Inside the provider's bot platform | Yes | Yes | | Hardware to run | A Mac per Apple ID | None | None | None | | Customer texts a phone number | Yes | No, Apple entry points | Yes | Yes | | Live-agent desk required | No | Yes | No | No | | Bursts, mid-turn messages, history | You build | Provider | You build | Included |
A short rule of thumb:
- Just for you? A Mac relay is fine.
- A large brand with a contact center? Talk to an Apple-approved provider about Messages for Business.
- A team that wants to own the whole stack? Use a line provider and budget for the layer above it.
- A customer-facing agent you want live on iMessage this week? Connect it to Keiki and keep your loop.
Whichever you pick, plan for people. Some answers should wait for a person to approve them, and some conversations should go to your team. How to add human-in-the-loop to an iMessage agent walks through approvals and handoffs.
FAQ
What's the best way to add iMessage to my AI agent? For a customer-facing agent, put it on a hosted iMessage line and keep the agent where it runs. On Keiki, the external harness sends each turn to your app and delivers its reply, so you add iMessage without rewriting the agent. A Mac relay suits personal projects, and Apple Messages for Business suits large brands working with an Apple-approved provider.
Is there an official iMessage API for AI agents? Not for an ordinary phone number. Apple's official business channel is Apple Messages for Business, and Apple's FAQ says bots must connect through an Apple-approved provider, with a live agent available. Every other route uses lines run on Apple devices by you or a provider.
Can I use my own model and prompts with an iMessage AI agent? Yes. With Keiki's external harness, your app runs the model with your own provider keys, and Keiki handles the line, delivery, history and traces. The AI SDK handler connects an existing streamText call in one route.
Do I need a Mac to run an iMessage AI agent? Only if you host the iMessage account yourself. A hosted line means nothing in your stack needs macOS, and you can sync and run your agent from Linux.
Can an AI agent for iMessages start conversations with customers? It can, but carefully. Conversations that customers start carry far less risk to a line than ones your line starts, so link to your number from your site with a pre-filled message. Keiki also enforces a daily limit of 50 new conversations per active line.
Sources
- What is the difference between iMessage, RCS, and SMS/MMS?, Apple Support
- Apple responds to Beeper's iMessage for Android: "We took steps to protect our users", The Verge, December 9, 2023
- Server overview, BlueBubbles documentation
- Preventing macOS from sleeping, BlueBubbles documentation on GitHub
- Apple Messages for Business frequently asked questions, Apple Business Register
- How to use Messages for Business, Apple Support
- Webhooks, Linq API documentation
- Turn on RCS messaging on your iPhone, Apple Support