Skip to content

Instantly share code, notes, and snippets.

@ar4420
ar4420 / HubspotWebhook
Last active February 13, 2024 18:22
IgnitePOST Hubspot Webhook Integration
// Import Axios library for easier HTTP Requests
const axios = require('axios');
exports.main = (event, callback) => {
const first_name = event.inputFields['first_name'];
const last_name = event.inputFields['last_name'];
const recipient_name = `${first_name} ${last_name}`;
@ar4420
ar4420 / gist:c1af25a186d9fba0099fd6e8823fa73d
Created January 24, 2024 22:11
IgnitePOST Hubspot Integration: Custom Code Webhook Endpoint
// Import Axios library for easier HTTP Requests
const axios = require('axios')
exports.main = (event, callback) => {
const first_name = event.inputFields['first_name'];
const last_name = event.inputFields['last_name'];
const recipient_name = `${first_name} ${last_name}`
{
"letter_template_id": "1873",
"message": "Hi {{ first_name|title|default:'' }},\nWe love having you as a customer and hope you're enjoying our product as much as we like making it! As a 'thank you', here is a coupon code for 15% off the next 3 months of your subscription! \n\nSUMMER15\n\nScan the QR code on the front of the card and enter this code to take advantage of it!\n\nThanks again!\n-Emily from Acme Inc.",
"font": "pea",
"recipient_name": "{{ first_name|title|default:'' }} {{ last_name|title|default:'' }}",
"recipient_company_name": "",
api_key: [[VaLIdAPiT0K3NT0WPKPxJA-2_V2Iy9anZ48_x6O4x]]
letter_template_id: [[32]]
font: [[nelson]]
message: [[Hi {{ first_name|default:'' }},
We love having you as a customer and hope you're enjoying our product as much as we like making it! As a 'thank you', here is a coupon code for 15% off the next 3 months of your subscription!
api_key: [[VaLIdAPiT0K3NT0WPKPxJA-2_V2Iy9anZ48_x6O4x]]
letter_template_id: [[32]]
font: [[nelson]]
message: [[Hi Bob,
We thought you might want to check out some of our
recent case studies and testimonials! If you have a
moment, we would love to connect and show you how
user_ids = [6
9,
11,
15,
34,
35,
43,
62,
65,
77,
@ar4420
ar4420 / Set Custom Package Sku Type
Created July 19, 2016 18:42
Script to correctly set Custom Package Sku Type
package_skus = PackageSku.where('client_id is not null')
saved_skus = {}
package_skus.find_each do |sku|
if sku.sku_type != 'custom'
sku.sku_type = 'custom'
saved_skus[sku.id] = sku.save
end
end
@ar4420
ar4420 / Update Premium Custom Package type
Created July 19, 2016 15:16
[AJR] Update package sku type for standard vs custom packages.
sql_statement = <<-SQL
update package_skus
set sku_type = 'standard'
where client_id is null
SQL
ActiveRecord::Base.connection.execute(sql_statement)
sql_statement = <<-SQL
coach_ids = SET_OF_IDS_FROM_OUR_COACH_ROSTER
coaches = Coach.where(id: coach_ids)
candidate_client_users = CoachUserClientUser.where(coach_user: coaches.map(&:user)).where(available_training_session_count: 0).pluck(:client_user_id)
# First time flow
# send to all candidate clients
candidate_client_users.find_each do |user|
RebookRequestViaSmsSender.send_sms(user)
end
@ar4420
ar4420 / gist:231dd2077f93015e0d72
Last active February 12, 2016 18:32
Bulk resolve ('Take No Action') on Ongoing Conversation flags created before Feb 2.
flags = Flag.
of_ongoing_conversation.
unresolved.
within_date_range(Statistic::START_OF_BUSINESS..Time.zone.local(2016, 2, 2, 23, 59, 59))
flags.find_each do |flag|
flag.take_no_action!