Package Exports
- @sharpapi/sharpapi-node-thank-you-email
- @sharpapi/sharpapi-node-thank-you-email/src/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@sharpapi/sharpapi-node-thank-you-email) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme

Thank You Email Generator API for Node.js
💌 Generate personalized thank you emails — powered by SharpAPI AI.
SharpAPI Thank You Email Generator creates personalized, professional thank you emails for e-commerce transactions. Perfect for order confirmations, customer appreciation, and post-purchase communication.
📋 Table of Contents
Requirements
- Node.js >= 16.x
- npm or yarn
Installation
Step 1. Install the package via npm:
npm install @sharpapi/sharpapi-node-thank-you-emailStep 2. Get your API key
Visit SharpAPI.com to get your API key.
Usage
const { SharpApiThankYouEmailService } = require('@sharpapi/sharpapi-node-thank-you-email');
const apiKey = process.env.SHARP_API_KEY; // Store your API key in environment variables
const service = new SharpApiThankYouEmailService(apiKey);
const orderData = {
customerName: 'John Doe',
productName: 'Wireless Headphones',
orderNumber: 'ORD-12345'
};
async function generateThankYou() {
try {
// Submit email generation job
const statusUrl = await service.generateThankYouEmail(
orderData.customerName,
orderData.productName,
orderData.orderNumber
);
console.log('Job submitted. Status URL:', statusUrl);
// Fetch results (polls automatically until complete)
const result = await service.fetchResults(statusUrl);
console.log('Generated email:', result.getResultJson());
} catch (error) {
console.error('Error:', error.message);
}
}
generateThankYou();API Documentation
Methods
generateThankYouEmail(customerName: string, productName: string, orderNumber?: string, voiceTone?: string): Promise<string>
Generates a personalized thank you email.
Parameters:
customerName(string, required): Customer's nameproductName(string, required): Product or service purchasedorderNumber(string, optional): Order reference numbervoiceTone(string, optional): Tone of the email ('Professional', 'Friendly', 'Enthusiastic')
Returns:
- Promise
: Status URL for polling the job result
Example:
const statusUrl = await service.generateThankYouEmail(
'Sarah Johnson',
'Premium Yoga Mat',
'ORD-67890',
'Friendly'
);
const result = await service.fetchResults(statusUrl);Response Format
The API returns a professionally crafted thank you email:
{
"email": "Thank you, John! We hope you enjoy your new Wireless Headphones. They're designed to deliver exceptional sound quality and comfort for all-day listening. If you have any questions or need support, we're here to help. Thanks for choosing us!",
"subject": "Thank You for Your Order #ORD-12345",
"tone": "Friendly"
}Examples
Basic Thank You Email
const { SharpApiThankYouEmailService } = require('@sharpapi/sharpapi-node-thank-you-email');
const service = new SharpApiThankYouEmailService(process.env.SHARP_API_KEY);
service.generateThankYouEmail(
'Emma Wilson',
'Organic Coffee Beans',
'ORD-11223'
)
.then(statusUrl => service.fetchResults(statusUrl))
.then(result => {
const email = result.getResultJson();
console.log('📧 Subject:', email.subject);
console.log('📝 Body:', email.email);
})
.catch(error => console.error('Generation failed:', error));Tone-Specific Email
const service = new SharpApiThankYouEmailService(process.env.SHARP_API_KEY);
const statusUrl = await service.generateThankYouEmail(
'Michael Chen',
'Professional Camera Lens',
'ORD-55789',
'Professional'
);
const result = await service.fetchResults(statusUrl);
const email = result.getResultJson();
console.log('Professional thank you email:');
console.log(email.email);Automated Post-Purchase Workflow
const service = new SharpApiThankYouEmailService(process.env.SHARP_API_KEY);
async function sendThankYouEmail(order) {
// Generate personalized email
const statusUrl = await service.generateThankYouEmail(
order.customerName,
order.productName,
order.orderNumber,
'Enthusiastic'
);
const result = await service.fetchResults(statusUrl);
const emailContent = result.getResultJson();
// In real implementation, integrate with email service
return {
to: order.customerEmail,
subject: emailContent.subject,
body: emailContent.email,
orderRef: order.orderNumber
};
}
const completedOrder = {
orderNumber: 'ORD-99888',
customerName: 'Lisa Brown',
customerEmail: 'lisa@example.com',
productName: 'Smart Fitness Watch'
};
const emailToSend = await sendThankYouEmail(completedOrder);
console.log('Email ready to send:', emailToSend);Batch Email Generation
const service = new SharpApiThankYouEmailService(process.env.SHARP_API_KEY);
const orders = [
{ customerName: 'Alice Green', product: 'Yoga Mat', orderId: 'ORD-001' },
{ customerName: 'Bob Smith', product: 'Water Bottle', orderId: 'ORD-002' },
{ customerName: 'Carol White', product: 'Running Shoes', orderId: 'ORD-003' }
];
const thankYouEmails = await Promise.all(
orders.map(async (order) => {
const statusUrl = await service.generateThankYouEmail(
order.customerName,
order.product,
order.orderId,
'Friendly'
);
const result = await service.fetchResults(statusUrl);
return {
orderId: order.orderId,
email: result.getResultJson()
};
})
);
console.log(`Generated ${thankYouEmails.length} thank you emails`);Use Cases
- Order Confirmations: Send personalized thank you after purchase
- Service Subscriptions: Thank customers for signing up
- Event Registrations: Acknowledge event sign-ups
- Donation Receipts: Thank donors for contributions
- Trial Sign-ups: Welcome new trial users
- Membership Renewals: Thank customers for renewing
- Customer Appreciation: Build relationships with personalized messages
Voice Tones
Choose the appropriate tone for your brand:
- Professional: Formal, business-appropriate language
- Friendly: Warm, casual, conversational
- Enthusiastic: Energetic, exciting, motivational
- Grateful: Emphasizes appreciation and gratitude
- Luxury: Sophisticated, premium, exclusive
Personalization Features
Each email includes:
- Customer's name: Personal address
- Product reference: Specific item purchased
- Order number: Transaction reference
- Brand voice: Consistent with your tone choice
- Call-to-action: Subtle engagement prompt
- Support offer: Invitation to reach out
API Endpoint
POST /ecommerce/thank_you_email
For detailed API specifications, refer to:
Related Packages
- @sharpapi/sharpapi-node-product-intro - Product introductions
- @sharpapi/sharpapi-node-product-review-sentiment - Review sentiment
- @sharpapi/sharpapi-node-paraphrase - Text paraphrasing
- @sharpapi/sharpapi-node-client - Full SharpAPI SDK
License
This project is licensed under the MIT License. See the LICENSE.md file for details.
Support
- Documentation: SharpAPI.com Documentation
- Issues: GitHub Issues
- Email: contact@sharpapi.com
Powered by SharpAPI - AI-Powered API Workflow Automation