Fix Poke webhook: verify success field, point key setup to Kitchen
- forward_to_poke now checks the response's success field instead of trusting the HTTP status alone; Poke can return 200 with success: false on a soft failure, which was previously logged and treated as delivered. - README/start.sh pointed users to Settings > Advanced for the API key, which issues a legacy pk_ key incompatible with the inbound/api-message endpoint this project uses. Now points to poke.com/kitchen -> API Keys for a V2 key. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -445,6 +445,14 @@ async def forward_to_poke(
|
||||
async with httpx.AsyncClient(timeout=30) as http:
|
||||
resp = await http.post(webhook_url, json=payload, headers=headers)
|
||||
resp.raise_for_status()
|
||||
# A 2xx status doesn't guarantee delivery — Poke can return
|
||||
# HTTP 200 with {"success": false, ...} on a soft failure, so
|
||||
# the status code alone isn't sufficient confirmation.
|
||||
result = resp.json()
|
||||
if not result.get("success", True):
|
||||
raise RuntimeError(
|
||||
f"Poke reported failure: {result.get('message', 'unknown error')}"
|
||||
)
|
||||
logger.info(
|
||||
"Forwarded email '%s' to Poke (status %d)",
|
||||
email_data["subject"],
|
||||
|
||||
Reference in New Issue
Block a user