Skip to content

Instantly share code, notes, and snippets.

View chrisoklepke's full-sized avatar

Chriso Klepke chrisoklepke

View GitHub Profile
import os
import time
from hubspot import HubSpot
from hubspot.crm.products import (
PublicObjectSearchRequest,
ApiException as productApiException,
)
from hubspot.crm.line_items import (
BatchInputSimplePublicObjectInput,
ApiException as lineItemApiException,
"""
This custom code action is intended to solve the problem when a user is entering two different
email adresses in the configurator and the chargebee dropin. As a result, two contacts are created.
One has the custom objects and the other one has the deal associated.
Buy looking for the Hash of the Deal of contacts with a Deal but without custom objects,
we determin the other contact ID and merge them together.
"""
import os
import requests
@chrisoklepke
chrisoklepke / serendipity_sunset.yaml
Last active July 9, 2023 15:05
Serendipity Sunset Warp Theme
accent: "#8D8F9E"
background: "#272938"
foreground: "#DEE0EF"
details: "darker"
terminal_colors:
normal:
black: "#363847"
red: "#D1918F"
green: "#AAC9D4"
yellow: "#EDD5D6"
@chrisoklepke
chrisoklepke / example.csv
Created December 22, 2022 14:52
Import a CSV file in Python with HubSpot API Library
First Name Last Name Email Address
Lorelai Gilmore [email protected]
Leslie Knope [email protected]
Eleanor Shellstrop [email protected]
Luke Danes [email protected]
import os
import requests
import json
from random import randint
ticketCount = 0
def main(event):
# Create a ticket ID for your event
global ticketCount
import os
from pprint import pprint
from hubspot import HubSpot
def main(event):
# Change the Object Type and Association Type to your custom object
customObjectType = "2-XXXXXXXXX"
associationType = "contact_to_CUSTOMOBJECT"
@chrisoklepke
chrisoklepke / HubSpotXMLtrackingCode.xml
Last active October 27, 2021 11:42
HubSpot Embed Code for XML CMS
<!-- Start of HubSpot Embed Code -->
<script type="text/javascript" id="hs-script-loader" async defer src="//js-eu1.hs-scripts.com/XXXXXXXX.js">/*<![CDATA[*//*]]>*/</script>
<!-- End of HubSpot Embed Code -->
@chrisoklepke
chrisoklepke / associateContactToCompany.js
Last active December 29, 2022 12:14 — forked from jackcoldrick90/associateContactToCompany.js
This custom code snippet can be used to associate a contact to a company based on the company name property that is stored at a contact level. It's particularly useful if your customers are using a freemail address and aren't supplying a company website - just the name of their company. If no company is found a new record will be created in the …
// Import the Hubspot NodeJS Client Library - this will allow us to use the HubSpot APIs
const hubspot = require('@hubspot/api-client');
/*
This function is called when the custom code action is executed. It takes 2 arguements. The first is the event object which contains information on the currently enrolled object.
The second is the callback function which is used to pass data back to the workflow.
*/
exports.main = (event, callback) => {
// Instantiate a new HubSpot API client using the HAPI key (secret)