Email & Messaging Modules
Email & Messaging Modules
Send Mail (SMTP)
Sends an email via SMTP. Configure the SMTP server in component settings or via environment variables.
appId: send-mail
{ "appId": "send-mail", "ref": "sendInvoice", "args": { "to": ["client@example.com", "billing@example.com"], "cc": ["manager@yourcompany.com"], "bcc": [], "subject": "Invoice #{{ $prev.createInvoice.number }} — {{ $prev.getClient.name }}", "bodyHtml": "<h1>Invoice Ready</h1><p>Please find your invoice attached.</p>", "bodyText": "Invoice Ready\n\nPlease find your invoice attached.", "attachments": [ { "filename": "invoice-{{ $prev.createInvoice.number }}.pdf", "path": "{{ $prev.generatePdf.path }}", "mimeType": "application/pdf" } ], "from": "billing@yourcompany.com", "replyTo": "support@yourcompany.com" }}Output: { "messageId": "<abc123@mail.example.com>", "accepted": ["client@example.com"], "rejected": [] }
IMAP — Fetch Emails
Connects to an IMAP server and retrieves messages matching specified criteria.
appId: imap
{ "appId": "imap", "ref": "fetchEmails", "args": { "host": "imap.example.com", "port": 993, "tls": true, "user": "inbox@yourcompany.com", "password": "{{ $kv.get 'imapPassword' }}", "folder": "INBOX", "filter": { "unseen": true, "subject": "Invoice", "since": "{{ $prev.lastRun.date }}" }, "limit": 20, "markSeen": true, "extractAttachments": true }}Output:
{ "messages": [ { "uid": 1042, "from": "vendor@example.com", "subject": "Invoice INV-2024-001", "bodyText": "Please find attached...", "bodyHtml": "<p>Please find attached...</p>", "date": "2024-01-15T09:30:00Z", "attachments": [ { "filename": "invoice.pdf", "mimeType": "application/pdf", "content": "<base64>", "path": "tmp/inbox/invoice.pdf" } ] } ], "count": 1}POP3 — Fetch Emails
{ "appId": "pop3", "ref": "fetchPop3", "args": { "host": "pop.example.com", "port": 995, "tls": true, "user": "inbox@yourcompany.com", "password": "{{ $kv.get 'pop3Password' }}", "limit": 10, "deleteAfterFetch": false }}Slack — Send Message
Sends a message or file to a Slack channel or user.
appId: slack
{ "appId": "slack", "ref": "notifyTeam", "args": { "channel": "#ops-alerts", "message": "✅ Report generated: {{ $prev.generateReport.summary }}", "blocks": [ { "type": "section", "text": { "type": "mrkdwn", "text": "*Daily Report Ready*\n{{ $prev.generateReport.summary }}" } }, { "type": "actions", "elements": [ { "type": "button", "text": {"type": "plain_text", "text": "View Report"}, "url": "{{ $prev.uploadReport.url }}" } ] } ], "token": "{{ $kv.get 'slackBotToken' }}" }}Output: { "ts": "1705312800.123456", "channelId": "C01234ABCD", "ok": true }