I built this so X articles can sit unread on my Kindle instead of unread in my bookmarks folder.
Articles on X are becoming really big. There's new long-form content every day, but not everybody has the time in that moment to actually read the whole thing. So you either bookmark it (which is what most people do), or you do what I've started doing. I send the article to my OpenClaw agent on iMessage, and he sends it directly to my Kindle. One message, done. It's become the skill I use most in my day-to-day browsing, and I want to share it here so you can set it up yourself.
What It Does
Three steps:
- Extract. Downloads the article and converts it to EPUB with embedded images.
- Patch. Fixes the metadata (title, author) so it looks right on your Kindle.
- Deliver. Sends the EPUB to your Kindle's email address via Gmail.
No third-party services. No extra API keys. Everything runs locally.
Prerequisites
You need three things.
1. kindle-send CLI
This handles converting a URL into an EPUB. It extracts article content (like a reader mode), pulls images, and packages it all up.
brew install nikhil1raghav/tap/kindle-send
2. A way to send email from the command line
I use gog (a Google Workspace CLI) with Gmail OAuth. Any CLI email tool works. msmtp, sendmail, mutt, whatever. The only requirement is that the sending address needs to be in your Kindle's approved email list.
3. Your Kindle's email address
Every Kindle has a @kindle.com address. You can find it in Amazon, under Manage Your Content and Devices, then Preferences, then Personal Document Settings.
The Skill
An OpenClaw skill is a folder with a SKILL.md (tells the agent what to do) and supporting scripts.
SKILL.md
---
name: kindle-send
description: >
Send web articles and URLs to Kindle as properly formatted EPUBs.
Handles URL extraction, EPUB conversion, and delivery via Gmail.
---
# kindle-send
Send web articles to Kindle as formatted EPUBs with images.
## Usage
### Single article
```
scripts/send-to-kindle.sh <url> [title] [author]
```
- url — Any web article URL
- title — Optional. Auto-extracted if omitted.
- author — Optional. Shows as the author line on Kindle.
### PDFs
Send directly. Amazon converts to Kindle format on delivery.
```
gog gmail send \
--to "your-kindle@kindle.com" \
--subject "Document Title" \
--body "PDF attached." \
--attach "/path/to/file.pdf"
```
Supported formats: PDF, EPUB, MOBI, DOC, DOCX, TXT, HTML, RTF.
send-to-kindle.sh
The wrapper script. Replace the Kindle email and Gmail account with your own.
#!/bin/bash
set -euo pipefail
URL="$1"
TITLE="$2" # optional
AUTHOR="$3" # optional
KINDLE_EMAIL="your-kindle@kindle.com"
DOWNLOAD_DIR="/tmp/kindle-epub"
# Download and convert to EPUB
kindle-send download "$URL"
# Find the generated EPUB
EPUB=$(ls -t "$DOWNLOAD_DIR"/*.epub 2>/dev/null | head -1)
# Extract title from EPUB metadata if not provided
if [ -z "$TITLE" ]; then
TITLE=$(unzip -p "$EPUB" EPUB/package.opf 2>/dev/null \
| grep 'dc:title' \
| sed 's/.*<dc:title>\(.*\)<\/dc:title>.*/\1/')
fi
# Patch metadata (title + author) inside the EPUB
TMPDIR=$(mktemp -d)
unzip -q -o "$EPUB" -d "$TMPDIR"
OPF="$TMPDIR/EPUB/package.opf"
if [ -n "$TITLE" ]; then
sed -i '' "s|<dc:title>.*</dc:title>|<dc:title>$TITLE</dc:title>|" "$OPF"
fi
if [ -n "$AUTHOR" ]; then
sed -i '' "s|<dc:creator>.*</dc:creator>|<dc:creator>$AUTHOR</dc:creator>|" "$OPF"
fi
# Repack the EPUB
(cd "$TMPDIR" && zip -q -r "$EPUB" . -x ".*")
rm -rf "$TMPDIR"
# Rename file to match title (Amazon uses filename for display)
CLEAN_NAME=$(echo "$TITLE" | sed 's/[^a-zA-Z0-9 ]//g')
NEW_EPUB="$DOWNLOAD_DIR/$CLEAN_NAME.epub"
mv "$EPUB" "$NEW_EPUB"
# Send via email
gog gmail send \
--to "$KINDLE_EMAIL" \
--subject "$TITLE" \
--body "Sent via kindle-send" \
--attach "$NEW_EPUB" \
--account your-email@gmail.com \
--client web
How It Works in Practice
I'm scrolling X. Someone shares a long essay. I send a message to my agent: "Send this to my Kindle" with the link. A minute later it's on my Kindle with images, a proper title, and the author name. I read it later on the couch or before bed.
Works for PDFs too. Government reports, research papers, whitepapers. And if you want to save an X thread, you can grab the content with a reading tool first, convert to HTML, then run it through the same pipeline.
Gotchas We Hit So You Don't Have To
Amazon uses the filename as the display title. If you send a8f2d-article-slug.epub, that's what shows up in your Kindle library. The metadata patching and file rename in the script aren't optional. They're what make the reading experience actually feel clean.
EPUB metadata matters more than you'd think. The dc:title field becomes the book title, dc:creator becomes the author line. Without patching these, you get garbage like "kindle-send download" as the title. The script handles this automatically.
Some URLs just won't convert. Paywalled sites, heavy JavaScript, weird layouts. When kindle-send download fails, you can fall back to fetching the page content another way, saving it as HTML, and converting with pandoc. The email delivery step stays the same.
No accounts, no subscriptions. This is a bash script and a CLI tool. No Instapaper, no Pocket, no browser extension that breaks when the startup pivots. It'll work until email stops working.
Built with OpenClaw.
