Skip to content

Commit aa99d2d

Browse files
committed
improved the docs for datafast and autosend
1 parent 3e2e754 commit aa99d2d

File tree

9 files changed

+378
-185
lines changed

9 files changed

+378
-185
lines changed

docs.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -504,18 +504,18 @@
504504
{
505505
"group": "Email",
506506
"pages": [
507-
"integrations/autosend",
508-
"integrations/datafast",
509507
"integrations/loops",
510508
"integrations/resend",
511-
"integrations/sendgrid"
509+
"integrations/sendgrid",
510+
"integrations/autosend"
512511
]
513512
},
514513
{
515514
"group": "Analytics",
516515
"pages": [
517516
"integrations/segment",
518-
"integrations/customer-io"
517+
"integrations/customer-io",
518+
"integrations/datafast"
519519
]
520520
}
521521
]

images/integrations/autosend.png

199 KB
Loading
184 KB
Loading
128 KB
Loading

integrations/autosend.mdx

Lines changed: 125 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -1,74 +1,90 @@
11
---
2-
title: "Autosend"
3-
description: "Send transactional emails through Autosend based on Dodo Payments events with high deliverability."
4-
icon: "envelope"
2+
title: "AutoSend"
3+
description: "Learn how to use AutoSend's email API to send automated transactional emails for your Dodo Payments transactions, refunds, and payment events."
4+
icon: "message"
55
---
66

77
## Introduction
88

9-
Send professional transactional emails automatically when payment events occur. Deliver payment confirmations, subscription updates, and important notifications with Autosend's reliable email infrastructure and excellent deliverability rates.
9+
The AutoSend and Dodo Payments integration enables you to automatically send real-time email notifications for all payment events, from successful transactions to failed attempts and refund confirmations.
10+
11+
Send transactional emails for payment events using AutoSend's powerful email API.
1012

1113
<Info>
12-
This integration requires your Autosend API Key for authentication.
14+
This integration requires your AutoSend API Key for authentication. You can find your API key in the AutoSend dashboard under Settings > API Keys.
1315
</Info>
1416

1517
## Getting Started
1618

19+
Follow these steps to integrate AutoSend with Dodo Payments:
20+
1721
<Steps>
18-
<Step title="Open the Webhook Section">
19-
In your Dodo Payments dashboard, navigate to <b>Webhooks → + Add Endpoint</b> and expand the integrations dropdown.
22+
<Step title="Open Webhook Section">
23+
Navigate to the Webhooks section in your Dodo Payments dashboard.
24+
2025
<Frame>
2126
<img src="/images/integrations/autosend.png" alt="Add Endpoint and integrations dropdown" />
2227
</Frame>
2328
</Step>
2429

25-
<Step title="Select Autosend">
26-
Choose the <b>Autosend</b> integration card.
30+
<Step title="Select AutoSend Integration">
31+
Choose AutoSend from the list of available integrations.
2732
</Step>
2833

2934
<Step title="Enter API Key">
30-
Provide your Autosend API Key in the configuration.
35+
Provide your AutoSend API key for authentication. You can find your API key in the AutoSend dashboard under Settings > API Keys.
36+
37+
<Card title="Learn how to create and manage API keys" icon="key" href="https://docs.autosend.com/api-keys">
38+
Visit the AutoSend documentation for detailed instructions on creating and managing API keys.
39+
</Card>
3140
</Step>
3241

3342
<Step title="Configure Transformation">
34-
Edit the transformation code to format emails for Autosend's API.
43+
Set up JavaScript transformation handlers to customize email content based on payment events.
3544
</Step>
3645

3746
<Step title="Test & Create">
38-
Test with sample payloads and click <b>Create</b> to activate the email sending.
47+
Test your webhook configuration to ensure emails are sent correctly, then create the integration.
3948
</Step>
4049

41-
<Step title="Done!">
42-
🎉 Payment events will now automatically trigger transactional emails via Autosend.
50+
<Step title="Activation Complete">
51+
🎉 Your AutoSend integration is now active and will automatically send emails for the configured payment events.
4352
</Step>
4453
</Steps>
4554

46-
## Transformation Code Examples
55+
## Code Examples
4756

4857
### Payment Confirmation Email
4958

59+
Send a confirmation email when a payment is successfully processed:
60+
5061
```javascript payment_confirmation.js icon="js" expandable
5162
function handler(webhook) {
5263
if (webhook.eventType === "payment.succeeded") {
5364
const p = webhook.payload.data;
54-
webhook.url = "https://api.autosend.com/emails";
65+
webhook.url = "https://api.autosend.com/v1/mails/send";
5566
webhook.payload = {
56-
from: "payments@yourdomain.com",
57-
to: [p.customer.email],
58-
subject: "Payment Confirmation - $" + (p.total_amount / 100).toFixed(2),
59-
html: `
60-
<h2>Payment Successful!</h2>
61-
<p>Hi ${p.customer.name},</p>
62-
<p>Your payment of $${(p.total_amount / 100).toFixed(2)} has been processed successfully.</p>
63-
<ul>
64-
<li><strong>Payment ID:</strong> ${p.payment_id}</li>
65-
<li><strong>Amount:</strong> $${(p.total_amount / 100).toFixed(2)}</li>
66-
<li><strong>Date:</strong> ${new Date(webhook.payload.timestamp).toLocaleDateString()}</li>
67-
<li><strong>Method:</strong> ${p.payment_method || "Unknown"}</li>
68-
</ul>
69-
<p>Thank you for your business!</p>
70-
`,
71-
text: `Payment Successful! Your payment of $${(p.total_amount / 100).toFixed(2)} has been processed. Payment ID: ${p.payment_id}`
67+
to: {
68+
email: p.customer.email,
69+
name: p.customer.name,
70+
},
71+
from: {
72+
email: "payments@mail.yourdomain.com",
73+
name: "Your Company",
74+
},
75+
subject: "Payment Successful - Thank you for your purchase!",
76+
templateId: "A-61522f2xxxxxxxxx",
77+
dynamicData: {
78+
customerName: p.customer.name,
79+
amount: p.amount,
80+
currency: p.currency,
81+
paymentId: p.payment_id,
82+
paymentDate: new Date(p.created_at).toLocaleDateString(),
83+
},
84+
replyTo: {
85+
email: "support@yourdomain.com",
86+
name: "Support Team",
87+
},
7288
};
7389
}
7490
return webhook;
@@ -77,28 +93,35 @@ function handler(webhook) {
7793

7894
### Subscription Welcome Email
7995

96+
Send a welcome email when a new subscription is created:
97+
8098
```javascript subscription_welcome.js icon="js" expandable
8199
function handler(webhook) {
82-
if (webhook.eventType === "subscription.active") {
100+
if (webhook.eventType === "subscription.created") {
83101
const s = webhook.payload.data;
84-
webhook.url = "https://api.autosend.com/emails";
102+
webhook.url = "https://api.autosend.com/v1/mails/send";
85103
webhook.payload = {
86-
from: "welcome@yourdomain.com",
87-
to: [s.customer.email],
88-
subject: "Welcome to Your Subscription!",
89-
html: `
90-
<h2>Welcome to Your Subscription!</h2>
91-
<p>Hi ${s.customer.name},</p>
92-
<p>Your subscription has been activated successfully.</p>
93-
<ul>
94-
<li><strong>Subscription ID:</strong> ${s.subscription_id}</li>
95-
<li><strong>Product:</strong> ${s.product_id}</li>
96-
<li><strong>Amount:</strong> $${(s.recurring_pre_tax_amount / 100).toFixed(2)}/${s.payment_frequency_interval}</li>
97-
<li><strong>Next Billing:</strong> ${new Date(s.next_billing_date).toLocaleDateString()}</li>
98-
</ul>
99-
<p>You can manage your subscription anytime from your account dashboard.</p>
100-
`,
101-
text: `Welcome! Your subscription is now active. Amount: $${(s.recurring_pre_tax_amount / 100).toFixed(2)}/${s.payment_frequency_interval}`
104+
to: {
105+
email: s.customer.email,
106+
name: s.customer.name,
107+
},
108+
from: {
109+
email: "subscriptions@mail.yourdomain.com",
110+
name: "Your Company",
111+
},
112+
subject: "Welcome to your subscription!",
113+
templateId: "A-61522f2xxxxxxxxx",
114+
dynamicData: {
115+
customerName: s.customer.name,
116+
planName: s.plan.name,
117+
billingInterval: s.billing_interval,
118+
nextBillingDate: new Date(s.next_billing_at).toLocaleDateString(),
119+
subscriptionId: s.subscription_id,
120+
},
121+
replyTo: {
122+
email: "support@yourdomain.com",
123+
name: "Support Team",
124+
},
102125
};
103126
}
104127
return webhook;
@@ -107,57 +130,80 @@ function handler(webhook) {
107130

108131
### Payment Failure Notification
109132

133+
Send a notification email when a payment fails:
134+
110135
```javascript payment_failure.js icon="js" expandable
111136
function handler(webhook) {
112137
if (webhook.eventType === "payment.failed") {
113138
const p = webhook.payload.data;
114-
webhook.url = "https://api.autosend.com/emails";
139+
webhook.url = "https://api.autosend.com/v1/mails/send";
115140
webhook.payload = {
116-
from: "support@yourdomain.com",
117-
to: [p.customer.email],
141+
to: {
142+
email: p.customer.email,
143+
name: p.customer.name,
144+
},
145+
from: {
146+
email: "billing@mail.yourdomain.com",
147+
name: "Your Company Billing",
148+
},
118149
subject: "Payment Failed - Action Required",
119-
html: `
120-
<h2>Payment Failed</h2>
121-
<p>Hi ${p.customer.name},</p>
122-
<p>We were unable to process your payment of $${(p.total_amount / 100).toFixed(2)}.</p>
123-
<ul>
124-
<li><strong>Payment ID:</strong> ${p.payment_id}</li>
125-
<li><strong>Amount:</strong> $${(p.total_amount / 100).toFixed(2)}</li>
126-
<li><strong>Error:</strong> ${p.error_message || "Payment processing failed"}</li>
127-
</ul>
128-
<p>Please update your payment method or contact support for assistance.</p>
129-
<a href="https://yourdomain.com/update-payment">Update Payment Method</a>
130-
`,
131-
text: `Payment Failed: We couldn't process your $${(p.total_amount / 100).toFixed(2)} payment. Please update your payment method.`
150+
templateId: "A-61522f2xxxxxxxxx",
151+
dynamicData: {
152+
customerName: p.customer.name,
153+
amount: p.amount,
154+
currency: p.currency,
155+
failureReason: p.failure_reason,
156+
paymentId: p.payment_id,
157+
retryUrl: `https://yourdomain.com/billing/retry/${p.payment_id}`,
158+
},
159+
replyTo: {
160+
email: "billing@yourdomain.com",
161+
name: "Billing Support",
162+
},
132163
};
133164
}
134165
return webhook;
135166
}
136167
```
137168

138-
## Tips
169+
## Best Practices
170+
171+
- **Verify your sender domain**: Ensure your sender email domain is verified in AutoSend to improve deliverability and avoid authentication issues. Verified domains help prevent emails from landing in spam folders.
139172

140-
- Use verified sender domains for better deliverability
141-
- Include both HTML and text versions of emails
142-
- Personalize content with customer data
143-
- Use clear, action-oriented subject lines
144-
- Include unsubscribe links for compliance
145-
- Test email templates before going live
173+
- **Use dynamic data for personalization**: Use the `dynamicData` field to personalize emails with customer-specific information like names, payment amounts, and subscription details. Personalized emails have higher engagement rates.
174+
175+
- **Write clear subject lines**: Write descriptive subject lines that clearly indicate the email's purpose. Avoid spam-trigger words and keep subjects concise (under 50 characters).
176+
177+
- **Test before production**: Always test your emails before sending them in production. This ensures your email content renders correctly and all dynamic data is properly mapped.
178+
179+
## API Reference
180+
181+
For complete details on the AutoSend API, including all available parameters and error codes, visit the [AutoSend API Documentation](https://docs.autosend.com/api-reference/mails/send).
146182

147183
## Troubleshooting
148184

149185
<AccordionGroup>
150186
<Accordion title="Emails not being sent">
151187
- Verify API Key is correct and active
152-
- Check that sender domain is verified in Autosend
188+
- Check that sender domain is verified in AutoSend
153189
- Ensure recipient email addresses are valid
154-
- Review Autosend sending limits and quotas
190+
- Review AutoSend sending limits and quotas
191+
- Verify the API endpoint URL is correct: `https://api.autosend.com/v1/mails/send`
192+
- Check that required parameters are present in the payload
155193
</Accordion>
156194

157195
<Accordion title="Transformation errors">
158-
- Validate JSON structure matches Autosend API format
159-
- Check that all required fields are present
160-
- Ensure HTML content is properly formatted
161-
- Verify from email address is verified
196+
- Validate JSON structure matches AutoSend API format
197+
- Check that all required fields are present (`to`, `from`, `templateId` or `html`/`text`)
198+
- Ensure email addresses are properly formatted
199+
- Verify `templateId` is valid if using templates
200+
- Check that `dynamicData` keys match your template variables
201+
</Accordion>
202+
203+
<Accordion title="Template issues">
204+
- Verify your template ID is correct and active in AutoSend
205+
- Ensure `dynamicData` keys match the variables used in your template
206+
- Check that all required template variables are provided
207+
- Test your template independently in the AutoSend dashboard
162208
</Accordion>
163209
</AccordionGroup>

0 commit comments

Comments
 (0)