|
| 1 | +--- |
| 2 | +title: "Msg-Use (WhatsApp Sender)" |
| 3 | +description: "AI-powered WhatsApp message scheduler using browser agents and Gemini. Schedule personalized messages in natural language." |
| 4 | +icon: "message" |
| 5 | +mode: "wide" |
| 6 | +--- |
| 7 | + |
| 8 | +<Note> |
| 9 | +This demo requires browser-use v0.7.7+. |
| 10 | +</Note> |
| 11 | + |
| 12 | +<video |
| 13 | + controls |
| 14 | + className="w-full aspect-video rounded-xl" |
| 15 | + src="https://browser-use.github.io/media/demos/msg_use.mp4"> |
| 16 | +</video> |
| 17 | + |
| 18 | +## Features |
| 19 | + |
| 20 | +1. Agent logs into WhatsApp Web automatically |
| 21 | +2. Parses natural language scheduling instructions |
| 22 | +3. Composes personalized messages using AI |
| 23 | +4. Schedules messages for future delivery or sends immediately |
| 24 | +5. Persistent session (no repeated QR scanning) |
| 25 | + |
| 26 | +## Setup |
| 27 | + |
| 28 | +Make sure the newest version of browser-use is installed: |
| 29 | +```bash |
| 30 | +pip install -U browser-use |
| 31 | +``` |
| 32 | + |
| 33 | +Export your Gemini API key, get it from: [Google AI Studio](https://makersuite.google.com/app/apikey) |
| 34 | +```bash |
| 35 | +export GOOGLE_API_KEY='your-gemini-api-key-here' |
| 36 | +``` |
| 37 | + |
| 38 | +Clone the repo and cd into the app folder |
| 39 | +```bash |
| 40 | +git clone https://github.com/browser-use/browser-use.git |
| 41 | +cd browser-use/examples/apps/msg-use |
| 42 | +``` |
| 43 | + |
| 44 | +## Initial Login |
| 45 | + |
| 46 | +First-time setup requires QR code scanning: |
| 47 | +```bash |
| 48 | +python login.py |
| 49 | +``` |
| 50 | +- Scan QR code when browser opens |
| 51 | +- Session will be saved for future use |
| 52 | + |
| 53 | +## Normal Usage |
| 54 | + |
| 55 | +1. **Edit your schedule** in `messages.txt`: |
| 56 | +``` |
| 57 | +- Send "Hi" to Magnus on the 13.06 at 18:15 |
| 58 | +- Tell hinge date (Camila) at 20:00 that I miss her |
| 59 | +- Send happy birthday message to sister on the 15.06 |
| 60 | +- Remind mom to pick up the car next tuesday |
| 61 | +``` |
| 62 | + |
| 63 | +2. **Test mode** - See what will be sent: |
| 64 | +```bash |
| 65 | +python scheduler.py --test |
| 66 | +``` |
| 67 | + |
| 68 | +3. **Run scheduler**: |
| 69 | +```bash |
| 70 | +python scheduler.py |
| 71 | +
|
| 72 | +# Debug Mode - See the browser in action |
| 73 | +python scheduler.py --debug |
| 74 | +``` |
| 75 | + |
| 76 | +## Programmatic Usage |
| 77 | + |
| 78 | +```python |
| 79 | +import asyncio |
| 80 | +from scheduler import schedule_messages |
| 81 | +
|
| 82 | +async def main(): |
| 83 | + messages = [ |
| 84 | + "Send hello to John at 15:30", |
| 85 | + "Remind Sarah about meeting tomorrow at 9am" |
| 86 | + ] |
| 87 | + await schedule_messages(messages, debug=False) |
| 88 | +
|
| 89 | +asyncio.run(main()) |
| 90 | +``` |
| 91 | + |
| 92 | +## Example Output |
| 93 | + |
| 94 | +The scheduler processes natural language and outputs structured results: |
| 95 | + |
| 96 | +```json |
| 97 | +[ |
| 98 | + { |
| 99 | + "contact": "Magnus", |
| 100 | + "original_message": "Hi", |
| 101 | + "composed_message": "Hi", |
| 102 | + "scheduled_time": "2025-06-13 18:15" |
| 103 | + }, |
| 104 | + { |
| 105 | + "contact": "Camila", |
| 106 | + "original_message": "I miss her", |
| 107 | + "composed_message": "I miss you ❤️", |
| 108 | + "scheduled_time": "2025-06-14 20:00" |
| 109 | + }, |
| 110 | + { |
| 111 | + "contact": "sister", |
| 112 | + "original_message": "happy birthday message", |
| 113 | + "composed_message": "Happy birthday! 🎉 Wishing you an amazing day, sis! Hope you have the best birthday ever! ❤️🎂🎈", |
| 114 | + "scheduled_time": "2025-06-15 09:00" |
| 115 | + } |
| 116 | +] |
| 117 | +``` |
| 118 | + |
| 119 | +## Source Code |
| 120 | + |
| 121 | +Full implementation: [https://github.com/browser-use/browser-use/tree/main/examples/apps/msg-use](https://github.com/browser-use/browser-use/tree/main/examples/apps/msg-use) |
0 commit comments