How to Send Transactional Emails with Node.js
Prerequisites
You'll need Node.js 18+ installed and an AISend account (free tier works). Sign up at aisend.app and grab your API key from the dashboard.
Install the SDK
Install the AISend Node.js SDK: npm install aisend. The SDK provides a typed client for the AISend REST API with built-in error handling and retry logic.
Send your first email
Initialize the client with your API key and call emails.send(). You need four fields: from (your verified domain), to (recipient), subject, and html (or text). The SDK returns a response with the email ID, status, and the AI-selected provider.
Handle delivery events
Set up a webhook endpoint in your app to receive delivery events: sent, delivered, opened, clicked, bounced. Configure the webhook URL in your AISend dashboard. Events are signed with HMAC-SHA256 so you can verify authenticity.
Best practices
Use environment variables for your API key, never hard-code it. Send from a verified domain for best deliverability. Use the html field for rich emails and text as a fallback. Monitor your dashboard for deliverability insights and act on AI recommendations.
Ready to Send Smarter Emails?
1,000 emails/month free. No credit card required.