I built the first hosted iMessage bot using Beeper

Apple works pretty hard to make sure iMessages are only sent by Apple devices. But I've long-wanted to send and respond to iMessages programatically — even when my devices are offline. I started using Beeper a few months ago and was mindblown that they integrated with all of my chats — Instagram, Linkedin, Whatsapp and, critically, iMessage.

Beeper works by relaying messages to an open source chat protocol, Matrix. So my programmatic iMessage dream had life. Here's how I built a bot to respond to my iMessages, and why I think it's a big deal.
Goal
Automate delivery of old family photos in my family group chat every day at noon, or anytime someone requests one with "!photo"
Beeper
I’m now a die-hard user of Beeper, which was a significant pre-requisite for getting this working. They’re waitlist-only at the moment, but their roadmap says they’re moving to open-access in the coming months.

Beeper bridges user messages to the Matrix network. Matrix has an open-source plugin system called Maubot which enables python bots to run in the Matrix ecosystem. So if I can get a plugin interacting with Matrix the way I want, it can interact with Beeper and therefore iMessage in the way I want.


Steps

These steps are generated and maintained by this repo - feel free to contribute to keep it up to date.

Why it's cool - what's newly possible
Getting this working got me extremely excited. The set of closed chat protocols that are central to my life are now effectively open chat protocols. When a closed → open shift like this happens, I can be reasonably certain that the newly possible wins leaping to my mind don’t scratch the surface of the really impactful things to come. And in this case, even those dimly-imagined early ideas are big upgrades.

The simplest win is that a good amount of my chat communication is in fact, automatable. There’s low-hanging fruit like responding to “what’s your ETA?” and “how’s your schedule this week?” And optimizations as simple as automating “can you send rent when you get a sec” and “happy birthday!”

There is also plenty of fun to be had:
  • ETA Accountability Bot - when I send “I’ll be there in 10” it could follow with an accurate translation: “on average, this means I’ll be there in 13.26 minutes”.
  • You Owe Me A Listen Bot - when my partner sends a podcast, it could auto-respond with a long-buried and still-unopened podcast I've sent: “Will listen! Bumping my previous rec”


What might be possible
But the fundamentally transformative shift this could bring is intelligent notification management. The thing I really want is for my devices to be much, much smarter about which messages bother me. Apple's Focus Modes fall short because to really get this right, notifications need to be dealt with at the message level, not at the contact level.
  • My co-founder is whitelisted in work Focus Mode, but the twitter meme he sends shouldn’t interrupt a debugging session
  • Unknown numbers are blocked in my work Focus Mode, but “move your car or I’m towing it” should probably get my attention.
Secretaries used to do this. Personal gatekeepers that swatted or allowed messages on a case by case basis were a luxury, but possible. But the last decade has opened so many direct commmunication channels that secretaries can't fill that need anymore. Might the dawning AI era bring a return to human-like intelligence presiding over what interrupts us? That's my big hope. But at present even if a perfectly performing AI secretary existed, it would have no way to gatekeep notifications - at least not in the Apple ecosystem.

Maybe this changes that. Maybe my Version 0 digital secretary is actually a Maubot reading my Beeper messages and improving - message by message - at deciding if something is worthy of vibrating the device in my pocket. The important ones get forwarded to the one iMessage channel that’s perma-whitelisted across my focus modes. I react with thumbs up or thumbs down to train its decisions. It takes cues from my calendar, from my location data, from my chat history.

In a year maybe Version 2 figures out that “yo your ceiling is leaking” from my roommate is more important than “weekly catch-up” currently ongoing on my calendar.

software for more intentional screen time