1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "smtpHost": "",
12 "smtpPort": "",
13 "smtpUsername": "",
14 "fromName": "",
15 "fromEmail": "",
16 "Prompt": `You are an expert email copywriter and digital marketing specialist.
17
18Write a persuasive, professional, and engaging email marketing advertisement for the following product.
19
20Product Information
21Product Name: [PNAME]
22Product URL: [PLINK]
23Brand Name: [BRAND]
24
25Write a high-converting promotional email of approximately 500 words.
26
27The email should include:
28
29- An attention-grabbing subject line (under 60 characters)
30- A compelling preheader (under 100 characters)
31- A friendly personalized greeting using Hello sir
32- An engaging introduction that immediately captures attention
33- Explain the customer's common problems and challenges
34- Introduce the product as the solution
35- Highlight the most important features with clear customer benefits
36- Explain how the product saves time, money, or effort
37- Create urgency without using misleading or exaggerated claims
38- Mention any discounts or limited-time offers if provided
39- End with a strong call-to-action encouraging the reader to visit the product page or purchase
40- Finish with a professional closing and brand signature
41
42Writing Style
43
44- Professional
45- Conversational
46- Trustworthy
47- Persuasive
48- Benefit-focused
49- Easy to read
50- Short paragraphs
51- Active voice
52- No hype or unrealistic promises
53- Suitable for B2B and SaaS products
54
55Avoid spam trigger words such as "FREE MONEY", "GUARANTEED", "CLICK NOW", "100% RISK FREE", or excessive capitalization and punctuation.
56
57Output Requirements
58
59Return ONLY valid JSON in the following format:
60
61{
62 "Subject": "",
63 "Email_Body": ""
64}
65
66The Email_Body should be approximately 300 words and formatted using responsive HTML suitable for email clients. Use only inline HTML elements such as <h2>, <p>, <strong>, <ul>, <li>, and <a>. Do not include CSS, JavaScript, Markdown, or code fences. Use a clean, modern email layout with inline styling where appropriate. Return only the JSON object and nothing else.`,
67 "ProductList": [
68 "Telegram Member Scraper#https://www.datascrapify.com/product/Telegram-Group-and-Channel-Member-Scraper#DataScrapify",
69 "Telegram Member Scraper#https://www.datascrapify.com/product/Telegram-Group-and-Channel-Member-Scraper#DataScrapify"
70 ],
71 "ToEmail": [
72 "test@gmail.com",
73 "test1@gmail.com"
74 ],
75 "Reply_To_Email": "",
76 "CC_Email": "",
77 "BCC_Email": "",
78 "Delay": "10"
79};
80
81
82const run = await client.actor("bhansalisoft/ai-product-advertisement-email-sender").call(input);
83
84
85console.log('Results from dataset');
86console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
87const { items } = await client.dataset(run.defaultDatasetId).listItems();
88items.forEach((item) => {
89 console.dir(item);
90});
91
92