Direct mail API for Grok
Direct mail API for Grok: copy Mailr's skill into .grok/skills, ask Grok Build to mail a postcard when something happens in your app, and it writes the request, the trigger and a test against a free key.
What to mail from Grok
| When this happens | Mail this |
|---|---|
| A customer's first order ships | A thank-you postcard with a code for the next order. (First-order thank you) |
| A card payment fails twice | A plain billing letter after the emails didn't work. (Failed payment) |
| A customer hasn't ordered in 90 days | A win-back postcard with an offer. (Win-back) |
Set it up
- Install Grok Build. Run the installer from xAI, then start grok in your repo. It signs in with your X account or an xAI API key on first run.
- Add the skill. Download https://mailr.dev/downloads/mailr-kit.zip and copy skills/mailr-direct-mail into .grok/skills/ in your repo, or ~/.grok/skills/ for every project. Grok Build also reads Claude Code skills, so a repo already set up for Claude Code works as it is.
- Add your test key. Create a test key in the dashboard (Developers) and put it in .env as MAILR_API_KEY. Test pieces are free and never print.
- Ask for the feature. Type /mailr-direct-mail and say what should trigger mail and what it should say. The skill tells Grok to build against the test key, send an Idempotency-Key and save the piece id on the record.
- Go live. The test piece moves through every status in about 8 minutes. Add funds, swap in the live key, and the same code prints and mails.
Set up Grok Build
curl -fsSL https://x.ai/cli/install.sh | bash
curl -LO https://mailr.dev/downloads/mailr-kit.zip
unzip mailr-kit.zip
mkdir -p .grok/skills && cp -r mailr-kit/skills/mailr-direct-mail .grok/skills/
grok inspect # lists the skills Grok found- Grok Build loads skills from .grok/skills in the project, ~/.grok/skills and ~/.agents/skills. Run grok inspect to see what it found.
- It reads AGENTS.md and CLAUDE.md too, so a line like "mail through Mailr, never commit MAILR_API_KEY" there applies to every task.
- Keep MAILR_API_KEY out of the repo; the skill tells the agent to read it from the environment.
What it costs
Each live piece is paid from your Mailr balance, printing and postage included: a 4x6 postcard is $0.85, a 6x9 $0.89 and an 8.5x11 letter $0.95 on pay as you go, less on a plan. Test pieces are free. All prices.
Templates that fit: First-order thank you (6x9), Failed payment (8.5x11), Win-back (6x11).
Questions
Does Mailr have an MCP server?
Not yet. Grok Build works through the REST API, guided by the skill file in the template kit and https://mailr.dev/llms.txt.
Can Grok design the postcard too?
Yes. The skill gives it the page size with bleed, the safe area and the address block for every size, so it can write front and back HTML that passes the pre-print check.
Do I need a separate skill for Grok and Claude Code?
No. It's the same SKILL.md. Grok Build reads its own .grok/skills folder and Claude Code skills, so one copy can serve both.
What does a test cost?
Nothing. Test keys never print or charge. Live postcards start at $0.85 with postage.