WhatsApp Triage
Process WHATSAPP_*.md files from /Needs_Action/. Detect intent, assign priority, create action plans, and route all outgoing actions to /Pending_Approval/. All WhatsApp sends require HITL approval — never act directly.
Workflow
- Read the
WHATSAPP_*.md file from /Needs_Action/
- Detect intent — see
references/intents.md for classification patterns
- Assign priority based on urgent keywords (already set by watcher):
- high: urgent, asap, invoice, payment, emergency, important
- medium: help, problem, price, quote, service inquiry
- low: general conversation, thank you messages
- Create action plan in
/Plans/PLAN_WHATSAPP_{timestamp}.md using templates from references/action-templates.md
- Route sensitive messages to
/Pending_Approval/ for human review:
- Payment/invoice messages (always)
- Urgent/emergency messages (always)
- All reply drafts (always — never send without approval)
- Log action to
/Vault/Logs/YYYY-MM-DD.json
- Move source
WHATSAPP_*.md to /Done/ when plan is complete
- Output
<promise>TASK_COMPLETE</promise>
Urgent Keywords (from watcher)
The WhatsApp watcher automatically flags messages containing these keywords and marks them as priority: high:
urgent
asap
invoice
payment
emergency
important
These are defined in watchers/whatsapp_watcher.py:18:
python
1URGENT_KEYWORDS = ["urgent", "asap", "invoice", "payment", "emergency", "important"]
Action Decision Tree
WHATSAPP_*.md arrives in /Needs_Action/
│
├─ Contains "payment" or "invoice"? → Generate invoice plan → /Pending_Approval/ (high priority)
│
├─ Contains "urgent" or "emergency"? → Draft urgent response → /Pending_Approval/ (high priority)
│
├─ Contains "price" or "quote"? → Draft pricing response → /Pending_Approval/ (medium priority)
│
├─ Service inquiry? → Draft informative response → /Pending_Approval/ (medium priority)
│
└─ General message? → Determine if response needed → /Pending_Approval/ or archive
Files created by the watcher have this structure:
markdown
1---
2type: whatsapp
3source: whatsapp_web
4received: {iso_timestamp}
5priority: high
6status: pending
7msg_id: {hash_id}
8---
9
10# WhatsApp Urgent Message
11
12**Received:** {date_time}
13**Priority:** High
14
15## Message Preview
16{message_text_with_context}
17
18## Matched Keyword In
19{line_that_triggered_urgent_flag}
20
21## Suggested Actions
22- [ ] Reply to sender
23- [ ] Generate invoice if requested
24- [ ] Escalate if payment-related
Plan.md Template
markdown
1---
2type: plan
3created: {iso_timestamp}
4source_file: WHATSAPP_{timestamp}.md
5source_type: whatsapp
6priority: {high|medium|low}
7status: pending
8---
9
10# Plan: WhatsApp — {detected_intent}
11
12## Context
13**Received:** {date}
14**Priority:** {priority}
15**Matched Keywords:** {keywords}
16
17## Objective
18{one-line goal — e.g., "Draft reply to urgent client inquiry about project status"}
19
20## Steps
21- [ ] {step 1}
22- [ ] {step 2}
23- [ ] {step 3}
24...
25
26## Completion Rule
27Move this file and source WHATSAPP_*.md to /Done/ when {completion condition}.
Security Rules
- NEVER send WhatsApp messages directly — always write drafts to
/Pending_Approval/
- ALWAYS route payment/invoice messages to
/Pending_Approval/ for human review
- ALWAYS route urgent messages to
/Pending_Approval/ for immediate human attention
- ALWAYS log every action to
/Vault/Logs/YYYY-MM-DD.json
- NEVER delete WHATSAPP_*.md files — move to
/Done/ instead
- NEVER confirm payment receipt without explicit human verification
When routing replies to /Pending_Approval/, use this format:
markdown
1---
2type: whatsapp_reply
3action: send_whatsapp
4to: {contact_name}
5phone: {phone_number}
6source_file: WHATSAPP_{timestamp}.md
7priority: {high|medium|low}
8created: {iso_timestamp}
9status: awaiting_approval
10---
11
12# WhatsApp Reply: {contact_name}
13
14**To:** {contact_name} ({phone_number})
15**Priority:** {priority}
16
17## Message to Send
18
19{reply_text}
20
21---
22
23## Original Message Context
24**Received:** {date}
25**Matched Keywords:** {keywords}
26**Content:** {original message preview}
27
28---
29
30## To Approve
31Move this file to /Approved folder.
32
33## To Reject
34Move this file to /Rejected folder or delete.
35
36---
37*Awaiting human approval before sending*
For invoice generation requests:
markdown
1---
2type: invoice
3action: generate_invoice
4client: {client_name}
5source_file: WHATSAPP_{timestamp}.md
6priority: high
7created: {iso_timestamp}
8status: awaiting_approval
9---
10
11# Invoice Request: {client_name}
12
13**Client:** {client_name}
14**Service/Period:** {description}
15**Amount:** ${amount}
16
17## Invoice Details
18
19**To:** {client_name}
20**Email:** {client_email}
21**Amount:** ${amount}
22**Due Date:** {date}
23**Bank Details:** {from Company_Handbook.md}
24
25## Description
26{service description}
27
28---
29
30## Original WhatsApp Request
31**Received:** {date}
32**Content:** {original message}
33
34---
35
36## To Approve
37Move this file to /Approved folder to generate and send invoice.
38
39## To Reject
40Move this file to /Rejected folder.
41
42---
43*Awaiting human approval before generating invoice*
Intent Detection Guide
See references/intents.md for detailed intent classification patterns:
- Invoice Request (high priority, always approve)
- Payment Confirmation/Query (high priority, always approve)
- Urgent Query/Problem (high priority)
- Pricing Query (medium priority)
- Service Inquiry (medium priority)
- Appointment/Scheduling (medium priority)
- General/Informational (low priority)
Action Templates
See references/action-templates.md for complete plan templates:
- Reply Plan Template
- Invoice Generation Plan Template
- Urgent Escalation Template
- Payment/Financial Escalation Template
- Pricing Query Plan Template
- General Query Plan Template
Example Scenarios
Scenario 1: Invoice request
Input: WHATSAPP_20260305_120000.md
Content: "Hi, can you send me the invoice for this month?"
Matched Keywords: "invoice"
Priority: high
Action: Create invoice generation plan
Output: PLAN_WHATSAPP_20260305_120000_invoice.md in /Plans/
Route: INVOICE_{client}_{timestamp}.md to /Pending_Approval/
Scenario 2: Urgent problem
Input: WHATSAPP_20260305_140000.md
Content: "Urgent! The website is down, clients can't access it"
Matched Keywords: "urgent"
Priority: high
Action: Draft urgent response plan
Output: PLAN_WHATSAPP_20260305_140000_urgent.md in /Plans/
Route: WHATSAPP_REPLY_{timestamp}.md to /Pending_Approval/
Scenario 3: Pricing inquiry
Input: WHATSAPP_20260305_160000.md
Content: "How much do you charge for web design?"
Matched Keywords: "how much", "charge"
Priority: medium
Action: Draft pricing response using /Vault/Accounting/Rates.md
Output: PLAN_WHATSAPP_20260305_160000_pricing.md in /Plans/
Route: WHATSAPP_REPLY_{timestamp}.md to /Pending_Approval/
Scenario 4: Payment confirmation
Input: WHATSAPP_20260305_180000.md
Content: "I just transferred the payment, transaction ID: 12345"
Matched Keywords: "payment", "transferred"
Priority: high
Action: Escalate to human for verification (NEVER auto-confirm)
Output: PLAN_WHATSAPP_20260305_180000_payment.md in /Plans/
Route: Copy WHATSAPP_*.md to /Pending_Approval/ immediately
Scenario 5: Thank you message
Input: WHATSAPP_20260305_200000.md
Content: "Thanks for the quick response!"
Matched Keywords: "thanks"
Priority: low
Action: Archive (no response needed)
Output: Move WHATSAPP_*.md to /Done/, log action
Every WhatsApp action must be logged to /Vault/Logs/YYYY-MM-DD.json:
Triage log:
json
1{
2 "timestamp": "2026-03-05T14:30:00Z",
3 "action_type": "whatsapp_triage",
4 "source_file": "WHATSAPP_20260305_143000.md",
5 "intent": "invoice_request",
6 "priority": "high",
7 "action_taken": "created_invoice_plan",
8 "plan_file": "PLAN_WHATSAPP_20260305_143000_invoice.md",
9 "routed_to_approval": true
10}
Reply draft log:
json
1{
2 "timestamp": "2026-03-05T14:30:00Z",
3 "action_type": "whatsapp_draft_created",
4 "source_file": "WHATSAPP_20260305_143000.md",
5 "recipient": "Client Name",
6 "intent": "urgent_query",
7 "priority": "high",
8 "approval_file": "WHATSAPP_REPLY_20260305_143000.md"
9}
Archive log:
json
1{
2 "timestamp": "2026-03-05T14:30:00Z",
3 "action_type": "whatsapp_archived",
4 "source_file": "WHATSAPP_20260305_143000.md",
5 "intent": "general",
6 "priority": "low",
7 "reason": "no_response_needed"
8}
Completion Signal
Always end with: <promise>TASK_COMPLETE</promise>