heavenly's blog

software engineering, reverse engineering, and bug bounties

powered by hellish technology

grok on imessage

published on september 15, 2025 • edited on september 16, 2025 • • 442 views

in this post, i will explain how i put an llm into imessage groupchats

tools used

firefox dev tools, vscode, python, opencode

how did this start?

my backend api is perplexity (@ perplexity.ai). there was a lot of things i was experimenting with on perplexity, i tried finding bug bounties on them, i wanted to try to make my own agentic coding tui with pplx as a background, amongst other stuff.

the action

the beginning

i reverse engineered pplx's send query, delete thread, list collection thread api. using some vibecoding with opencode.ai and grok code fast 1, i asked it to use the given requests to create functions out of them. then, i knew that i could read imessage's chat.db to watch for incoming messages, then i could read and see if any of them started with @grok. in the case they started with @grok, it would send a request to the api, then get the request, and send back to the imessage groupchat using osascript. i only sent the previous message with the api call (not the @grok message) for security reasons, however i have a rolling buffer of 10 messages per groupchat, and you can extend the context sent to pplx's api by writing ~nm in your message (ex: @grok what is the weather in seattle ~3m -> uses 3 messages of ctx).

results

grok-imsg-1 grok-imsg-2

super fun project, link to github project:
grok imessage