Skip to main content

Run a Local LLM with Ollama and Use Apple Shortcut Automations to Auto-Reply to Messages

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/generate
    
  • Method: POST

  • Headers

    Content-Type: application/json
    
  • Request 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

WhatsApp

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

  1. Message received from a selected sender

  2. Shortcut Automation triggers

  3. Message sent to local Ollama LLM

  4. LLM generates reply

  5. 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

Popular posts from this blog

Cloud Computing - Virtualization

Virtualization: Hosting all of a physical machine's hardware and software components independently on a single or shared hardware resource. In virtualization, we can run multiple operating systems on a single machine at the same time. In the case of dual-boot, we can run an OS at a time. Virtual Machine: VM is the set of virtual hardware devices, virtual RAM and virtual CPU that run like a traditional operating system. Virtual Server: It is also a virtual machine running as a server. It can run one or possibly more server-based application. This server may be a database or messaging or anything else. VMM (Virtual Machine Monitor): VMM consists of multiple virtual machines top of the hypervisor to handle all the VMs. Hypervisor: Hypervisor consists of multiple VMs and communicates with the real hardware to provide the resources to the available virtual machines. It controls all the physical resources on the computer. two types of the hypervisor exist as shown in the below diagram....

Blockchain in Theory - Blockchain, Bitcoin, Mining

   Blockchain is the software protocol that tell the Internet how to transfer money and assets. Blockchain is the layer and Bitcoin is the application. Just one of many cryptocurrency kinds of applications. When one user send email to another then both users do not have to know about the underlaying process except email address. Similarly,  User don't need to know anything other than other user's wallet address to send some bitcoin or other cryptocurrencies.  Any file on Internet may have multiple copies but money is something that should not be copied multiple times. This has been a longstanding problem in computing networks namely the double spend problem. Satoshi Nakamoto introduced white paper for digital cash system in 2008 to resolve the double spending problem and fortified by a ledger which enforces the money is only spent once. It took 15 years alone for corporate email as the main application to be a standard thing in our lives. And similarly the ...

How to Setup Virtual Environment in Python with venv

A virtual environment is the most used tool by the developers to isolate the dependencies for different projects. Suppose you have two projects say porj1 and proj2 . proj1 needs the Django dependency with version 3.2 but your proj2 needs the Django dependency with version 2.2. In this situation you need a virtual environment to keep the both version on your system separately.  How to create virtual environment in python:  Decide a directory where you want to create the virtual environment. You can use your project directory or any other directory as per your wish.  Run the below command. Here` awesome_proj_env ` is the folder where virtual environment will be created. if the folder does not exists then it will be created automatically. python3 -m venv awesome_proj_env    Activate the virtual environment: On Linux/Mac OSX: source awesome_proj_env/bin/activate  On Windows: awesome_proj_env \Scripts\activate.bat Deactivate the virtual environment in Pyth...