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
{# NOTE THESE CAN ALL BE ADJUSTED TO USE PLACEHOLDER VALUES INSTEAD OF DEFINED IN THE CODE #} | |
{# START AND END TIMES FOR THE EVENT #} | |
{% set google_start_time = "T230000Z" %} | |
{% set google_end_time = "T240000Z" %} | |
{% set outlook_start_time = "T23:00:00+00:00"|urlencode %} | |
{% set outlook_end_time = "T24:00:00+00:00"|urlencode %} | |
{# STATIC VALUES - DEFINED #} | |
{% set event_title = "Sample webinar title"|urlencode %} |
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
exports.main = async (event, callback) => { | |
let originalString = 'TEXTGOESHERE'; | |
let updatedString = originalString.replace(/<br>/g, ';') | |
let nextupdatedString = updatedString.replace(/<(?=\s*[^a-zA-Z\/])/g, '****'); | |
let nextnextupdatedString = nextupdatedString.replace(/<[^>]*>|#nextsteps| /g, '') | |
let finalString = nextnextupdatedString.replace(/\*\*\*\*/g, '<'); | |
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
<script> | |
document.addEventListener("DOMContentLoaded", function() { | |
// Wait for the form to load | |
setTimeout(function() { | |
var urlInput = document.querySelector('input[name="url_of_page"]'); | |
if (urlInput) { | |
console.log('url_of_page input exists'); | |
urlInput.value = window.location.href; | |
} | |
},1000); // Adjust the delay if needed |
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
exports.main = async (event, callback) => { | |
var phone = event.inputFields['phone']; | |
console.log("Input Phone: ", phone) | |
const outputFields = { | |
valid: false, | |
validation_message: "", | |
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 axios = require('axios'); | |
exports.main = async (event, callback) => { | |
const auth = 'Bearer ' + process.env.CHANGE_THIS_VALUE_TO_MATCH_YOUR_SECRET_NAME; | |
const email = event.inputFields['email']; | |
let data = JSON.stringify({ | |
"filters": [ | |
{ |
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
<script> | |
document.addEventListener("DOMContentLoaded", function() { | |
setTimeout(function() { | |
const emailInput = document.querySelector('input[name="firstname"]'); | |
emailInput.addEventListener("input", function() { | |
const emailPattern = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/; | |
const parentDiv = emailInput.closest('.input'); | |
let messageDiv = parentDiv.querySelector('.email-error'); |
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
exports.main = async (event, callback) => { | |
var phone = event.inputFields['phone']; | |
console.log("Input Phone: ", phone) | |
const outputFields = { | |
valid: false, | |
validation_message: "", | |
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
import requests | |
url = "api.hubspot.com/events/v3/events/?objectType=contact&objectId=52054635672" | |
payload = "" | |
headers = { | |
'Authorization': '••••••' | |
} | |
response = requests.request("GET", url, headers=headers, data=payload) |
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 following scripts that can be found here https://select2.org/getting-started/installation | |
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/select2.min.css" rel="stylesheet" /> | |
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/select2.min.js"></script> | |
// in the below, we listen for the form to load, then switch out the standard select element (by name) with a select2 element | |
<script> | |
window.addEventListener('message', event => { | |
if(event.data.type === 'hsFormCallback' && event.data.eventName === 'onFormReady') { | |
// Initialize Select2 on the specified select element - update with the internal name of the property where it says internal_select_name | |
const selectElement = $('select[name=internal_select_name]').select2(); |
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
<script> | |
window.onload = function () { | |
// Function to poll for the existence of the input field | |
function waitForElement(selector, callback) { | |
const inputField = document.getElementsByName(selector)[0]; | |
if (inputField) { | |
callback(inputField); | |
} else { | |
setTimeout(function () { | |
waitForElement(selector, callback); |