Send iMessages with TypeScript
The short answer
Yes, TypeScript can send iMessages with full types. The Blue Reacher API publishes an OpenAPI 3.1 spec, so openapi-typescript generates a typed client in one command, sends leave your dedicated blue-bubble line through native fetch, and webhook events parse into discriminated unions. No A2P registration required, unlimited iMessages per line. Lines pace at 50 opted-in / 30 cold new contacts a day; replies never metered.
5 tools in this group
Trigger
TypeScript
Under 9 seconds
Send iMessage
Result
Reply back in TypeScript
iMessage
Hi Alex, following up on your demo request. Worth a quick chat this week?
Sent from your TypeScript workflow
Yeah, tomorrow works.
Key takeaways
- TypeScript's whole value here is that the compiler catches a malformed send before a prospect ever could.
- Webhook envelopes carry an event name and a data payload, which is exactly what a discriminated union wants: switch on event and the compiler narrows data for you.
- Agent frameworks in TypeScript load the hosted MCP server at https://api.bluereacher.com/v1/mcp and get the messaging surface as typed tools: availability checks, sends, thread reads and delivery status.
How a message falls back
How do you send a typed iMessage from TypeScript?
TypeScript's whole value here is that the compiler catches a malformed send before a prospect ever could. Generate types from the spec once, then every call is checked.
- npx openapi-typescript https://docs.bluereacher.com/openapi.json -o bluereacher.d.ts
import type { paths } from "./bluereacher";
type SendBody =
paths["/messages"]["post"]["requestBody"]["content"]["application/json"];
const body: SendBody = {
to: "+15551234567",
message: "Hi Alex, worth a quick chat this week?",
};
const res = await fetch("https://api.bluereacher.com/v1/messages", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.BLUEREACHER_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify(body),
});How do webhook events stay typed?
Webhook envelopes carry an event name and a data payload, which is exactly what a discriminated union wants: switch on event and the compiler narrows data for you.
type BlueReacherEvent =
| { event: "message.received"; data: { message_id: string; phone_number: string; content: string } }
| { event: "message.delivered"; data: { message_id: string } }
| { event: "message.failed"; data: { message_id: string } }
| { event: "contact.opted_out"; data: { phone_number: string } };
function handle(e: BlueReacherEvent) {
switch (e.event) {
case "message.received":
return reply(e.data.phone_number, e.data.content);
case "contact.opted_out":
return suppress(e.data.phone_number);
}
}- Verify the X-BlueReacher-Signature HMAC on the raw body before parsing; the docs at docs.bluereacher.com carry the full event catalogue.
What about agent stacks and the MCP server?
Agent frameworks in TypeScript load the hosted MCP server at https://api.bluereacher.com/v1/mcp and get the messaging surface as typed tools: availability checks, sends, thread reads and delivery status.
- The REST route and the MCP route are the same platform underneath, so a team can prototype in an agent client and ship against the API without changing contracts.
- Pricing stays flat either way: $249 per line per month with unlimited iMessages (50 opted-in / 30 cold new contacts a day), or $1,949 per year (about $162.50/month, $449 activation waived).
Frequently asked questions
Is there a TypeScript SDK for iMessage?
No SDK is needed. The OpenAPI 3.1 spec at docs.bluereacher.com/openapi.json generates typed clients with openapi-typescript in one command, and native fetch does the transport. Agent stacks can load the MCP server instead and get the same surface as typed tools.
Does this work with Vercel AI SDK or LangChain?
Yes. Wrap the send call as a tool in either framework, or load the MCP server where the stack supports it. The Vercel AI SDK and LangChain integration pages on this site carry working snippets for both.
How are webhook payloads verified?
Every delivery is signed: compute sha256 HMAC of the raw body with your webhook secret and compare it to the X-BlueReacher-Signature header before parsing. Registration returns the secret once, and rotating it is one API call.
Do I need A2P registration to text from TypeScript?
No A2P registration required: no brand vetting, no campaign approval, no carrier queue. Pacing applies instead: 50 opted-in / 30 cold new contacts per line per day, with replies unmetered and automatic RCS then SMS fallback.
What does the API cost?
$249 per line per month, unlimited iMessages, or $1,949 per year (about $162.50/month, $449 activation waived). Lines pace at 50 opted-in / 30 cold new contacts a day; replies never metered. API, MCP server and webhooks are all included.
Ship a typed iMessage integration
Book a demo and we'll issue your sandbox key on the call: generate the types, run the send, and watch delivery events arrive typed end to end.