This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Import the Hubspot NodeJS Client Library - this will allow us to use the HubSpot APIs | |
| const hubspot = require('@hubspot/api-client'); | |
| exports.main = (event, callback) => { | |
| // Instantiate a new HubSpot API client using the HAPI key (secret) | |
| const hubspotClient = new hubspot.Client({ | |
| apiKey: process.env.HAPIKEY | |
| }); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const hubspot = require('@hubspot/api-client'); | |
| var Promise = require("bluebird"); | |
| var randomNumber = require("random-number-csprng"); | |
| exports.main = (event, callback) => { | |
| Promise.try(function() { | |
| return randomNumber(1, 2); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const hubspot = require('@hubspot/api-client'); | |
| exports.main = (event, callback) => { | |
| // Secrets can be accessed with environment variables. | |
| // Make sure to add your API key under "Secrets" above. | |
| const hubspotClient = new hubspot.Client({ | |
| apiKey: process.env.HAPIKEY | |
| }); | |
| hubspotClient.crm.contacts.basicApi.getById(event.object.objectId, ["phone"]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const hubspot = require('@hubspot/api-client'); | |
| exports.main = (event, callback) => { | |
| // Setup the HubSpot API Client | |
| const hubspotClient = new hubspot.Client({ | |
| apiKey: process.env.HAPIKEY | |
| }); | |
| // Use the client to pull information relating to the currently enrolled deal |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Include the mysql node library | |
| const mysql = require('mysql'); | |
| // Function is called when custom code action is executed | |
| exports.main = async (event, callback) => { | |
| // Define variables using CRM data as an input | |
| const email = event.inputFields['email']; | |
| const firstName = event.inputFields['firstname']; | |
| const lastName = event.inputFields['lastname']; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* create database "customers" */ | |
| CREATE DATABASE customers; | |
| /* use the database "customers" */ | |
| USE customers; | |
| /* | |
| Create table in the "customers" database called "customer_info". | |
| This will have columns to hold data relating to our customers namely | |
| their name and email address. CustomerID is the primary key and is an auto-generaged |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const request = require('request'); | |
| exports.main = async (event, callback) => { | |
| //1. Store the company domain in a variable | |
| var companyDomain = event.inputFields['domain']; | |
| var domainAlias, tech, subIndustry, legalName; | |
| //2. Configure request to Clearbit Discovery API | |
| var options = { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* Example 1: Make a HTTP Request to Kickbox Verification API using NodeJS request. */ | |
| //1. Import libraries, in this instance "request" to make HTTP requests | |
| const request = require('request') | |
| exports.main = async (event, callback) => { | |
| //2. Define variables to store data | |
| var role, free, disposable, sendex, result, reason; // We will use these later on when data is returned from Kickbox | |
| const email = event.inputFields['email']; // We store the contact email in a variable and will query Kickbox |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const hubspot = require('@hubspot/api-client'); | |
| exports.main = async (event, callback) => { | |
| const fname = event.inputFields['firstname']; | |
| const lname = event.inputFields['lastname']; | |
| const plus1FirstName = event.inputFields['plus_1_first_name']; | |
| const plus1LastName = event.inputFields['plus_1_last_name']; | |
| const plus1EmailAddress = event.inputFields['plus_1_email_address']; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| Operations Hub Workshop #3: Workflow 1 Code | |
| This code is used to generate a random number that will be assigned to anyone who joins our referral program. | |
| */ | |
| //1. Import required libaries | |
| const Promise = require("bluebird"); // Javascript Promise Library | |
| const randomNumber = require("random-number-csprng"); // Javascript Random Number Generator | |
| exports.main = (event, callback) => { |