Integrations

Send iMessages from the Vercel AI SDK

The short answer

Yes. Define a tool with the AI SDK's tool() helper and a zod schema, point its execute function at the Blue Reacher API, and generateText or streamText can send real blue-bubble iMessages from a dedicated line. Replies arrive as webhooks into a route handler in the same Next.js app. No A2P registration required, unlimited iMessages per line, and the endpoint below is the documented convention. Lines pace at 50 opted-in / 30 cold new contacts a day to stay deliverable; replies are never metered.

$249 per line per month, published No A2P registration required 50 opted-in / 30 cold new contacts a day, unlimited replies

Key takeaways

  • The AI SDK's tool pattern maps cleanly onto a messaging action: a zod schema the model fills, an execute function that makes the call.
  • The pattern that works in production is AI-drafted, human-sent or thread-scoped autonomy, not an unsupervised model with a send button.
  • $249 per line per month with unlimited iMessages (50 opted-in / 30 cold new contacts a day) and no per-message fees.

How a message falls back

How a message falls backEvery message is attempted as iMessage first, falls back to RCS if the number cannot receive iMessage, and falls back to SMS if it cannot receive RCS, so the message arrives either way.iMessageBlue bubble, read in minutesRCSIf the number is Android and RCS-...SMSIf neither, so it still arrives
Every message is attempted as iMessage first, falls back to RCS if the number cannot receive iMessage, and falls back to SMS if it cannot receive RCS, so the message arrives either way.

What does the tool definition look like?

The AI SDK's tool pattern maps cleanly onto a messaging action: a zod schema the model fills, an execute function that makes the call.

  • import { tool } from 'ai'; import { z } from 'zod'; export const sendIMessage = tool({ description: 'Send an iMessage to a contact. Only for approved outreach.', parameters: z.object({ to: z.string().describe('Contact phone in E.164 format'), message: z.string().describe('Message body, short and personal'), }), execute: async ({ to, message }) => { const res = await fetch( 'https://api.bluereacher.com/v1/messages', { method: 'POST', headers: { Authorization: 'Bearer brk_live_your_key', 'Content-Type': 'application/json', }, body: JSON.stringify({ to, message }), }, ); return res.json(); }, });
  • Pass it in the tools object of a generateText or streamText call and the model can text as part of a multi-step run. The URL shape is the documented contract (https://api.bluereacher.com/v1/messages with your brk_ API key); onboarding walks the full endpoint list, including capability checks, conversations, and contacts.

How do replies come back into a Next.js app?

As webhooks into a route handler. Blue Reacher posts replies, per-message delivery states, and opt-outs to URLs you configure, and an app/api/imessage/route.ts handler is a natural receiver: parse the event, load the thread for that contact, and either notify a human or invoke the model with the conversation history to draft the next turn. Deployed on Vercel, that's a serverless inbound channel with no infrastructure to run.

  • The event stream is also what keeps an AI texting feature honest. Delivery states tell you whether a send rode iMessage or fell back to RCS or SMS (automatic when a contact can't receive iMessage). STOP opt-outs are enforced platform-side before your handler sees the event, so compliance never depends on your application code.

What should you actually build with it?

The pattern that works in production is AI-drafted, human-sent or thread-scoped autonomy, not an unsupervised model with a send button. Builds we see working:

  • A rep copilot: the model drafts the follow-up text from CRM context, the rep taps approve, the tool sends
  • A reply assistant: inbound webhook triggers streamText over the thread history, draft appears for one-tap send
  • A scheduling flow: the model negotiates times over an iMessage thread and writes the booking when the contact confirms
  • An ops alerter: your app texts the team's own lines on events that matter, same tool, internal recipients

Pricing for product builders

$249 per line per month with unlimited iMessages (50 opted-in / 30 cold new contacts a day) and no per-message fees. $199 per line at 6+, or $1,949 per line per year (about $162.50 a month). The $449 activation is waived on annual billing.

  • No A2P registration required, which removes the carrier-approval wait between staging and launch. White-glove onboarding sets up the line, keys, and webhook endpoints. An MCP server is available if your stack prefers Model Context Protocol.

Frequently asked questions

Does this work with streamText and multi-step tool calls?

Yes. The send tool is a standard AI SDK tool, so it participates in multi-step runs like any other: the model can look up context with one tool, then send with another, and your maxSteps setting governs the loop. Nothing about messaging changes the SDK mechanics.

How do I receive replies in my app?

Configure Blue Reacher's webhooks to point at a route handler; each reply, delivery state, and opt-out arrives as an HTTP POST. From there it's your application logic: notify a human, invoke the model over the thread, or write to your database. On Vercel this runs serverless with zero extra infrastructure.

Should the model send without human review?

For first-contact outreach, no: draft-and-approve is the pattern that survives contact with production. Within an existing thread, scoped autonomy works well. Either way STOP suppression and iMessage availability checks are enforced by the platform, not by your prompt.

Is there an MCP option instead of writing the tool by hand?

Yes. Blue Reacher ships an MCP server exposing messaging as typed tools, useful where your stack already loads MCP servers. The hand-written tool() route shown above gives you tighter control over schema descriptions, which is often worth it for steering the model.

What does it cost?

$249 per line per month, unlimited iMessages, no per-message metering. Lines pace at 50 opted-in / 30 cold new contacts a day to stay deliverable; replies are never metered. $199 per line at four or more lines, $1,949 per line per year (about $162.50 a month), and the $449 white-glove activation is waived on annual billing. No A2P registration required.

Ship the texting feature this sprint

Book a demo with your use case in hand. We'll review the tool schema and webhook flow against your app on the call, and onboarding delivers the line and keys, usually inside a week.