#1- Add library NodeMailer: "nodemailer": "6.4.6" at **package.json
#2- Create your Cloud Function in the Fulfillment: -Add in your index.js the const nodemailer
| <header id="header"> | |
| <h1><a href="#">🛰️ COVID19 Spread Monitor 🌎 <span> @NASA Space Apps Covid-19 Challenge 🚀 </span></a></h1> | |
| <a href="#menu">Menu</a> | |
| </header> | |
| <div id='map'></div> | |
| <div id='day-panel'> | |
| <div id='day-label'></div> | |
| <input id="day-slider" type="range" min="-6" max="0" value="0"></div> | |
| </div> |
| transporter.sendMail(mailOptions, function (err, info) { | |
| if(err) | |
| console.log(err); | |
| else | |
| console.log(info); | |
| }); | |
| } |
| const mailOptions = { | |
| from: "YourmailUserID", // Here insert the sender Gmail address | |
| to: email, // Here goes the users email receivers | |
| subject: "Bot Notification DEMO", // Here insert your Subject line | |
| html: '<h1>Welcome ${name} I'm Notify Bot 🤖</h1> | |
| <h2>Here you add your message template and content</h2> | |
| <p> 🤖 And media content to personalise the email notification to your users ✅ </p> ', | |
| attachments: | |
| [{ |
| const transporter = nodemailer.createTransport({ | |
| host: 'smtp.gmail.com ', | |
| port: 465, | |
| service: 'gmail', | |
| auth: { | |
| user: 'owneruserid@gmail.com', | |
| pass: 'YourSecurePasswordHere' | |
| } | |
| }); |
| function sendEmailHandler (agent) { | |
| const {email, name} = agent.parameters; | |
| const transporter = nodemailer.createTransport({ | |
| host: 'smtp.mail.com ', | |
| port: 465, | |
| service: 'gmail', | |
| auth: { | |
| user: 'yourUsername', | |
| pass: 'yourPassword' | |
| } |
| let intentMap = new Map(); | |
| intentMap.set('Welcome', welcome); | |
| intentMap.set('Fallback', fallback); | |
| intentMap.set('Notify2Email', NotifyHandler); | |
| agent.handleRequest(intentMap); | |
| }); |
| const functions = require('fire-functions'); | |
| const {WebhookClient} = require('df-fulfillment'); | |
| const nodemailer = require("nodemailer"); |
| function getsheetData() | |
| return axios.get (‘https://sheetdb.io/api/v1/xirgfp569xwov‘); | |
| } | |
| function welcome (agent) { | |
| const name = agent.parameters.name; | |
| return getSpreadsheetData().then(res => { | |
| res.data.map(person => { | |
| if (person.Name === name} |
| var nombreHoja = "Hoja 1" | |
| var user_id = "Ingrese_IG_ID"; //Encuentre el IG ID (únicamente números) aquí: https://codeofaninja.com/tools/find-instagram-user-id | |
| var instagram_base_url = "https://www.instagram.com/graphql/query/"; | |
| var following = "?query_hash=58712303d941c6855d4e888c5f0cd22f&variables=%7B%22id%22%3A%22" + user_id + "%22%2C%22first%22%3A24%7D" | |
| var followers = "?query_hash=37479f2b8209594dde7facb0d904896a&variables=%7B%22id%22%3A%22" + user_id + "%22%2C%22first%22%3A24%7D" | |
| var medias = "?query_hash=f2405b236d85e8296cf30347c9f08c2a&variables=%7B%22id%22%3A%22" + user_id + "%22%2C%22first%22%3A12%7D" | |
| function contarSeguidores() { |