recoup-platform-email-helper
This skill is a Node.js script that reliably sends emails via the email API. It automatically serializes the request body, avoiding escaping errors from manual curl commands, ensuring emails are sent correctly. Use it in tasks to email reports, notifications, or summaries to recipients; always use this script instead of hand-building requests.
npx skills add https://github.com/recoupable/skills --skill recoup-platform-email-helperBefore / After Comparison
1 组Developers manually building curl requests often encounter quoting errors that result in API success but empty emails, making debugging time-consuming and unreliable.
This skill automatically serializes the request body and validates it, ensuring emails are sent correctly and failing loudly on errors, eliminating the need to debug empty emails.
Sending email from a task
Send email by running the bundled Node script — do not assemble JSON in the shell.
Why this exists
Hand-rolling the send (curl -sS … -d "{… \"html\": $(echo "$HTML" | jq -R -s '.') …}") is fragile: depending on quoting/escaping it produces a malformed body, and the API used to silently deliver an empty footer-only email titled "Message from Recoup" with success:true. The model gets this wrong stochastically. This script removes shell serialization entirely.
How to send
-
Write the email body to a file (recommended for HTML — avoids all escaping issues):
cat > /tmp/report.html <<'HTML' <h1>Daily Report</h1> <p>…your real content…</p> HTML -
Send it:
node "$SKILL_DIR/scripts/send-email.mjs" \ --subject "Daily Report — $(date '+%B %d, %Y')" \ --html-file /tmp/report.html \ --to owner@example.com
$SKILL_DIR is this skill's install directory (~/.agents/skills/recoup-platform-email-helper); use the absolute path to scripts/send-email.mjs.
Flags
| Flag | Meaning |
|---|---|
--subject <s> | Subject line (optional — the API derives one from the body if omitted). |
--html-file <path> / --html <s> | HTML body. Prefer --html-file. |
--text-file <path> / --text <s> | Plain-text body. |
--to <email> | Recipient (repeatable). Omit to default to the account's own email ("email me this"). |
--cc <email> | CC (repeatable). |
--chat-id <id> | Room id for the footer "continue the conversation" link. |
--dry-run | Serialize + validate and print the payload; do not send. Use to preview. |
Rules
- Exactly one body is required. The script refuses to send (exit code 2) if there is no non-empty
--html/--text. Never try to send an empty email. - Check the exit code. Non-zero means it did not send — read stderr and fix it; do not report success. The script prints the Resend message id on a real send.
- The script reads
RECOUP_API_KEY/RECOUP_ACCESS_TOKENandRECOUP_API_BASEfrom the environment — these are already set in the sandbox. Never print or hard-code them. - Node only (the sandbox runtime is
node22;python3is not guaranteed). Zero dependencies.
User Reviews (0)
Write a Review
No reviews yet
Statistics
User Rating
Rate this Skill