Getting Started with Transactional Emails: A Developer Guide
Transactional emails are critical for your application. They include order confirmations, password resets, welcome emails, and notifications. Here's how to get started with OnePush:
What Are Transactional Emails?
Transactional emails are automated messages triggered by user actions in your application. Unlike marketing emails, these are essential communications that users expect to receive.
Setting Up Your Account
1. Create an API Key
After signing up, navigate to your dashboard and generate an API key. Keep this key secure—it's your authentication token for all API requests.
2. Verify Your Domain
Add your sending domain and configure SPF, DKIM, and DMARC records. This ensures your emails are authenticated and improves deliverability.
3. Install the SDK
OnePush provides SDKs for popular languages:
- Node.js: npm install @onepush/sdk
- Python: pip install onepush
- PHP: composer require onepush/onepush
Sending Your First Email
Here's a simple example using our REST API:
const response = await fetch('https://api.onepush.app/v1/emails', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
to: 'user@example.com',
from: 'noreply@yourdomain.com',
subject: 'Welcome to OnePush',
html: '<h1>Welcome!</h1><p>Thanks for signing up.</p>',
}),
});Best Practices
- Always include both HTML and plain text versions
- Use templates for consistency
- Set up webhooks to track email events
- Monitor your email logs regularly
- Test emails before going to production
With OnePush, sending transactional emails is simple, reliable, and scalable.
