File size: 616 Bytes
122f1c3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import os
import requests

def post_to_note(title: str, body_md: str):
    """
    MVPでは Zapier/IFTTT 等の Webhook に Markdown を渡す想定。
    NOTE_WEBHOOK_URL が未設定なら安全にスキップします。
    """
    url = os.getenv("NOTE_WEBHOOK_URL", "")
    if not url:
        return {"status": "skipped", "reason": "NOTE_WEBHOOK_URL not set"}
    try:
        r = requests.post(url, json={"title": title, "content_md": body_md}, timeout=20)
        return {"status": r.status_code, "resp": r.text[:200]}
    except Exception as e:
        return {"status": "error", "reason": str(e)[:200]}