This file contains 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 2: Make a HTTP Request to Kickbox Email Verification API using NodeJS axios */ | |
//1. Import libraries, in this instance "axios" to make HTTP requests | |
const axios = require('axios'); | |
exports.main = async (event, callback) => { | |
//2. Store contact email in variable | |
var email = event.inputFields['email']; | |
//3. Configure and Make our HTTP request to Kickbox Email Verification API |
This file contains 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 axios = require('axios'); | |
axios.defaults.headers.common['authorization'] = `Bearer ${process.env.HUBSPOTTOKEN}`; | |
axios.defaults.headers.common['Content-Type'] = `application/json`; | |
axios.defaults.headers.put['Content-Type'] = `application/json`; | |
exports.main = async (event) => { | |
const partner_id = event.inputFields['partner_id']; | |
const partnerObjectId = await getPartner(partner_id); |
This file contains 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
{ | |
"results": [ | |
{ | |
"objectId": 245, | |
"title": "Example Title", | |
"link": "https://developers.hubspot.com/docs/api/crm/extensions/custom-cards", | |
"stringExample": "CRM Cards are really cool", | |
"statusExample": "Success", | |
"numberExample": 55.95, | |
"linkExample": "https://developers.hubspot.com", |
This file contains 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 axios = require('axios'); // Used for HTTP requests | |
axios.defaults.headers.common['Authorization'] = `Bearer ${process.env.HUBSPOTTOKEN}`; // Include access token in all request from Axios | |
// Retrieve the file redirect URL from form submission | |
function getRedirectUrl(attachment) { | |
let requestUrl = attachment; | |
return new Promise((resolve) => { | |
axios.get(requestUrl).then(res => { | |
resolve(getSubstring(res.request.res.responseUrl, 'form-uploads', '?')); | |
}).catch(err => { console.log(err.message) }) |
This file contains 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 HubSpot Client Library and instantiate client with private app token | |
const hubspot = require('@hubspot/api-client'); | |
const hubspotClient = new hubspot.Client({ | |
accessToken: process.env.HUBSPOTTOKEN // Access token associated with your private app (also be sure to include token in secrets) | |
}); | |
// Helper function to get the associated Object ID of a specified Object Type | |
async function getAssociatedObjectId(objectType, objectId, toObjectType) { | |
let obj = await hubspotClient.crm.objects.associationsApi.getAll(objectType, objectId, toObjectType); | |
return obj.results[0].id; |
This file contains 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 requests | |
import urllib | |
import json | |
import smtplib | |
import os | |
from email.mime.text import MIMEText | |
from email.mime.image import MIMEImage | |
from email.mime.multipart import MIMEMultipart | |
This file contains 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'); | |
//Instantiate a new HubSpot API client using an access token (private app) | |
const hubspotClient = new hubspot.Client({ | |
accessToken: process.env.HUBSPOTTOKEN | |
}); | |
// Helper function to associate Company to Contact using HubSpot Client | |
function associateCompanyToContact(companyId, contactId) { |
This file contains 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
//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) => { | |
//2. Using a Promise, we first try to generate a random number | |
Promise.try(function() { | |
return randomNumber(10000, 50000); // Generate Random Number between a defined range | |
}).then(function(number) { // When the number is successfully generated we do this |
This file contains 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
exports.main = (event, callback) => { | |
var countryCode; | |
var country; | |
switch(event.userMessage.quickReply.quickReplies[0].value) { | |
case "Ireland": | |
countryCode = "IE" | |
country = "Ireland" |
This file contains 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 product_of_interest = event.inputFields['product_of_interest']; | |
let resourceName, resourceLink, resourceDescription, resourceImage; | |
const hubspotClient = new hubspot.Client({ | |
apiKey: process.env.HAPIKEY | |
}); |
NewerOlder