Transactional Email Setup
Set up and send transactional emails like password resets and order confirmations via the Owlat API.
Transactional Email Setup
Transactional emails are triggered by a user action -- a password reset, an order confirmation, a welcome message after signup. Unlike marketing campaigns, they're sent to a single recipient at a specific moment, and recipients expect them immediately.
Common examples:
- Password reset links
- Welcome emails after registration
- Order confirmations and receipts
- Shipping notifications
- Account verification emails
Create a Transactional Template
Start by building the template your transactional emails will use.
- Go to Templates in your Owlat dashboard
- Click New Template and give it a clear name (e.g., "Order Confirmation")
- Design your email in the visual editor
- Add data variables wherever you need dynamic content using
{{variableName}}syntax -- for example,{{customerName}},{{orderNumber}}, or{{total}} - Save the template and note its slug (e.g.,
order-confirmation). You'll use this slug when sending via the API.
Use descriptive variable names like {{orderNumber}} instead of generic ones like {{var1}}. It makes your API calls self-documenting and easier to debug.
Generate an API Key
You need an API key to authenticate transactional sends.
- Go to Settings > API Keys in your dashboard
- Click Create API Key
- Give it a name (e.g., "Production Transactional")
- Select transactional send permissions
- Copy the generated key -- it starts with
lm_live_
Your API key is shown only once. Store it in a secure location like an environment variable or a secrets manager. Never commit API keys to version control or expose them in client-side code.
Send via the TypeScript SDK
Install the Owlat SDK and send your first transactional email:
import { Owlat } from '@owlat/sdk-js'
const owlat = new Owlat('lm_live_...')
await owlat.transactional.send({
email: 'user@example.com',
slug: 'order-confirmation',
dataVariables: {
orderNumber: '#12345',
customerName: 'Jane',
total: '$49.99'
}
})
The SDK handles authentication, serialization, and error handling for you. Pass any data variables your template expects in the dataVariables object.
Send via the Java SDK
Owlat owlat = new Owlat("lm_live_...");
owlat.transactional().send(
SendParams.builder("user@example.com", "order-confirmation")
.dataVariable("orderNumber", "#12345")
.dataVariable("customerName", "Jane")
.dataVariable("total", "$49.99")
.build()
);
Send via cURL
If you prefer to call the API directly:
curl -X POST https://your-deployment.convex.site/api/v1/transactional \
-H "Authorization: Bearer lm_live_..." \
-H "Content-Type: application/json" \
-d '{
"slug": "order-confirmation",
"email": "user@example.com",
"dataVariables": {
"orderNumber": "#12345",
"customerName": "Jane",
"total": "$49.99"
}
}'
A successful request returns a 200 status with a message ID you can use to track delivery.
Testing Transactional Emails
You don't need to write code to test your transactional templates:
- Open your template in the Owlat dashboard
- Click Send Test
- Fill in sample values for your data variables
- Enter your email address and send
This lets you verify formatting, variable substitution, and rendering before wiring up your application.
Send test emails to multiple email clients (Gmail, Outlook, Apple Mail) to catch rendering differences before going live.
Error Handling
When a transactional send fails, the API returns an error with a descriptive status code:
| Status Code | Meaning |
|---|---|
400 | Bad request -- check your payload for missing or invalid fields |
401 | Unauthorized -- your API key is invalid or missing |
404 | Template not found -- verify the slug matches an existing template |
422 | Validation error -- a required data variable is missing |
429 | Rate limited -- you're sending too many requests; back off and retry |
500 | Server error -- retry after a short delay |
For 429 and 500 errors, implement exponential backoff in your retry logic. Transactional emails are important to your users, so build resilience into your sending code.
Don't silently swallow send errors. Log failures and set up alerts so your team knows when transactional emails aren't being delivered. A failed password reset email means a locked-out user.
Next Steps
- API Reference -- full endpoint documentation
- TypeScript SDK -- complete SDK reference
- Java SDK -- Java SDK reference
- Webhooks -- get notified about delivery events in real time