Amazon price checker

Hii, Everyone i’m actually creating a amazon price checker by watching a video on internet by " [Web Dev Simplified]" The code i written is not sending an email can anyone tell me where did i went wrong and why my code is not sending an email


const sgMail = require('@sendgrid/mail')


const nightmare = require('nightmare')()

const arguments = process.argv.slice(2)

const url = arguments[0]

minPrice = arguments[1]


async function checkPrice() {

   const priceString = await nightmare.goto(url)


                                      .evaluate(() => document.getElementById("priceblock_ourprice").innerText)


const priceNumber = parseFloat(priceString.replace('₹', ''))

    if (priceNumber < minPrice) {


        'price is low',

        `The price on ${url} has dropped to ${minPrice}`




function sendEmail(subject, body) {

    const email = {

        to: "",

        from: "",

        subject: subject,

        text: body,

        html: body


    return sgMail.send(email)


Hm… I don’t use sendgrid package so I can’t say for certain why it’s not working. So you said you’re watching video for this, have you checked out the package on github? There’s instructions and you can also check the issues raised, if other people had similar problems and got it solved:

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (’).

Other than sendGrid package which package would you suggest me for sending Email.??

Thanks for responding, I’ll do better from next time

to troubleshoot this better together are you getting any error in the console ?
if debugging the code when you put a breakpoint does the code get to call the sendEmail() ?

The code in the repo has an await in front of the call to sendEmail

await sendEmail('whatever', 'something')

It also has a try/catch you might want to implement as well.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.