Send email on webhook trigger

7 1 3


I'm fairly new to Shopify Apps. I'm making a React & Node.js app where I'm adding my product to Online Stores and when the product is sold, I need to receive an email.

I already have the webhook establishment, product creation, checkbox to add the product into the cart, etc... So I already have a trigger when there is another with my product, what I can't seem to find is how to send an email from my Shopify app to my personal email letting me know my product has been sold.

From the little I found I need to connect my app to an email server but I can't find any documentation on how.

Can anyone provide any information on how I can receive when the sale is done?


P.S: Another method I looked at is if adding a vendor to the online store would notify such vendor (a.k.a me) with the sales directly through "normal" Shopify. But again, I haven't been able to find anything on this.

Shopify Partner
35 3 6

This is an accepted solution.

Hi @nandezer, Happy to help you as you are using Node with React you can use Nodemailer for this you need to set up a mail server for this which will receive your object and trigger an email to the desired persons as you mentioned before we will start writing let's import our necessary packages we will use yarn add express nodemailer nodemon.

Now create an app.js file, where you will write all your code.

Now you will import packages to use here and create a SMTP protocol in order for Nodemailer to send mails. This protocol is used by email hosts such as gmail, hotmail etc.

let express = require('express');

let app = express();

const path = require('path');

let nodemailer = require('nodemailer');


// Static folder

app.use('/public', express.static(path.join(__dirname, 'public')));


  host: "",

port: 587,

secure: false,

  auth: {




});'/access', (req, res, next) => {

  var email =

  var message = req.body.message

  var content = `email: ${email} \n message: ${message} `

  var mail = {

from: name,

to: name,

message: subject,

text: content


  transporter.sendMail(mail, (err, data) => {

if (err) {


     status: 'fail'


} else {


    status: 'success'





const PORT = process.env.PORT || 8080

app.listen(PORT, () =>`server has started on ${PORT}`))


We tried to help with a simple example but you can tweak and make this much better if needed. Let me know if you have any questions, thanks!

Shanif Dhanani, CEO and data scientist at Apteo
- Was I able to help? Click Like to let me know!
- If I was able to answer your question, click Accept as Solution
- Want to increase your customer lifetime value with A.I.? Check out Apteo