Trigger a transactional email from any WhatsApp conversation: an order confirmation, a receipt, a password reset, or a copy of an enquiry to your team. The trick is using an email API instead of raw SMTP, and this guide shows you exactly how.
Before following this guide, read the External API Request step foundation guide. It covers every field in the step interface so this guide can focus on email-specific values.
WA.Expert's External API Request step speaks HTTP, not the SMTP protocol. Raw SMTP needs a persistent socket on a port like 587 or 465, which an HTTP request cannot open. The solution: use a transactional email API (MailerSend, SendGrid, or Mailgun). These accept a simple HTTP POST and send the email for you. This guide uses MailerSend as the primary example (free tier: 500 emails/month), with SendGrid and Mailgun in the reference section.
Authorization: Bearer YOUR_TOKEN.You can only send from a domain you have verified. Sending from noreply@yourcompany.com works once yourcompany.com is verified. Trying to send from a generic address like yourname@gmail.com will fail with a 422 error, because providers block unverified domains to prevent spoofing.
MailerSend Email API: developers.mailersend.com
In your WhatsApp automation, after the trigger that should send the email (an order placed, a form completed, a keyword), add an External API Request step:
Body:
{{
"from": {{
"email": "noreply@yourcompany.com",
"name": "Your Company"
}},
"to": [
{{"email": "{{customer_email}}", "name": "{{customer_name}}"}}
],
"subject": "Thanks for your order, {{customer_name}}!",
"text": "Hi {{customer_name}}, we have received your order.",
"html": "Hi {{customer_name}}, we have received your order.
"
}}
Response: HTTP 202 Accepted (empty body)
Header: X-Message-Id: 5e42957d51f1d94a1070a733
202 means the email was accepted for delivery.
Provide at least one of text or html (both is best).| Field | Value | Notes |
|---|---|---|
| Select Method | POST | Sending an email is always a POST. |
| Request URL | https://api.mailersend.com/v1/email | The MailerSend send endpoint. |
| Authorization | Bearer YOUR_TOKEN | Your API token from Step 1, after 'Bearer '. |
| Content-Type | application/json | Required for the JSON body. |
| from.email | noreply@yourcompany.com | Must be on a verified domain. |
| to[].email | {{customer_email}} | WhatsApp variable for the recipient. |
| subject | Your subject with {{variables}} | Personalise with WhatsApp variables. |
| text / html | Email body | Provide text, html, or both. Both is recommended. |
MailerSend returns HTTP 202 Accepted, not 200, when an email is queued for delivery. The response body is empty; the X-Message-Id response header confirms the send. Branch your flow on the 202 status.
Trigger: Customer completes checkout in a WhatsApp commerce flow.
Captured: {{customer_email}} = priya@example.com
{{customer_name}} = Priya Sharma
{{order_id}} = ORD-4821
{{order_total}} = Rs. 2,499
External API Request step:
POST https://api.mailersend.com/v1/email
Authorization: Bearer YOUR_TOKEN
Content-Type: application/json
Body:
{{
"from": {{"email": "orders@yourcompany.com", "name": "Your Store"}},
"to": [{{"email": "priya@example.com", "name": "Priya Sharma"}}],
"bcc": [{{"email": "sales@yourcompany.com"}}],
"subject": "Order ORD-4821 confirmed — Rs. 2,499",
"html": "Hi Priya, your order ORD-4821 is confirmed.
"
}}
Response: HTTP 202, X-Message-Id returned
Result:
- Priya gets an order confirmation email instantly
- Your sales team gets a silent bcc copy
- The WhatsApp bot continues with delivery detailsUse the bcc array to send a silent copy to your team. The customer sees only their own address in the to field; your team gets notified without the customer seeing the internal address.
Prefer a different provider? The pattern is identical, only the endpoint, auth, and body shape change. Here are the two most common alternatives.
POST https://api.sendgrid.com/v3/mail/send
Authorization: Bearer YOUR_SENDGRID_API_KEY
Content-Type: application/json
Body:
{{
"personalizations": [
{{"to": [{{"email": "{{customer_email}}"}}]}}
],
"from": {{"email": "noreply@yourcompany.com"}},
"subject": "Thanks for your order!",
"content": [
{{"type": "text/plain", "value": "Hi {{customer_name}}, ..."}}
]
}}
Response: HTTP 202 Accepted
Note: SendGrid wraps recipients in a personalizations array.POST https://api.mailgun.net/v3/yourcompany.com/messages
Authorization: Basic BASE64('api:YOUR_MAILGUN_API_KEY')
Content-Type: application/x-www-form-urlencoded
Body (form-encoded, not JSON):
from=noreply@yourcompany.com
to={{customer_email}}
subject=Thanks for your order!
text=Hi {{customer_name}}, we have received your order.
Response: HTTP 200 with a JSON body containing a message id
Note: Mailgun uses Basic Auth (username 'api') and form-encoded
body, not JSON. The domain is in the URL path.| Provider | Auth | Body format | Success code |
|---|---|---|---|
| MailerSend | Bearer token | JSON | 202 Accepted |
| SendGrid | Bearer token | JSON (personalizations array) | 202 Accepted |
| Mailgun | Basic Auth (api:key) | form-encoded | 200 OK |
All three work from the External API Request step. MailerSend has the simplest JSON body and a generous free tier, which is why this guide uses it as the default.
| Symptom | Likely cause | Fix |
|---|---|---|
| 422 on from address | Sending domain not verified | Verify your domain in the provider dashboard (add SPF and DKIM DNS records). Use a from address on that verified domain. |
| 401 Unauthorized | Wrong or missing API token | Check the Authorization header is 'Bearer YOUR_TOKEN'. Regenerate the token if needed. |
| 422 about recipients | Malformed to array | The to field must be an array of objects: [{email: '...'}]. Ensure the customer email variable resolved to a real address. |
| Email sent but not received | Landed in spam or suppressed | Check the provider's activity log. Ensure SPF/DKIM are set. A previously bounced or unsubscribed address may be suppressed. |
| Trying to connect via SMTP port | Using raw SMTP instead of the API | The External API Request step cannot open SMTP ports. Use the provider's HTTP email API endpoint as shown above. |
| 202 but want confirmation | 202 is the success code | 202 Accepted means the email was queued. Use the X-Message-Id header to track it in the provider's activity log. |
Mailchimp: add WhatsApp opt-ins to your email marketing lists.
Read guide →Free trial, no credit card. If you get stuck, we answer live on WhatsApp.