diff --git a/README.md b/README.md index 2029057..c456343 100644 --- a/README.md +++ b/README.md @@ -61,11 +61,11 @@ Set up poke-mail (https://github.com/kacperkwapisz/poke-mail) for me — clone t cp config.example.yml config.yml ``` -Edit `config.yml` with your email credentials and Poke API key (from [poke.com/settings/advanced](https://poke.com/settings/advanced)): +Edit `config.yml` with your email credentials and Poke API key (from [poke.com/kitchen](https://poke.com/kitchen) → API Keys — **not** Settings → Advanced or the Recipes page; those issue a legacy `pk_` key that only works with the deprecated `inbound-sms/webhook` endpoint, not the one below): ```yaml webhook_url: https://poke.com/api/v1/inbound/api-message -poke_api_key: your-api-key # from https://poke.com/settings/advanced +poke_api_key: your-api-key # from https://poke.com/kitchen → API Keys (V2 key required for this endpoint) accounts: # iCloud Mail — login is @icloud.com, send as your custom domain diff --git a/src/server.py b/src/server.py index 3deb8d5..2559ea3 100644 --- a/src/server.py +++ b/src/server.py @@ -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"], diff --git a/start.sh b/start.sh index cf89bf6..29524a1 100644 --- a/start.sh +++ b/start.sh @@ -183,7 +183,9 @@ PYEOF echo "" else echo " ⚠ poke_api_key not set in config.yml." - echo " Run 'npx poke login' then restart, or paste your key from poke.com/settings/advanced" + echo " Run 'npx poke login' then restart, or paste a V2 key from poke.com/kitchen -> API Keys" + echo " (Settings > Advanced and the Recipes page issue a different, incompatible key —" + echo " the webhook_url above requires a V2 key created in Kitchen)" echo "" printf " Poke API key (leave blank to set manually later): " read -r POKE_TOKEN_INPUT