Drafts a reply to your most recent iMessage DM or group chat using OpenAI, then previews it before sending. Pick a chat from the tabbed picker (DMs / Group Chats), edit the AI draft, hit Send. If the draft has paragraphs separated by blank lines, each is sent as its own iMessage.
python3 -m venv ~/.venvs/message_bot~/.venvs/message_bot/bin/pip install -r requirements.txtCopy .env.example to .env and fill in your key:
cp .env.example .envOr, if you'd rather not use a .env file, export it in your shell (or add to ~/.zshrc):
export OPENAI_API_KEY="sk-...".env takes precedence over shell exports. Other knobs you can set in .env:
CUSTOM_DM_PROMPT/CUSTOM_GROUP_PROMPT— override the system prompts (use{name}as a placeholder).MULTI_MESSAGE_WEIGHT—0.0–1.0.0.0guarantees a single message,1.0guarantees multiple; values in between bias the model smoothly.
Defaults live in messaging.py.
In System Settings → Privacy & Security → Full Disk Access, add your terminal (and Python if prompted) so the bot can read ~/Library/Messages/chat.db and the AddressBook databases.
~/.venvs/message_bot/bin/python /Users/adityar/Downloads/iMessage-Bot/bot.pySet AUTO_SEND = True in bot.py to skip the preview window and send immediately (note that this is highly dangerous and discouraged).
- bot.py — entry point / orchestration
- db.py — SQLite reads from
chat.db(DMs + group chats) and AddressBook - gui.py — tabbed picker (DMs / Group Chats) + reply preview
- messaging.py — OpenAI reply generation + AppleScript send (DM and group)
- .env.example — template for
OPENAI_API_KEY,CUSTOM_DM_PROMPT,CUSTOM_GROUP_PROMPT,MULTI_MESSAGE_WEIGHT