Add invoice PDF download guidance to attachment workflow
Prefer downloading PDFs from URLs in email body (Stripe links, etc.) over extracting base64 attachments from Fastmail, which can truncate on large results exceeding the token save limit.
This commit is contained in:
14
SKILL.md
14
SKILL.md
@@ -153,6 +153,20 @@ After entering bills:
|
||||
|
||||
## Uploading Attachments
|
||||
|
||||
### Downloading Invoice PDFs from Email
|
||||
|
||||
When emails contain PDF attachments, the Fastmail `include_attachments: true` parameter can cause the result to exceed the token save limit (~25K tokens), truncating the base64 data and making extraction impossible.
|
||||
|
||||
**Preferred approach — download from URL first:**
|
||||
Many vendor emails (Stripe/Anthropic, Hetzner, etc.) include direct PDF download links in the email body. Extract the URL from `textBody` and download with `curl -sL -o <path> "<url>"`. This is faster and more reliable than attachment extraction.
|
||||
|
||||
**Fallback — extract from attachment:**
|
||||
Only use `include_attachments: true` if no download URL is available. If the saved result file is truncated (check with `tail -c 200`), the attachment cannot be recovered from that fetch — do not retry parsing.
|
||||
|
||||
**File naming convention:** `{Vendor}_{YYYY-MM-DD}_{InvoiceNumber}.pdf` saved to `invoices/`.
|
||||
|
||||
### Upload to Grist
|
||||
|
||||
```bash
|
||||
# Get session token, then:
|
||||
bash scripts/upload-attachment.sh invoice.pdf Bills {id} $TOKEN Invoice
|
||||
|
||||
Reference in New Issue
Block a user