Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions apps/sim/blocks/blocks/hubspot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -985,22 +985,31 @@ Return ONLY the JSON array of property names - no explanations, no markdown, no
},
...getTrigger('hubspot_contact_created').subBlocks.slice(1),
...getTrigger('hubspot_contact_deleted').subBlocks.slice(1),
...getTrigger('hubspot_contact_merged').subBlocks.slice(1),
...getTrigger('hubspot_contact_privacy_deleted').subBlocks.slice(1),
...getTrigger('hubspot_contact_property_changed').subBlocks.slice(1),
...getTrigger('hubspot_contact_restored').subBlocks.slice(1),
...getTrigger('hubspot_company_created').subBlocks.slice(1),
...getTrigger('hubspot_company_deleted').subBlocks.slice(1),
...getTrigger('hubspot_company_merged').subBlocks.slice(1),
...getTrigger('hubspot_company_property_changed').subBlocks.slice(1),
...getTrigger('hubspot_company_restored').subBlocks.slice(1),
...getTrigger('hubspot_conversation_creation').subBlocks.slice(1),
...getTrigger('hubspot_conversation_deletion').subBlocks.slice(1),
...getTrigger('hubspot_conversation_new_message').subBlocks.slice(1),
...getTrigger('hubspot_conversation_privacy_deletion').subBlocks.slice(1),
...getTrigger('hubspot_conversation_property_changed').subBlocks.slice(1),
...getTrigger('hubspot_deal_created').subBlocks.slice(1),
...getTrigger('hubspot_deal_deleted').subBlocks.slice(1),
...getTrigger('hubspot_deal_merged').subBlocks.slice(1),
...getTrigger('hubspot_deal_property_changed').subBlocks.slice(1),
...getTrigger('hubspot_deal_restored').subBlocks.slice(1),
...getTrigger('hubspot_ticket_created').subBlocks.slice(1),
...getTrigger('hubspot_ticket_deleted').subBlocks.slice(1),
...getTrigger('hubspot_ticket_merged').subBlocks.slice(1),
...getTrigger('hubspot_ticket_property_changed').subBlocks.slice(1),
...getTrigger('hubspot_ticket_restored').subBlocks.slice(1),
...getTrigger('hubspot_webhook').subBlocks.slice(1),
],
tools: {
access: [
Expand Down Expand Up @@ -1329,22 +1338,31 @@ Return ONLY the JSON array of property names - no explanations, no markdown, no
available: [
'hubspot_contact_created',
'hubspot_contact_deleted',
'hubspot_contact_merged',
'hubspot_contact_privacy_deleted',
'hubspot_contact_property_changed',
'hubspot_contact_restored',
'hubspot_company_created',
'hubspot_company_deleted',
'hubspot_company_merged',
'hubspot_company_property_changed',
'hubspot_company_restored',
'hubspot_conversation_creation',
'hubspot_conversation_deletion',
'hubspot_conversation_new_message',
'hubspot_conversation_privacy_deletion',
'hubspot_conversation_property_changed',
'hubspot_deal_created',
'hubspot_deal_deleted',
'hubspot_deal_merged',
'hubspot_deal_property_changed',
'hubspot_deal_restored',
'hubspot_ticket_created',
'hubspot_ticket_deleted',
'hubspot_ticket_merged',
'hubspot_ticket_property_changed',
'hubspot_ticket_restored',
'hubspot_webhook',
],
},
}
217 changes: 217 additions & 0 deletions apps/sim/triggers/hubspot/company_merged.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,217 @@
import { HubspotIcon } from '@/components/icons'
import {
buildCompanyMergedOutputs,
hubspotCompanyTriggerOptions,
hubspotSetupInstructions,
} from '@/triggers/hubspot/utils'
import type { TriggerConfig } from '@/triggers/types'

export const hubspotCompanyMergedTrigger: TriggerConfig = {
id: 'hubspot_company_merged',
name: 'HubSpot Company Merged',
provider: 'hubspot',
description: 'Trigger workflow when companies are merged in HubSpot',
version: '1.0.0',
icon: HubspotIcon,

subBlocks: [
{
id: 'selectedTriggerId',
title: 'Trigger Type',
type: 'dropdown',
mode: 'trigger',
options: hubspotCompanyTriggerOptions,
value: () => 'hubspot_company_merged',
required: true,
},
{
id: 'clientId',
title: 'Client ID',
type: 'short-input',
placeholder: 'Enter your HubSpot app Client ID',
description: 'Found in your HubSpot app settings under Auth tab',
required: true,
mode: 'trigger',
condition: {
field: 'selectedTriggerId',
value: 'hubspot_company_merged',
},
},
{
id: 'clientSecret',
title: 'Client Secret',
type: 'short-input',
placeholder: 'Enter your HubSpot app Client Secret',
description: 'Found in your HubSpot app settings under Auth tab',
password: true,
required: true,
mode: 'trigger',
condition: {
field: 'selectedTriggerId',
value: 'hubspot_company_merged',
},
},
{
id: 'appId',
title: 'App ID',
type: 'short-input',
placeholder: 'Enter your HubSpot App ID',
description: 'Found in your HubSpot app settings. Used to identify your app.',
required: true,
mode: 'trigger',
condition: {
field: 'selectedTriggerId',
value: 'hubspot_company_merged',
},
},
{
id: 'developerApiKey',
title: 'Developer API Key',
type: 'short-input',
placeholder: 'Enter your HubSpot Developer API Key',
description: 'Used for making API calls to HubSpot. Found in your HubSpot app settings.',
password: true,
required: true,
mode: 'trigger',
condition: {
field: 'selectedTriggerId',
value: 'hubspot_company_merged',
},
},
{
id: 'webhookUrlDisplay',
title: 'Webhook URL',
type: 'short-input',
readOnly: true,
showCopyButton: true,
useWebhookUrl: true,
placeholder: 'Webhook URL will be generated',
description: 'Copy this URL and paste it into your HubSpot app webhook subscription settings',
mode: 'trigger',
condition: {
field: 'selectedTriggerId',
value: 'hubspot_company_merged',
},
},
{
id: 'triggerSave',
title: '',
type: 'trigger-save',
mode: 'trigger',
triggerId: 'hubspot_company_merged',
condition: {
field: 'selectedTriggerId',
value: 'hubspot_company_merged',
},
},
{
id: 'triggerInstructions',
title: 'Setup Instructions',
type: 'text',
defaultValue: hubspotSetupInstructions(
'company.merge',
'The webhook will trigger whenever two companies are merged in your HubSpot account. The objectId will be the winning (primary) company ID.'
),
mode: 'trigger',
condition: {
field: 'selectedTriggerId',
value: 'hubspot_company_merged',
},
},
{
id: 'curlSetWebhookUrl',
title: '1. Set Webhook Target URL',
type: 'code',
language: 'javascript',
value: (params: Record<string, any>) => {
const webhookUrl = params.webhookUrlDisplay || '{YOUR_WEBHOOK_URL_FROM_ABOVE}'
return `curl -X PUT "https://un5my6tpgjvtp3nuvvv28.julianrbryant.com/webhooks/v3/{YOUR_APP_ID}/settings?hapikey={YOUR_DEVELOPER_API_KEY}" \\
-H "Content-Type: application/json" \\
-d '{
"targetUrl": "${webhookUrl}",
"throttling": {
"maxConcurrentRequests": 10
}
}'`
},
readOnly: true,
collapsible: true,
defaultCollapsed: true,
showCopyButton: true,
description: 'Run this command to set your webhook URL in HubSpot',
mode: 'trigger',
condition: {
field: 'selectedTriggerId',
value: 'hubspot_company_merged',
},
},
{
id: 'curlCreateSubscription',
title: '2. Create Webhook Subscription',
type: 'code',
language: 'javascript',
defaultValue: `curl -X POST "https://un5my6tpgjvtp3nuvvv28.julianrbryant.com/webhooks/v3/{YOUR_APP_ID}/subscriptions?hapikey={YOUR_DEVELOPER_API_KEY}" \\
-H "Content-Type: application/json" \\
-d '{
"eventType": "company.merge",
"active": true
}'`,
readOnly: true,
collapsible: true,
defaultCollapsed: true,
showCopyButton: true,
description: 'Run this command to subscribe to company merge events',
mode: 'trigger',
condition: {
field: 'selectedTriggerId',
value: 'hubspot_company_merged',
},
},
{
id: 'samplePayload',
title: 'Event Payload Example',
type: 'code',
language: 'json',
defaultValue: JSON.stringify(
[
{
eventId: 3181526813,
subscriptionId: 4629974,
portalId: 244315265,
appId: 23608917,
occurredAt: 1762659213730,
subscriptionType: 'company.merge',
attemptNumber: 0,
objectId: 216126906049,
changeFlag: 'MERGED',
changeSource: 'CRM_UI',
sourceId: 'userId:84916424',
mergedObjectIds: [216126906050],
},
],
null,
2
),
readOnly: true,
collapsible: true,
defaultCollapsed: true,
mode: 'trigger',
condition: {
field: 'selectedTriggerId',
value: 'hubspot_company_merged',
},
},
],

outputs: buildCompanyMergedOutputs(),

webhook: {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-HubSpot-Signature': 'sha256=...',
'X-HubSpot-Request-Id': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
'User-Agent': 'HubSpot Webhooks',
},
},
}
Loading
Loading