Smart Automated Follow-Up Email System

Smart Automated Follow-Up Email System

Generate a personalized email sequence to engage customers post-purchase.

Customer & Purchase Info

Enter customer details to generate the follow-up sequence.

Generating sequence...

'; placeholder.classList.remove('hidden'); resultsContainer.classList.add('hidden'); setTimeout(() => { currentSequence = generateSequence(name, product); renderSequence(currentSequence); placeholder.classList.add('hidden'); resultsContainer.classList.remove('hidden'); }, 1500); }; const generateSequence = (name, product) => { return [ { delay: 'Immediately', title: 'Order Confirmation', subject: `Your order for the ${product} is confirmed!`, body: `Hi ${name},\n\nThank you for your purchase! We've received your order for the ${product} and are getting it ready for shipment. We'll notify you as soon as it's on its way.\n\nWe appreciate your business!\n\nBest,\nThe Team` }, { delay: '3 Days Post-Purchase', title: 'Tips & Tricks', subject: `Getting the most out of your new ${product}`, body: `Hi ${name},\n\nWe hope you're enjoying your new ${product}!\n\nHere are a few tips to help you get started:\n- Tip 1: [Insert relevant tip]\n- Tip 2: [Insert relevant tip]\n- Tip 3: [Insert relevant tip]\n\nIf you have any questions, feel free to reply to this email. We're happy to help!\n\nBest,\nThe Team` }, { delay: '7 Days Post-Purchase', title: 'Review Request', subject: `How are you finding the ${product}?`, body: `Hi ${name},\n\nIt's been a week since you received your ${product}, and we'd love to hear what you think! Your feedback helps us improve and assists other customers in making informed decisions.\n\nWould you mind leaving a review on our website? [Link to product page]\n\nThank you for your time!\n\nBest,\nThe Team` }, { delay: '14 Days Post-Purchase', title: 'Related Product Offer', subject: `A special offer just for you, ${name}`, body: `Hi ${name},\n\nAs a thank you for your recent purchase, we'd like to offer you an exclusive 15% discount on your next order!\n\nWe noticed you love the ${product}, and we think you might also like [Related Product].\n\nUse code THANKS15 at checkout to claim your discount.\n\nHappy shopping!\n\nBest,\nThe Team` } ]; }; const renderSequence = (sequence) => { sequenceTimeline.innerHTML = sequence.map((email, index) => `
${index + 1}
${index < sequence.length - 1 ? '
' : ''}

${email.delay}

${email.title}

Subject: ${email.subject}

`).join(''); }; const openModal = (index) => { const email = currentSequence[index]; if (!email) return; modalSubject.textContent = `Subject: ${email.subject}`; modalBody.textContent = email.body; emailModal.classList.remove('hidden'); }; const closeModal = () => { emailModal.classList.add('hidden'); }; const handleDownloadPdf = () => { const pdfContentEl = document.getElementById('pdf-content'); if (!pdfContentEl) return; document.getElementById('pdf-timestamp').textContent = new Date().toLocaleString('en-US'); document.getElementById('pdf-customer-info').textContent = `For: ${customerNameInput.value} | Product: ${productNameInput.value}`; document.getElementById('pdf-sequence-list').innerHTML = currentSequence.map((email, index) => `

Step ${index + 1}: ${email.title}

${email.delay}

Subject: ${email.subject}

Body:\n${email.body}

`).join(''); pdfContentEl.classList.remove('hidden'); html2canvas(pdfContentEl, { scale: 2 }).then(canvas => { pdfContentEl.classList.add('hidden'); const imgData = canvas.toDataURL('image/png'); const pdf = new jsPDF({ orientation: 'portrait', unit: 'pt', format: 'a4' }); const pdfWidth = pdf.internal.pageSize.getWidth(); const margin = 40; const imgWidth = pdfWidth - (margin * 2); const imgHeight = (canvas.height * imgWidth) / canvas.width; pdf.addImage(imgData, 'PNG', margin, margin, imgWidth, imgHeight); pdf.save('email-follow-up-sequence.pdf'); }).catch(err => { console.error("Error generating PDF:", err); pdfContentEl.classList.add('hidden'); }); }; // --- Event Listeners --- generateBtn.addEventListener('click', handleGeneration); pdfBtn.addEventListener('click', handleDownloadPdf); modalCloseBtn.addEventListener('click', closeModal); sequenceTimeline.addEventListener('click', (e) => { if (e.target.classList.contains('preview-btn')) { openModal(e.target.dataset.index); } }); });
Scroll to Top