Apple’s Shortcut Automations allow your iPhone or Mac to react to events like receiving a message.
By combining this with a locally hosted LLM (via Ollama), you can build a private AI auto-reply system that runs entirely on your local network.
In this guide, we’ll configure:
A local LLM using Ollama
A message-triggered Shortcut Automation
Sender-based filtering
Automatic AI-generated replies (within Apple’s security limits)
1. Why Use Shortcut Automations Instead of Manual Shortcuts?
Automations let Shortcuts run automatically when an event occurs.
Examples:
When a message is received
When a specific person messages you
When you arrive at a location
At a specific time
For AI auto-replies, message-based automations are ideal.
2. Install and Run a Local LLM with Ollama
Install Ollama:
brew install ollama
Start the server (default port):
ollama serve
Verify installation:
ollama list
3. Pull a Lightweight Model
For message replies, small models work best:
ollama pull tinyllama
Or for better reasoning:
ollama pull deepseek-r1:7b
4. Test the LLM API
Before connecting automations, confirm the HTTP API works:
curl http://localhost:11434/api/generate \
-H "Content-Type: application/json" \
-d '{
"model": "tinyllama:latest",
"stream": false,
"prompt": "Reply politely to: Hello!"
}'
5. Expose Ollama to Your Local Network
To allow your iPhone to reach your Mac:
OLLAMA_HOST=0.0.0.0:11434 ollama serve
Find your IP:
hostname -I
Example:
192.168.1.3
Your API is now accessible at:
http://192.168.1.3:11434
6. Create a Message-Based Shortcut Automation
Step 1: Open Automations
Open Shortcuts
Tap Automation
Tap Create Personal Automation
Step 2: Choose Trigger
Select:
Message → Is Received
Step 3: Filter by Sender
Choose:
Sender → Select a specific contact
(Optional) Filter by message content
This ensures only selected senders trigger the automation.
Step 4: Disable “Ask Before Running”
Turn Ask Before Running → OFF
Confirm Don’t Ask
This allows automation to run automatically.
7. Send Message Content to the Local LLM
Add the action:
Get Contents of URL
Configure:
URL
http://192.168.1.3:11434/api/generateMethod: POST
Headers
Content-Type: application/jsonRequest Body (JSON)
{
"model": "tinyllama:latest",
"stream": false,
"prompt": "Reply clearly and politely to the following message:\n\n[[Message Content]]"
}
Insert Message Content as the variable.
8. Extract the AI Response
Add:
Get Dictionary Value
Key:
response
This extracts the generated text from Ollama’s response.
9. Send the Reply Back
iMessage
Apple allows sending messages automatically:
Add Send Message
Recipient: Sender
Message: AI response
Due to Apple restrictions:
Auto-send is blocked
Use Copy to Clipboard + notification instead
10. Security and Limitations
What Works
iMessage auto-reply
Sender-filtered automations
Fully local AI inference
What Doesn’t
Full WhatsApp auto-reply
Background execution when device is locked (sometimes)
11. Prompt Optimization for Message Replies
Examples:
Professional
Reply professionally and briefly. Avoid emojis.
Friendly
Reply casually and friendly like a human.
Busy mode
Politely say I’ll reply later.
12. Final Architecture Summary
Message received from a selected sender
Shortcut Automation triggers
Message sent to local Ollama LLM
LLM generates reply
Reply is sent (or prepared) automatically
All without using any cloud AI services.
Conclusion
Using Apple Shortcut Automations + Ollama, you can build a powerful, private AI assistant that reacts to messages in real time.
This approach is ideal for:
Auto-drafting replies
Personal assistants
Privacy-focused AI workflows
Experimenting with local AI agents
Comments
Post a Comment