Use the official isend.ai Node.js SDK to send emails using your existing email infrastructure.
npm install @isend-ai/nodejs-sdk
const { ISendClient } = require('@isend-ai/nodejs-sdk'); // Initialize the client const client = new ISendClient('your-api-key-here'); // Send email using template const emailData = { template_id: 124, to: 'hi@isend.ai', dataMapping: { name: 'ISend' } }; client.sendEmail(emailData) .then(response => { console.log('Email sent successfully!', response); }) .catch(error => { console.error('Error sending email:', error.message); });
import { ISendClient } from '@isend-ai/nodejs-sdk'; const client = new ISendClient('your-api-key-here'); async function sendEmail() { try { const emailData = { template_id: 124, to: 'hi@isend.ai', dataMapping: { name: 'ISend' } }; const response = await client.sendEmail(emailData); console.log('Email sent successfully!', response); } catch (error) { console.error('Error sending email:', error.message); } } sendEmail();
try { const response = await client.sendEmail({ template_id: 124, to: 'hi@isend.ai', dataMapping: { name: 'ISend' } }); } catch (error) { console.error('Error:', error.message); console.error('Status:', error.status); console.error('Code:', error.code); }