3 Reasons Why Marketing Operation Manager Should Learn Node.js

If you are working in a role in Marketing/Sales/Revenue Operations and your daily work includes automation, integration, and dashboard and reporting, you may wonder, why would I learn a programming language for my daily work when most of the time I can do it without having to write code? Truth is, you would agree that at some point or for some specific tasks, you do wish you could be able to write simple scripts to get things done. Good news is it’s actually not that hard to learn some basics of a programming language and you can apply it to your work right away!

That’s how I started learning Node.js!

Technically, Node.js is not a programming language, and it’s just a JavaScript runtime. Node.js is perfect for severless functions which means we don’t need to worry about where to host our code and we can just deploy it on platforms we are already using, such as your best friend HubSpot.

Here are my examples you may find some motivations in your daily work to get started with Node.js.

Automation

Back to one year ago when our team needed to boost the number of registrants to our annual conference, one idea was to give a 50% discount code to people who bought the tickets so that they can invite maximum 2 colleagues or friends.

  1. Contact A buys a ticket in full price;
  2. A unique 50% discount code is generated;
  3. Contact A receives the confirmation email with the instructions to the conference and the discount code;
  4. Keep tracking the progress;

We are using HubSpot as our CRM and Quaderno as our checkout and payment platform, so the question is how to call Quaderno API to generate an unique 50% discount code and then send it over to the contact via HubSpot.

HubSpot supports Custom code workflow actions where Node.js comes in handy, so we just need to call Quaderno API to get discount codes:

//Import required libraries
const request = require('request');

exports.main = (event, callback) => {
  const firstname = event.inputFields['firstname'];
  const lastname =event.inputFields['lastname'];
  const discount = //the rule of discount code format;
  const auth = "Basic " + Buffer.from(process.env.Quaderno).toString(`base64`);
 
  const options = {
      method: "POST",
      url: "https://xxx.quadernoapp.com/api/checkout/coupons",
      headers: {
        "Authorization": auth,
        "Content-Type": "application/json",
      },
      body: {
        code: discount,
        name: "",
        percent_off: 50,
        max_redemptions: 2,
        redeem_by: "2022-09-10"
      },
      json: true
   };

  request(options, function (error, response, body) {
          
     // Store the data in variables
     const discount_code = body.code;
     console.log(discount_code);
     // console.log(body);
    // Optional - Could pass information back as a data output to use as a data input with Copy to Property workflow action.
    callback({ outputFields: {discount_code: discount_code} });
  })
}

The good thing is I don’t have to write the code from scratch most of the time because HubSpot makes typical use cases available so I just need to learn the basics and modify the code to make it work 😉

Integration

In my daily work, HubSpot workflow is good enough to automate processes within this CRM, and we use Zapier to sync external activities and move data back to HubSpot. For example, when people sign up to our LinkedIn events (webinars or training), we need to sync the registrant information back to HubSpot and send registrants the confirmation emails.

However, there are times that we need to go beyond no-code automation or integration.

Our sales reps have outreach activities on LinkedIn via Expandi.io and hope to sync the data to HubSpot. Ideally, the outreach activities could show up in a contact’s timeline.

It turned out that there is no a native integration for this kind of timeline events from Expandi or Zapier, so I just need to write a few lines of code via HubSpot Timeline Event api on Pipedream, which is a low-code tool allows us to write Node.js code.

Data Analytics

So far I haven’t done data analyses directly using Node.js, but it helps me a lot to set up a basic ETL pipeline for further analysis and reporting.

  1. Our engineer team uploads a log file to a Google Drive folder on a daily basis;
  2. Node.js on Pipedream transform the data in desired format;
  3. Node.js also calls external APIs to enrich the data;
  4. Update the data to a Google Bigquery table;
  5. Dashboard built with Looker Studio is automatically updated accordingly;

As you can see there are a few platforms are involved and it may seem complicated but with a basic understanding of Node.js I managed to set it up.

Learning Resources

If you are convinced by these examples and would like to get started, here are some resources I find very helpful and easy to follow:

If you have any other scenarios or examples you find Node.js can help in marketing/sales/revenue operations, feel free to share in the comment!

Subscribe
Notify of
guest
1 Comment
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
heavy-duty truck scales Iraq

BWER Company provides Iraq’s leading-edge weighbridge solutions, designed to withstand harsh environments while delivering top-tier performance and accuracy.