Home
/
Blog
/
Connect ChatGPT to iMessage: Complete Guide (2026)
March 29, 2026
10 min read
Nikita Jerschow

Connect ChatGPT to iMessage: Complete Guide (2026)

Want ChatGPT to respond to your iMessages? With Sendblue and the OpenAI API, you can build a ChatGPT-powered iMessage agent in under an hour. Messages come in as blue bubbles, ChatGPT processes them, and responses go back as iMessages.

How It Works

The setup uses three components:

  1. Sendblue — Handles iMessage sending/receiving via API and webhooks
  2. OpenAI API — Processes messages with GPT-4 or GPT-4o
  3. Your server — A simple Express app that connects the two

When someone texts your Sendblue number, the message hits your webhook. Your server sends it to ChatGPT, gets a response, and sends it back via Sendblue. The entire round trip takes 2-5 seconds.

Setup

npm install express sendblue openai

You need API keys from Sendblue (free) and OpenAI.

The Code

import express from 'express'; import Sendblue from 'sendblue'; import OpenAI from 'openai'; const app = express(); app.use(express.json()); const sendblue = new Sendblue( process.env.SENDBLUE_API_KEY, process.env.SENDBLUE_API_SECRET ); const openai = new OpenAI({ apiKey: process.env.OPENAI_API_KEY }); const threads = new Map(); // conversation history per number app.post('/webhook', async (req, res) => { const { from_number, content } = req.body; if (!threads.has(from_number)) { threads.set(from_number, [ { role: 'system', content: 'You are a helpful assistant responding via iMessage. Keep responses brief and conversational.' } ]); } const messages = threads.get(from_number); messages.push({ role: 'user', content }); // Show typing indicator await sendblue.sendTypingIndicator({ number: from_number }); const completion = await openai.chat.completions.create({ model: 'gpt-4o', messages, max_tokens: 500, }); const reply = completion.choices[0].message.content; messages.push({ role: 'assistant', content: reply }); await sendblue.sendMessage({ number: from_number, content: reply, }); res.json({ ok: true }); }); app.listen(3000);

Customization Ideas

This basic setup can be extended in many ways:

  • Business-specific system prompts: Tell ChatGPT about your products, pricing, and policies so it can answer customer questions accurately
  • Image processing: When users send photos via iMessage, forward the media_url from the webhook to GPT-4 Vision for analysis
  • Tool calling: Use OpenAI function calling to let ChatGPT book appointments, check order status, or look up information in your database
  • Scheduled messages: Have ChatGPT send daily summaries, reminders, or check-ins at scheduled times

For a more advanced AI agent architecture using Claude, see our Claude + Sendblue tutorial.

Why iMessage for ChatGPT?

Other ChatGPT-to-iMessage solutions (like LoopMessage) are limited to personal use. Sendblue's approach gives you:

  • A real business phone number — not your personal iMessage
  • Any AI model — not locked to ChatGPT; swap in Claude, Gemini, or local models
  • Full API control — send media, vCards, typing indicators, read receipts
  • Scale — handle thousands of conversations, not just your own texts
  • Compliance — SOC 2, HIPAA support for business use cases

Get started free — no credit card required.

Ready to send your first iMessage?

Get API access in minutes. Free sandbox, no credit card required.

Get API Access