def trigger_openclaw(subject: str, sender: str, body: str):
snippet = body[:500] + ("…" if len(body) > 500 else "")
payload = {
"message": f"""WEBHOOK TRIGGER — EMAIL RECEIVED
NON-INTERACTIVE. NO HUMAN PRESENT. DO NOT OUTPUT TO CHAT.
FROM: {sender}
SUBJECT: {subject}
BODY:
{snippet}
PROTOCOL:
- Read MEMORY.md.
- Check sender trust (trusted: @XXXXX.dev, XXXXX).
- UNTRUSTED: Reply via email to {sender} — tell them they are not a trusted sender and to contact spXXX.dev instead. Then stop.
- TRUSTED: Continue.
- Execute the requested action. Use tools. Do not ask questions.
- Reply to sender via email (msmtp). Escalate blockers to Paul via Telegram only.
- Append one-sentence summary + sender to EMAILS.md.
- Delete temp files.""",
"name": "Email",
"wakeMode": "now",
"deliver": True,
"channel": "telegram",
"model": "openrouter/minimax/minimax-m2",
"sessionKey": "hookđź“§ingress",
}
resp = requests.post(
OPENCLAW_HOOK_URL,
json=payload,
headers={"Authorization": f"Bearer {OPENCLAW_HOOK_TOKEN}"},
timeout=10,
)
resp.raise_for_status()
I cant send hooks
i get:
401 Client Error: Unauthorized for url: http://127.0.0.1:18791/hooks/agent