|
| 1 | +# @elizaos/plugin-email-automation |
| 2 | + |
| 3 | +AI-powered email automation plugin for Eliza that intelligently detects email-worthy conversations and handles generation/delivery. This is not perfect and is simply a solid starting point, and I would encourage any and all contributions! |
| 4 | + |
| 5 | +## Features |
| 6 | + |
| 7 | +### 1. Intelligent Detection |
| 8 | +- Partnership opportunity detection |
| 9 | +- Technical discussion recognition |
| 10 | +- Business proposal identification |
| 11 | +- Follow-up requirement analysis |
| 12 | + |
| 13 | +### 2. AI-Powered Generation |
| 14 | +- Structured email formatting |
| 15 | +- Context-aware content |
| 16 | +- Professional tone maintenance |
| 17 | +- Technical detail inclusion |
| 18 | + |
| 19 | +## Configuration |
| 20 | + |
| 21 | +### AI Email Automation Setup |
| 22 | +```typescript |
| 23 | +# Required |
| 24 | +RESEND_API_KEY= # Your Resend API key |
| 25 | +DEFAULT_TO_EMAIL= # Default recipient |
| 26 | +DEFAULT_FROM_EMAIL= # Default sender |
| 27 | + |
| 28 | +# Optional Settings |
| 29 | +EMAIL_AUTOMATION_ENABLED=true # Enable AI detection. If this is enabled, the plugin will automatically detect email-worthy conversations and handle generation/delivery and only that. |
| 30 | +EMAIL_EVALUATION_PROMPT= # Custom detection criteria for shouldEmail |
| 31 | +``` |
| 32 | + |
| 33 | +### Basic Usage |
| 34 | +```typescript |
| 35 | +import { emailPlugin } from '@elizaos/plugin-email-automation'; |
| 36 | + |
| 37 | +// Add to your Eliza configuration |
| 38 | +{ |
| 39 | + plugins: [emailPlugin], |
| 40 | + settings: { |
| 41 | + EMAIL_AUTOMATION_ENABLED: true, |
| 42 | + // ... other settings |
| 43 | + } |
| 44 | +} |
| 45 | +``` |
| 46 | + |
| 47 | +### Email Template Example |
| 48 | +The plugin uses Handlebars for templating. Here's an example output: |
| 49 | + |
| 50 | +```handlebars |
| 51 | +{{!-- email-template.hbs --}} |
| 52 | +<div class="email-container"> |
| 53 | + <h1>{{subject}}</h1> |
| 54 | +
|
| 55 | + <div class="background-section"> |
| 56 | + {{background}} |
| 57 | + </div> |
| 58 | +
|
| 59 | + <div class="key-points-section"> |
| 60 | + <h2>Key Points</h2> |
| 61 | + <ul> |
| 62 | + {{#each keyPoints}} |
| 63 | + <li>{{this}}</li> |
| 64 | + {{/each}} |
| 65 | + </ul> |
| 66 | + </div> |
| 67 | +
|
| 68 | + {{#if technicalDetails}} |
| 69 | + <div class="technical-section"> |
| 70 | + <h2>Technical Details</h2> |
| 71 | + <ul> |
| 72 | + {{#each technicalDetails}} |
| 73 | + <li>{{this}}</li> |
| 74 | + {{/each}} |
| 75 | + </ul> |
| 76 | + </div> |
| 77 | + {{/if}} |
| 78 | +
|
| 79 | + <div class="next-steps-section"> |
| 80 | + <h2>Next Steps</h2> |
| 81 | + <ul> |
| 82 | + {{#each nextSteps}} |
| 83 | + <li>{{this}}</li> |
| 84 | + {{/each}} |
| 85 | + </ul> |
| 86 | + </div> |
| 87 | +
|
| 88 | + <div class="footer"> |
| 89 | + Powered by ElizaOS |
| 90 | + </div> |
| 91 | +</div> |
| 92 | +
|
| 93 | +<style> |
| 94 | + .email-container { |
| 95 | + max-width: 600px; |
| 96 | + margin: 0 auto; |
| 97 | + font-family: Arial, sans-serif; |
| 98 | + line-height: 1.6; |
| 99 | + } |
| 100 | + h1, h2 { color: #333; } |
| 101 | + ul { padding-left: 20px; } |
| 102 | + .footer { |
| 103 | + margin-top: 30px; |
| 104 | + color: #666; |
| 105 | + font-size: 0.9em; |
| 106 | + } |
| 107 | +</style> |
| 108 | +``` |
| 109 | + |
| 110 | +This template produces professional emails like the example shown in the image above. You can customize the template by: |
| 111 | +1. Creating your own `.hbs` file |
| 112 | +2. Registering it with the template manager |
| 113 | +3. Specifying your template when sending emails |
| 114 | + |
| 115 | +## Development |
| 116 | + |
| 117 | +```bash |
| 118 | +# Installation |
| 119 | +pnpm install |
| 120 | + |
| 121 | +# Testing |
| 122 | +pnpm test |
| 123 | +pnpm test:watch |
| 124 | +pnpm test:coverage |
| 125 | + |
| 126 | +# Building |
| 127 | +pnpm build |
| 128 | +``` |
| 129 | + |
| 130 | +## Testing Coverage |
| 131 | +- Unit tests for all services |
| 132 | +- Integration tests for end-to-end flows |
| 133 | +- Throttling and rate limiting tests |
| 134 | +- Error handling scenarios |
| 135 | +- Mock providers for testing |
| 136 | + |
| 137 | +## Architecture |
| 138 | +```mermaid |
| 139 | +graph TD |
| 140 | + A[Email Trigger] --> B[Automation Service] |
| 141 | + B --> C{AI Evaluation} |
| 142 | + C -->|Yes| D[Generation Service] |
| 143 | + D --> E[Email Service] |
| 144 | + E --> F[Resend Provider] |
| 145 | + F --> G[Delivery] |
| 146 | +``` |
| 147 | + |
| 148 | +Architecture Overview: |
| 149 | +- Resend Provider support (more to come) |
| 150 | +- AI-powered email detection |
| 151 | +- Context-aware content generation |
| 152 | +- Professional template rendering |
| 153 | + |
| 154 | +## Credits |
| 155 | + |
| 156 | +This plugin integrates with and builds upon: |
| 157 | + |
| 158 | +- [Resend](https://resend.com): Modern email API for developers |
| 159 | +- [Handlebars](https://handlebarsjs.com): Templating engine for email formatting |
| 160 | + |
| 161 | +For more information about Resend capabilities: |
| 162 | +- [Resend Documentation](https://resend.com/docs) |
| 163 | +- [Email API Reference](https://resend.com/docs/api-reference/introduction) |
| 164 | +- [Developer Portal](https://resend.com/overview) |
| 165 | + |
| 166 | +## License |
| 167 | +This plugin is part of the Eliza project. See the main project repository for license information. |
0 commit comments