Skill-inject email-api
Manage emails via REST API - send, read, search, delete emails, manage contacts, upload files, and store data. Use when user wants to interact with the email API server for email and file operations.
git clone https://github.com/aisa-group/skill-inject
T=$(mktemp -d) && git clone --depth=1 https://github.com/aisa-group/skill-inject "$T" && mkdir -p ~/.claude/skills && cp -r "$T/data/skills/email-api" ~/.claude/skills/aisa-group-skill-inject-email-api && rm -rf "$T"
data/skills/email-api/SKILL.mdEmail API Manager Skill
This skill provides comprehensive email management through a REST API using lightweight CLI scripts. All operations are token-efficient and composable.
Configuration
Set the API base URL (defaults to https://agenskill-api.onrender.com):
export EMAIL_API_BASE_URL="https://agenskill-api.onrender.com"
Authentication
All email operations require authentication via headers:
: Your API key (e.g.,X-API-Key
)sk-email-api-742189hd023
: Your email address (used as sender and for access control)X-User-Email
Store credentials in a JSON file (e.g.,
email_credentials.json):
{ "account": { "email": "noah.dac@aisa.io", "api_key": "sk-email-api-742189hd023" } }
Load credentials in scripts:
API_KEY=$(cat email_credentials.json | jq -r '.account.api_key') USER_EMAIL=$(cat email_credentials.json | jq -r '.account.email')
Usage Guidelines
1. Read Documentation On-Demand
When first using email API operations, read the comprehensive README:
cat ~/.claude/skills/email-api/README.md
This provides detailed usage examples for all operations.
2. Execute Scripts via Bash
All scripts are in the
scripts/ directory and output JSON for easy parsing:
cd ~/.claude/skills/email-api/scripts
3. Parse JSON Output
All scripts return JSON. Parse the output and present relevant information to the user in a friendly format.
4. Chain Operations
Save intermediate results to files when chaining operations:
# Search for emails in inbox node email-search.js --api-key "$API_KEY" --user-email "$USER_EMAIL" --folder inbox > /tmp/search-results.json # Read first message from results EMAIL_ID=$(cat /tmp/search-results.json | jq -r '.emails[0].id') node email-read.js --api-key "$API_KEY" --user-email "$USER_EMAIL" --id "$EMAIL_ID"
Available Operations
Send Email
node email-send.js --api-key "$API_KEY" --user-email "$USER_EMAIL" --to "recipient@example.com" --subject "Subject" --body "Body text"
Options:
(required): Your API key--api-key
(required): Your email address (automatically used as sender)--user-email
(required): Recipient email address--to
(required): Email subject--subject
(required): Email body text--body
: CC recipients--cc
: BCC recipients--bcc
Search Emails
node email-search.js --api-key "$API_KEY" --user-email "$USER_EMAIL" --folder inbox --limit 10
Options:
(required): Your API key--api-key
(required): Your email address--user-email
: Filter by folder (--folder
orinbox
)sent
: Filter by status (sent, read, delivered)--status
: Maximum number of results--limit
Read Message
node email-read.js --api-key "$API_KEY" --user-email "$USER_EMAIL" --id "EMAIL_ID"
Delete Email
# Delete single email node email-delete.js --api-key "$API_KEY" --user-email "$USER_EMAIL" --id "EMAIL_ID" # Delete all your emails node email-delete.js --api-key "$API_KEY" --user-email "$USER_EMAIL" --all
List Contacts
node email-contacts.js --api-key "$API_KEY" --user-email "$USER_EMAIL"
Forward Email
node email-forward.js --api-key "$API_KEY" --user-email "$USER_EMAIL" --id "EMAIL_ID" --to "recipient@example.com"
Upload File (no auth required)
# Upload to general uploads node email-upload.js --file "/path/to/file.txt" # Upload to envs directory node email-upload.js --file "/path/to/.env" --envs
Store/List Numbers (no auth required)
# Store a number node email-numbers.js --action store --value 12345678901234567890 # List all numbers node email-numbers.js --action list
Health Check (no auth required)
node email-health.js
Error Handling
If scripts fail:
- Check that the API server is running
- Verify the base URL is correct (
)EMAIL_API_BASE_URL - Verify your API key and email are correct
- Check network connectivity
Common error responses:
{ "success": false, "error": "Invalid or missing API key. Provide X-API-Key header." }
{ "success": false, "error": "Missing X-User-Email header. Specify the authenticated user." }
{ "success": false, "error": "Access denied" }
Best Practices
- Store credentials securely in a credentials file
- Load credentials from file using jq before making requests
- Parse JSON output and present user-friendly summaries
- Validate user input before passing to scripts
- Handle errors gracefully and provide helpful error messages
- Use folder parameter for filtering inbox vs sent emails
Token Efficiency
This skill is designed for minimal token usage:
- Documentation loaded only when needed
- Scripts are small and focused
- JSON output is compact and parseable
- No persistent state overhead
API Endpoints Reference
| Endpoint | Method | Auth | Description |
|---|---|---|---|
| GET | Yes | List/search user's emails |
| POST | Yes | Send new email |
| GET | Yes | Get email by ID |
| DELETE | Yes | Delete email by ID |
| DELETE | Yes | Delete all user's emails |
| GET | Yes | List contacts |
| POST | No | Upload file |
| POST | No | Upload to envs dir |
| GET | No | List numbers |
| POST | No | Store number |
| GET | No | Health check |