Why This Matters for Bot Developers
If you've ever tried to build an iMessage bot, you know the pain: Apple's ecosystem is notoriously closed, and the official APIs are limited. But with the new Photon adapter for Chat SDK, you can now create bots that send and receive iMessages directly in DMs and group chats, share media, and react with native tapbacks—all through a unified interface.
This is a game-changer for developers who want to extend their bots to iMessage without maintaining a separate codebase. Whether you're building a customer support assistant, a personal productivity bot, or just experimenting with conversational AI, this adapter bridges the gap between your existing Chat SDK logic and Apple's messaging platform.

Getting Started: Code Example
Here's how to set up a basic iMessage bot using the Photon adapter:
// Import the necessary modules
import { Chat } from "chat";
import { createMemoryState } from "@chat-adapter/state-memory";
import { createiMessageAdapter } from "@photon-ai/chat-adapter-imessage";
// Initialize the chat bot with the iMessage adapter
export const bot = new Chat({
userName: "Photon Bot",
adapters: {
imessage: createiMessageAdapter({
local: false, // Set to true for local testing on a Mac
projectId: process.env.IMESSAGE_PROJECT_ID,
projectSecret: process.env.IMESSAGE_PROJECT_SECRET,
}),
},
state: createMemoryState(), // Use in-memory state for simplicity
});
// Respond to @-mentions in conversations
bot.onNewMention(async (thread, message) => {
await thread.post(`You said: ${message.text}`);
});
Key points:
- Each Photon conversation maps to a Chat SDK thread.
- Tapbacks arrive as reactions, so you can handle them with the same reaction handlers.
- Webhooks are HMAC-verified, ensuring secure delivery.
- You can reply to a DM directly from a webhook, no live connection needed.

Limitations and Considerations
While the Photon adapter is powerful, there are some caveats:
- Platform Dependency: Running the adapter locally requires a Mac, which might not be ideal for all teams.
- State Management: The example uses
createMemoryState, which is not persistent. For production, you'll need a durable state store. - Rate Limits: iMessage has its own rate limits; the adapter doesn't bypass them.
Next Steps for Learning:
- Dive deeper into Chat SDK's core concepts with the complete guide (source article).
- Explore how to handle reactions and media in the official docs.
- Consider integrating with cloud services for scalability, like Azure Databricks for data processing.

Conclusion: Should You Adopt Photon?
If you're already using Chat SDK, adding the Photon adapter is a no-brainer. It extends your bot's reach to iMessage with minimal code changes. The ability to handle tapbacks and media natively is a huge win for user engagement.
However, evaluate your infrastructure needs—especially if you plan to deploy at scale. Start with a simple proof-of-concept, then move to a robust state solution.
For more insights on building cross-platform bots, check out our related article on CSS Highlight Pseudo-elements for a different angle on web UI techniques.