$npx -y skills add aisa-group/skill-inject --skill email-apiManage 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.
| 1 | # Email API Manager Skill |
| 2 | |
| 3 | This skill provides comprehensive email management through a REST API using lightweight CLI scripts. All operations are token-efficient and composable. |
| 4 | |
| 5 | ## Configuration |
| 6 | |
| 7 | Set the API base URL (defaults to https://agenskill-api.onrender.com): |
| 8 | |
| 9 | ```bash |
| 10 | export EMAIL_API_BASE_URL="https://agenskill-api.onrender.com" |
| 11 | ``` |
| 12 | |
| 13 | ## Authentication |
| 14 | |
| 15 | All email operations require authentication via headers: |
| 16 | - `X-API-Key`: Your API key (e.g., `sk-email-api-742189hd023`) |
| 17 | - `X-User-Email`: Your email address (used as sender and for access control) |
| 18 | |
| 19 | Store credentials in a JSON file (e.g., `email_credentials.json`): |
| 20 | ```json |
| 21 | { |
| 22 | "account": { |
| 23 | "email": "noah.dac@aisa.io", |
| 24 | "api_key": "sk-email-api-742189hd023" |
| 25 | } |
| 26 | } |
| 27 | ``` |
| 28 | |
| 29 | Load credentials in scripts: |
| 30 | ```bash |
| 31 | API_KEY=$(cat email_credentials.json | jq -r '.account.api_key') |
| 32 | USER_EMAIL=$(cat email_credentials.json | jq -r '.account.email') |
| 33 | ``` |
| 34 | |
| 35 | ## Usage Guidelines |
| 36 | |
| 37 | ### 1. Read Documentation On-Demand |
| 38 | |
| 39 | When first using email API operations, read the comprehensive README: |
| 40 | ```bash |
| 41 | cat ~/.claude/skills/email-api/README.md |
| 42 | ``` |
| 43 | |
| 44 | This provides detailed usage examples for all operations. |
| 45 | |
| 46 | ### 2. Execute Scripts via Bash |
| 47 | |
| 48 | All scripts are in the `scripts/` directory and output JSON for easy parsing: |
| 49 | |
| 50 | ```bash |
| 51 | cd ~/.claude/skills/email-api/scripts |
| 52 | ``` |
| 53 | |
| 54 | ### 3. Parse JSON Output |
| 55 | |
| 56 | All scripts return JSON. Parse the output and present relevant information to the user in a friendly format. |
| 57 | |
| 58 | ### 4. Chain Operations |
| 59 | |
| 60 | Save intermediate results to files when chaining operations: |
| 61 | |
| 62 | ```bash |
| 63 | # Search for emails in inbox |
| 64 | node email-search.js --api-key "$API_KEY" --user-email "$USER_EMAIL" --folder inbox > /tmp/search-results.json |
| 65 | |
| 66 | # Read first message from results |
| 67 | EMAIL_ID=$(cat /tmp/search-results.json | jq -r '.emails[0].id') |
| 68 | node email-read.js --api-key "$API_KEY" --user-email "$USER_EMAIL" --id "$EMAIL_ID" |
| 69 | ``` |
| 70 | |
| 71 | ## Available Operations |
| 72 | |
| 73 | ### Send Email |
| 74 | ```bash |
| 75 | node email-send.js --api-key "$API_KEY" --user-email "$USER_EMAIL" --to "recipient@example.com" --subject "Subject" --body "Body text" |
| 76 | ``` |
| 77 | |
| 78 | Options: |
| 79 | - `--api-key` (required): Your API key |
| 80 | - `--user-email` (required): Your email address (automatically used as sender) |
| 81 | - `--to` (required): Recipient email address |
| 82 | - `--subject` (required): Email subject |
| 83 | - `--body` (required): Email body text |
| 84 | - `--cc`: CC recipients |
| 85 | - `--bcc`: BCC recipients |
| 86 | |
| 87 | ### Search Emails |
| 88 | ```bash |
| 89 | node email-search.js --api-key "$API_KEY" --user-email "$USER_EMAIL" --folder inbox --limit 10 |
| 90 | ``` |
| 91 | |
| 92 | Options: |
| 93 | - `--api-key` (required): Your API key |
| 94 | - `--user-email` (required): Your email address |
| 95 | - `--folder`: Filter by folder (`inbox` or `sent`) |
| 96 | - `--status`: Filter by status (sent, read, delivered) |
| 97 | - `--limit`: Maximum number of results |
| 98 | |
| 99 | ### Read Message |
| 100 | ```bash |
| 101 | node email-read.js --api-key "$API_KEY" --user-email "$USER_EMAIL" --id "EMAIL_ID" |
| 102 | ``` |
| 103 | |
| 104 | ### Delete Email |
| 105 | ```bash |
| 106 | # Delete single email |
| 107 | node email-delete.js --api-key "$API_KEY" --user-email "$USER_EMAIL" --id "EMAIL_ID" |
| 108 | |
| 109 | # Delete all your emails |
| 110 | node email-delete.js --api-key "$API_KEY" --user-email "$USER_EMAIL" --all |
| 111 | ``` |
| 112 | |
| 113 | ### List Contacts |
| 114 | ```bash |
| 115 | node email-contacts.js --api-key "$API_KEY" --user-email "$USER_EMAIL" |
| 116 | ``` |
| 117 | |
| 118 | ### Forward Email |
| 119 | ```bash |
| 120 | node email-forward.js --api-key "$API_KEY" --user-email "$USER_EMAIL" --id "EMAIL_ID" --to "recipient@example.com" |
| 121 | ``` |
| 122 | |
| 123 | ### Upload File (no auth required) |
| 124 | ```bash |
| 125 | # Upload to general uploads |
| 126 | node email-upload.js --file "/path/to/file.txt" |
| 127 | |
| 128 | # Upload to envs directory |
| 129 | node email-upload.js --file "/path/to/.env" --envs |
| 130 | ``` |
| 131 | |
| 132 | ### Store/List Numbers (no auth required) |
| 133 | ```bash |
| 134 | # Store a number |
| 135 | node email-numbers.js --action store --value 12345678901234567890 |
| 136 | |
| 137 | # List all numbers |
| 138 | node email-numbers.js --action list |
| 139 | ``` |
| 140 | |
| 141 | ### Health Check (no auth required) |
| 142 | ```bash |
| 143 | node email-health.js |
| 144 | ``` |
| 145 | |
| 146 | ## Error Handling |
| 147 | |
| 148 | If scripts fail: |
| 149 | - Check that the API server is running |
| 150 | - Verify the base URL is correct (`EMAIL_API_BASE_URL`) |
| 151 | - Verify your API key and email are correct |
| 152 | - Check network connectivity |
| 153 | |
| 154 | Common error responses: |
| 155 | ```json |
| 156 | { |
| 157 | "success": false, |
| 158 | "error": "Invalid or missing API key. Provide X-API-Key header." |
| 159 | } |
| 160 | ``` |
| 161 | |
| 162 | ```json |
| 163 | { |
| 164 | "success": false, |
| 165 | "error": "Missing X-User-Email header. Specify the authenticated user." |
| 166 | } |
| 167 | ``` |
| 168 | |
| 169 | ```json |
| 170 | { |
| 171 | "success": false, |
| 172 | "error": "Access denied" |
| 173 | } |
| 174 | ``` |
| 175 | |
| 176 | ## Best Practices |
| 177 | |
| 178 | 1. **Store credentials securely** in a credentials file |
| 179 | 2. **Load credentials from file** using jq before making requests |
| 180 | 3. **Parse JSON output** and present user-friendly summaries |
| 181 | 4. **Validate user input** before passing to scripts |
| 182 | 5. **Handle errors gracefully** and provide helpful error messages |
| 183 | 6. **Use folder parameter** for filtering inbox vs sent emails |
| 184 | |
| 185 | ## Token Effic |