strapi-plugin-magic-mail 2.2.6 → 2.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -12,15 +12,17 @@
12
12
 
13
13
  **Stop fighting with .env files and email configuration!** MagicMail brings professional email management to Strapi v5 with:
14
14
 
15
- - **6 Email Providers** - Gmail, Microsoft 365, Yahoo, SMTP, SendGrid, Mailgun
16
- - **OAuth 2.0 Authentication** - No passwords needed for Gmail, Microsoft, Yahoo
17
- - **Smart Routing Rules** - Route emails by type, recipient, subject, or custom conditions
18
- - **Automatic Failover** - Never lose an email when rate limits hit
19
- - **Beautiful Admin UI** - Manage everything from Strapi Admin Panel
20
- - **Zero Configuration** - No .env files, everything in the database
21
- - **Email Designer Compatible** - Works seamlessly with strapi-plugin-email-designer-5
22
- - **GDPR/CAN-SPAM Compliant** - Built-in List-Unsubscribe headers
23
- - **Professional Security** - TLS 1.2+, DKIM, SPF, DMARC validation
15
+ - **6 Email Providers** - Gmail, Microsoft 365, Yahoo, SMTP, SendGrid, Mailgun
16
+ - **WhatsApp Messaging** - Send messages via WhatsApp (FREE!)
17
+ - **OAuth 2.0 Authentication** - No passwords needed for Gmail, Microsoft, Yahoo
18
+ - **Smart Routing Rules** - Route emails by type, recipient, subject, or custom conditions
19
+ - **WhatsApp Fallback** - Auto-send via WhatsApp if email fails
20
+ - **Automatic Failover** - Never lose an email when rate limits hit
21
+ - **Beautiful Admin UI** - Manage everything from Strapi Admin Panel
22
+ - **Zero Configuration** - No .env files, everything in the database
23
+ - **Email Designer Compatible** - Works seamlessly with strapi-plugin-email-designer-5
24
+ - **GDPR/CAN-SPAM Compliant** - Built-in List-Unsubscribe headers
25
+ - **Professional Security** - TLS 1.2+, DKIM, SPF, DMARC validation
24
26
 
25
27
  ---
26
28
 
@@ -72,7 +74,163 @@
72
74
 
73
75
  ---
74
76
 
75
- ## 🚀 Quick Start
77
+ ## WhatsApp Messaging (NEW!)
78
+
79
+ MagicMail now includes **FREE WhatsApp messaging** - send messages directly from your Strapi application!
80
+
81
+ ### Why WhatsApp?
82
+
83
+ | Feature | Email | WhatsApp |
84
+ |---------|-------|----------|
85
+ | **Open Rate** | ~20% | ~98% |
86
+ | **Delivery Speed** | Minutes | Instant |
87
+ | **Spam Folder Risk** | High | None |
88
+ | **User Preference** | Declining | Growing |
89
+ | **Cost** | Varies | FREE |
90
+
91
+ ### Quick Setup (4 Steps)
92
+
93
+ 1. **Navigate** to Admin Panel -> MagicMail -> WhatsApp
94
+ 2. **Connect** - Scan QR code with WhatsApp mobile app
95
+ 3. **Verify** - Check connection status shows "Connected"
96
+ 4. **Send** - Start sending messages programmatically!
97
+
98
+ ### Sending WhatsApp Messages
99
+
100
+ **Method 1: Direct WhatsApp Send**
101
+
102
+ ```javascript
103
+ // Send WhatsApp message directly
104
+ await strapi.plugin('magic-mail').service('whatsapp').sendMessage(
105
+ '+491234567890', // Phone number with country code
106
+ 'Hello! This is a test message from MagicMail.'
107
+ );
108
+ ```
109
+
110
+ **Method 2: Unified Messaging API**
111
+
112
+ ```javascript
113
+ // Send via unified API - auto-detects channel
114
+ await strapi.plugin('magic-mail').service('email-router').sendMessage({
115
+ channel: 'whatsapp', // or 'email' or 'auto'
116
+ phoneNumber: '+491234567890',
117
+ message: 'Your order #12345 has been shipped!'
118
+ });
119
+
120
+ // Auto-detect: sends WhatsApp if phoneNumber provided, email if to provided
121
+ await strapi.plugin('magic-mail').service('email-router').sendMessage({
122
+ channel: 'auto',
123
+ phoneNumber: '+491234567890', // Has phone -> WhatsApp
124
+ message: 'Shipping notification'
125
+ });
126
+
127
+ await strapi.plugin('magic-mail').service('email-router').sendMessage({
128
+ channel: 'auto',
129
+ to: 'user@example.com', // Has email -> Email
130
+ subject: 'Shipping Notification',
131
+ message: 'Your order has been shipped!'
132
+ });
133
+ ```
134
+
135
+ **Method 3: REST API**
136
+
137
+ ```javascript
138
+ // POST /api/magic-mail/send-whatsapp
139
+ await fetch('/api/magic-mail/send-whatsapp', {
140
+ method: 'POST',
141
+ headers: { 'Content-Type': 'application/json' },
142
+ body: JSON.stringify({
143
+ phoneNumber: '+491234567890',
144
+ message: 'Hello from MagicMail!'
145
+ })
146
+ });
147
+
148
+ // POST /api/magic-mail/send-message (unified)
149
+ await fetch('/api/magic-mail/send-message', {
150
+ method: 'POST',
151
+ headers: { 'Content-Type': 'application/json' },
152
+ body: JSON.stringify({
153
+ channel: 'whatsapp',
154
+ phoneNumber: '+491234567890',
155
+ message: 'Order confirmed!'
156
+ })
157
+ });
158
+ ```
159
+
160
+ ### WhatsApp Use Cases
161
+
162
+ **1. Email Fallback**
163
+ If email delivery fails, automatically send via WhatsApp:
164
+
165
+ ```javascript
166
+ // In Routing Rules, enable "WhatsApp Fallback"
167
+ // Set "WhatsApp Phone Field" to 'phoneNumber'
168
+
169
+ await strapi.plugin('magic-mail').service('email-router').send({
170
+ to: 'user@example.com',
171
+ phoneNumber: '+491234567890', // Fallback phone
172
+ subject: 'Important Update',
173
+ html: '<h1>Update</h1>',
174
+ type: 'transactional'
175
+ });
176
+
177
+ // If email fails -> auto-sends via WhatsApp!
178
+ ```
179
+
180
+ **2. Admin Notifications**
181
+ Get instant WhatsApp alerts for critical events:
182
+
183
+ ```javascript
184
+ // Example: Notify admin when email quota exceeded
185
+ const adminPhone = '+4917612345678';
186
+
187
+ await strapi.plugin('magic-mail').service('whatsapp').sendMessage(
188
+ adminPhone,
189
+ '[ALERT] Email quota exceeded for SendGrid account!'
190
+ );
191
+ ```
192
+
193
+ **3. Urgent Transactional Messages**
194
+ Send time-sensitive messages instantly:
195
+
196
+ ```javascript
197
+ // OTP/Verification codes
198
+ await strapi.plugin('magic-mail').service('whatsapp').sendMessage(
199
+ userPhone,
200
+ `Your verification code: 123456\n\nValid for 5 minutes.`
201
+ );
202
+
203
+ // Order updates
204
+ await strapi.plugin('magic-mail').service('whatsapp').sendMessage(
205
+ customerPhone,
206
+ `Order #${orderId} is out for delivery!\nTrack: ${trackingUrl}`
207
+ );
208
+ ```
209
+
210
+ ### WhatsApp Status API
211
+
212
+ ```javascript
213
+ // Check connection status
214
+ const status = await strapi.plugin('magic-mail').service('whatsapp').getStatus();
215
+ // { isConnected: true, phoneNumber: '+49...', name: 'Business Account' }
216
+
217
+ // Check if phone number is on WhatsApp
218
+ const exists = await strapi.plugin('magic-mail').service('whatsapp').checkNumber('+491234567890');
219
+ // { exists: true, jid: '491234567890@s.whatsapp.net' }
220
+ ```
221
+
222
+ ### Integration with Magic-Link Plugin
223
+
224
+ When both **MagicMail** and **Magic-Link** are installed:
225
+
226
+ - Magic-Link automatically uses MagicMail's WhatsApp service
227
+ - Only ONE WhatsApp connection needed (managed here in MagicMail)
228
+ - Send magic links via WhatsApp from Magic-Link settings
229
+ - Unified WhatsApp management for all plugins
230
+
231
+ ---
232
+
233
+ ## Quick Start
76
234
 
77
235
  ### Installation
78
236