mirror of
https://github.com/simstudioai/sim.git
synced 2026-04-28 03:00:29 -04:00
feat(triggers): add HubSpot merge, restore, and generic webhook triggers (#3983)
* feat(triggers): add HubSpot merge, restore, and generic webhook triggers * fix(triggers): add mergedObjectIds to merge trigger output schemas * fix(triggers): derive correct OAuth scope per HubSpot object type in setup instructions * lint
This commit is contained in:
@@ -985,11 +985,15 @@ 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),
|
||||
@@ -997,10 +1001,15 @@ Return ONLY the JSON array of property names - no explanations, no markdown, no
|
||||
...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: [
|
||||
@@ -1329,11 +1338,15 @@ 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',
|
||||
@@ -1341,10 +1354,15 @@ Return ONLY the JSON array of property names - no explanations, no markdown, no
|
||||
'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
apps/sim/triggers/hubspot/company_merged.ts
Normal file
217
apps/sim/triggers/hubspot/company_merged.ts
Normal file
@@ -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://api.hubapi.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://api.hubapi.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',
|
||||
},
|
||||
},
|
||||
}
|
||||
216
apps/sim/triggers/hubspot/company_restored.ts
Normal file
216
apps/sim/triggers/hubspot/company_restored.ts
Normal file
@@ -0,0 +1,216 @@
|
||||
import { HubspotIcon } from '@/components/icons'
|
||||
import {
|
||||
buildCompanyRestoredOutputs,
|
||||
hubspotCompanyTriggerOptions,
|
||||
hubspotSetupInstructions,
|
||||
} from '@/triggers/hubspot/utils'
|
||||
import type { TriggerConfig } from '@/triggers/types'
|
||||
|
||||
export const hubspotCompanyRestoredTrigger: TriggerConfig = {
|
||||
id: 'hubspot_company_restored',
|
||||
name: 'HubSpot Company Restored',
|
||||
provider: 'hubspot',
|
||||
description: 'Trigger workflow when a deleted company is restored in HubSpot',
|
||||
version: '1.0.0',
|
||||
icon: HubspotIcon,
|
||||
|
||||
subBlocks: [
|
||||
{
|
||||
id: 'selectedTriggerId',
|
||||
title: 'Trigger Type',
|
||||
type: 'dropdown',
|
||||
mode: 'trigger',
|
||||
options: hubspotCompanyTriggerOptions,
|
||||
value: () => 'hubspot_company_restored',
|
||||
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_restored',
|
||||
},
|
||||
},
|
||||
{
|
||||
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_restored',
|
||||
},
|
||||
},
|
||||
{
|
||||
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_restored',
|
||||
},
|
||||
},
|
||||
{
|
||||
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_restored',
|
||||
},
|
||||
},
|
||||
{
|
||||
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_restored',
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'triggerSave',
|
||||
title: '',
|
||||
type: 'trigger-save',
|
||||
mode: 'trigger',
|
||||
triggerId: 'hubspot_company_restored',
|
||||
condition: {
|
||||
field: 'selectedTriggerId',
|
||||
value: 'hubspot_company_restored',
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'triggerInstructions',
|
||||
title: 'Setup Instructions',
|
||||
type: 'text',
|
||||
defaultValue: hubspotSetupInstructions(
|
||||
'company.restore',
|
||||
'The webhook will trigger whenever a previously deleted company is restored in your HubSpot account.'
|
||||
),
|
||||
mode: 'trigger',
|
||||
condition: {
|
||||
field: 'selectedTriggerId',
|
||||
value: 'hubspot_company_restored',
|
||||
},
|
||||
},
|
||||
{
|
||||
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://api.hubapi.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_restored',
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'curlCreateSubscription',
|
||||
title: '2. Create Webhook Subscription',
|
||||
type: 'code',
|
||||
language: 'javascript',
|
||||
defaultValue: `curl -X POST "https://api.hubapi.com/webhooks/v3/{YOUR_APP_ID}/subscriptions?hapikey={YOUR_DEVELOPER_API_KEY}" \\
|
||||
-H "Content-Type: application/json" \\
|
||||
-d '{
|
||||
"eventType": "company.restore",
|
||||
"active": true
|
||||
}'`,
|
||||
readOnly: true,
|
||||
collapsible: true,
|
||||
defaultCollapsed: true,
|
||||
showCopyButton: true,
|
||||
description: 'Run this command to subscribe to company restore events',
|
||||
mode: 'trigger',
|
||||
condition: {
|
||||
field: 'selectedTriggerId',
|
||||
value: 'hubspot_company_restored',
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'samplePayload',
|
||||
title: 'Event Payload Example',
|
||||
type: 'code',
|
||||
language: 'json',
|
||||
defaultValue: JSON.stringify(
|
||||
[
|
||||
{
|
||||
eventId: 3181526814,
|
||||
subscriptionId: 4629975,
|
||||
portalId: 244315265,
|
||||
appId: 23608917,
|
||||
occurredAt: 1762659213730,
|
||||
subscriptionType: 'company.restore',
|
||||
attemptNumber: 0,
|
||||
objectId: 216126906049,
|
||||
changeFlag: 'RESTORED',
|
||||
changeSource: 'CRM_UI',
|
||||
sourceId: 'userId:84916424',
|
||||
},
|
||||
],
|
||||
null,
|
||||
2
|
||||
),
|
||||
readOnly: true,
|
||||
collapsible: true,
|
||||
defaultCollapsed: true,
|
||||
mode: 'trigger',
|
||||
condition: {
|
||||
field: 'selectedTriggerId',
|
||||
value: 'hubspot_company_restored',
|
||||
},
|
||||
},
|
||||
],
|
||||
|
||||
outputs: buildCompanyRestoredOutputs(),
|
||||
|
||||
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',
|
||||
},
|
||||
},
|
||||
}
|
||||
217
apps/sim/triggers/hubspot/contact_merged.ts
Normal file
217
apps/sim/triggers/hubspot/contact_merged.ts
Normal file
@@ -0,0 +1,217 @@
|
||||
import { HubspotIcon } from '@/components/icons'
|
||||
import {
|
||||
buildContactMergedOutputs,
|
||||
hubspotContactTriggerOptions,
|
||||
hubspotSetupInstructions,
|
||||
} from '@/triggers/hubspot/utils'
|
||||
import type { TriggerConfig } from '@/triggers/types'
|
||||
|
||||
export const hubspotContactMergedTrigger: TriggerConfig = {
|
||||
id: 'hubspot_contact_merged',
|
||||
name: 'HubSpot Contact Merged',
|
||||
provider: 'hubspot',
|
||||
description: 'Trigger workflow when contacts are merged in HubSpot',
|
||||
version: '1.0.0',
|
||||
icon: HubspotIcon,
|
||||
|
||||
subBlocks: [
|
||||
{
|
||||
id: 'selectedTriggerId',
|
||||
title: 'Trigger Type',
|
||||
type: 'dropdown',
|
||||
mode: 'trigger',
|
||||
options: hubspotContactTriggerOptions,
|
||||
value: () => 'hubspot_contact_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_contact_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_contact_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_contact_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_contact_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_contact_merged',
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'triggerSave',
|
||||
title: '',
|
||||
type: 'trigger-save',
|
||||
mode: 'trigger',
|
||||
triggerId: 'hubspot_contact_merged',
|
||||
condition: {
|
||||
field: 'selectedTriggerId',
|
||||
value: 'hubspot_contact_merged',
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'triggerInstructions',
|
||||
title: 'Setup Instructions',
|
||||
type: 'text',
|
||||
defaultValue: hubspotSetupInstructions(
|
||||
'contact.merge',
|
||||
'The webhook will trigger whenever two contacts are merged in your HubSpot account. The objectId will be the winning (primary) contact ID.'
|
||||
),
|
||||
mode: 'trigger',
|
||||
condition: {
|
||||
field: 'selectedTriggerId',
|
||||
value: 'hubspot_contact_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://api.hubapi.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_contact_merged',
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'curlCreateSubscription',
|
||||
title: '2. Create Webhook Subscription',
|
||||
type: 'code',
|
||||
language: 'javascript',
|
||||
defaultValue: `curl -X POST "https://api.hubapi.com/webhooks/v3/{YOUR_APP_ID}/subscriptions?hapikey={YOUR_DEVELOPER_API_KEY}" \\
|
||||
-H "Content-Type: application/json" \\
|
||||
-d '{
|
||||
"eventType": "contact.merge",
|
||||
"active": true
|
||||
}'`,
|
||||
readOnly: true,
|
||||
collapsible: true,
|
||||
defaultCollapsed: true,
|
||||
showCopyButton: true,
|
||||
description: 'Run this command to subscribe to contact merge events',
|
||||
mode: 'trigger',
|
||||
condition: {
|
||||
field: 'selectedTriggerId',
|
||||
value: 'hubspot_contact_merged',
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'samplePayload',
|
||||
title: 'Event Payload Example',
|
||||
type: 'code',
|
||||
language: 'json',
|
||||
defaultValue: JSON.stringify(
|
||||
[
|
||||
{
|
||||
eventId: 3181526811,
|
||||
subscriptionId: 4629972,
|
||||
portalId: 244315265,
|
||||
appId: 23608917,
|
||||
occurredAt: 1762659213730,
|
||||
subscriptionType: 'contact.merge',
|
||||
attemptNumber: 0,
|
||||
objectId: 316126906049,
|
||||
changeFlag: 'MERGED',
|
||||
changeSource: 'CRM_UI',
|
||||
sourceId: 'userId:84916424',
|
||||
mergedObjectIds: [316126906050],
|
||||
},
|
||||
],
|
||||
null,
|
||||
2
|
||||
),
|
||||
readOnly: true,
|
||||
collapsible: true,
|
||||
defaultCollapsed: true,
|
||||
mode: 'trigger',
|
||||
condition: {
|
||||
field: 'selectedTriggerId',
|
||||
value: 'hubspot_contact_merged',
|
||||
},
|
||||
},
|
||||
],
|
||||
|
||||
outputs: buildContactMergedOutputs(),
|
||||
|
||||
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',
|
||||
},
|
||||
},
|
||||
}
|
||||
216
apps/sim/triggers/hubspot/contact_restored.ts
Normal file
216
apps/sim/triggers/hubspot/contact_restored.ts
Normal file
@@ -0,0 +1,216 @@
|
||||
import { HubspotIcon } from '@/components/icons'
|
||||
import {
|
||||
buildContactRestoredOutputs,
|
||||
hubspotContactTriggerOptions,
|
||||
hubspotSetupInstructions,
|
||||
} from '@/triggers/hubspot/utils'
|
||||
import type { TriggerConfig } from '@/triggers/types'
|
||||
|
||||
export const hubspotContactRestoredTrigger: TriggerConfig = {
|
||||
id: 'hubspot_contact_restored',
|
||||
name: 'HubSpot Contact Restored',
|
||||
provider: 'hubspot',
|
||||
description: 'Trigger workflow when a deleted contact is restored in HubSpot',
|
||||
version: '1.0.0',
|
||||
icon: HubspotIcon,
|
||||
|
||||
subBlocks: [
|
||||
{
|
||||
id: 'selectedTriggerId',
|
||||
title: 'Trigger Type',
|
||||
type: 'dropdown',
|
||||
mode: 'trigger',
|
||||
options: hubspotContactTriggerOptions,
|
||||
value: () => 'hubspot_contact_restored',
|
||||
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_contact_restored',
|
||||
},
|
||||
},
|
||||
{
|
||||
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_contact_restored',
|
||||
},
|
||||
},
|
||||
{
|
||||
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_contact_restored',
|
||||
},
|
||||
},
|
||||
{
|
||||
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_contact_restored',
|
||||
},
|
||||
},
|
||||
{
|
||||
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_contact_restored',
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'triggerSave',
|
||||
title: '',
|
||||
type: 'trigger-save',
|
||||
mode: 'trigger',
|
||||
triggerId: 'hubspot_contact_restored',
|
||||
condition: {
|
||||
field: 'selectedTriggerId',
|
||||
value: 'hubspot_contact_restored',
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'triggerInstructions',
|
||||
title: 'Setup Instructions',
|
||||
type: 'text',
|
||||
defaultValue: hubspotSetupInstructions(
|
||||
'contact.restore',
|
||||
'The webhook will trigger whenever a previously deleted contact is restored in your HubSpot account.'
|
||||
),
|
||||
mode: 'trigger',
|
||||
condition: {
|
||||
field: 'selectedTriggerId',
|
||||
value: 'hubspot_contact_restored',
|
||||
},
|
||||
},
|
||||
{
|
||||
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://api.hubapi.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_contact_restored',
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'curlCreateSubscription',
|
||||
title: '2. Create Webhook Subscription',
|
||||
type: 'code',
|
||||
language: 'javascript',
|
||||
defaultValue: `curl -X POST "https://api.hubapi.com/webhooks/v3/{YOUR_APP_ID}/subscriptions?hapikey={YOUR_DEVELOPER_API_KEY}" \\
|
||||
-H "Content-Type: application/json" \\
|
||||
-d '{
|
||||
"eventType": "contact.restore",
|
||||
"active": true
|
||||
}'`,
|
||||
readOnly: true,
|
||||
collapsible: true,
|
||||
defaultCollapsed: true,
|
||||
showCopyButton: true,
|
||||
description: 'Run this command to subscribe to contact restore events',
|
||||
mode: 'trigger',
|
||||
condition: {
|
||||
field: 'selectedTriggerId',
|
||||
value: 'hubspot_contact_restored',
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'samplePayload',
|
||||
title: 'Event Payload Example',
|
||||
type: 'code',
|
||||
language: 'json',
|
||||
defaultValue: JSON.stringify(
|
||||
[
|
||||
{
|
||||
eventId: 3181526812,
|
||||
subscriptionId: 4629973,
|
||||
portalId: 244315265,
|
||||
appId: 23608917,
|
||||
occurredAt: 1762659213730,
|
||||
subscriptionType: 'contact.restore',
|
||||
attemptNumber: 0,
|
||||
objectId: 316126906049,
|
||||
changeFlag: 'RESTORED',
|
||||
changeSource: 'CRM_UI',
|
||||
sourceId: 'userId:84916424',
|
||||
},
|
||||
],
|
||||
null,
|
||||
2
|
||||
),
|
||||
readOnly: true,
|
||||
collapsible: true,
|
||||
defaultCollapsed: true,
|
||||
mode: 'trigger',
|
||||
condition: {
|
||||
field: 'selectedTriggerId',
|
||||
value: 'hubspot_contact_restored',
|
||||
},
|
||||
},
|
||||
],
|
||||
|
||||
outputs: buildContactRestoredOutputs(),
|
||||
|
||||
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',
|
||||
},
|
||||
},
|
||||
}
|
||||
217
apps/sim/triggers/hubspot/deal_merged.ts
Normal file
217
apps/sim/triggers/hubspot/deal_merged.ts
Normal file
@@ -0,0 +1,217 @@
|
||||
import { HubspotIcon } from '@/components/icons'
|
||||
import {
|
||||
buildDealMergedOutputs,
|
||||
hubspotDealTriggerOptions,
|
||||
hubspotSetupInstructions,
|
||||
} from '@/triggers/hubspot/utils'
|
||||
import type { TriggerConfig } from '@/triggers/types'
|
||||
|
||||
export const hubspotDealMergedTrigger: TriggerConfig = {
|
||||
id: 'hubspot_deal_merged',
|
||||
name: 'HubSpot Deal Merged',
|
||||
provider: 'hubspot',
|
||||
description: 'Trigger workflow when deals are merged in HubSpot',
|
||||
version: '1.0.0',
|
||||
icon: HubspotIcon,
|
||||
|
||||
subBlocks: [
|
||||
{
|
||||
id: 'selectedTriggerId',
|
||||
title: 'Trigger Type',
|
||||
type: 'dropdown',
|
||||
mode: 'trigger',
|
||||
options: hubspotDealTriggerOptions,
|
||||
value: () => 'hubspot_deal_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_deal_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_deal_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_deal_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_deal_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_deal_merged',
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'triggerSave',
|
||||
title: '',
|
||||
type: 'trigger-save',
|
||||
mode: 'trigger',
|
||||
triggerId: 'hubspot_deal_merged',
|
||||
condition: {
|
||||
field: 'selectedTriggerId',
|
||||
value: 'hubspot_deal_merged',
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'triggerInstructions',
|
||||
title: 'Setup Instructions',
|
||||
type: 'text',
|
||||
defaultValue: hubspotSetupInstructions(
|
||||
'deal.merge',
|
||||
'The webhook will trigger whenever two deals are merged in your HubSpot account. The objectId will be the winning (primary) deal ID.'
|
||||
),
|
||||
mode: 'trigger',
|
||||
condition: {
|
||||
field: 'selectedTriggerId',
|
||||
value: 'hubspot_deal_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://api.hubapi.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_deal_merged',
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'curlCreateSubscription',
|
||||
title: '2. Create Webhook Subscription',
|
||||
type: 'code',
|
||||
language: 'javascript',
|
||||
defaultValue: `curl -X POST "https://api.hubapi.com/webhooks/v3/{YOUR_APP_ID}/subscriptions?hapikey={YOUR_DEVELOPER_API_KEY}" \\
|
||||
-H "Content-Type: application/json" \\
|
||||
-d '{
|
||||
"eventType": "deal.merge",
|
||||
"active": true
|
||||
}'`,
|
||||
readOnly: true,
|
||||
collapsible: true,
|
||||
defaultCollapsed: true,
|
||||
showCopyButton: true,
|
||||
description: 'Run this command to subscribe to deal merge events',
|
||||
mode: 'trigger',
|
||||
condition: {
|
||||
field: 'selectedTriggerId',
|
||||
value: 'hubspot_deal_merged',
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'samplePayload',
|
||||
title: 'Event Payload Example',
|
||||
type: 'code',
|
||||
language: 'json',
|
||||
defaultValue: JSON.stringify(
|
||||
[
|
||||
{
|
||||
eventId: 3181526815,
|
||||
subscriptionId: 4629976,
|
||||
portalId: 244315265,
|
||||
appId: 23608917,
|
||||
occurredAt: 1762659213730,
|
||||
subscriptionType: 'deal.merge',
|
||||
attemptNumber: 0,
|
||||
objectId: 416126906049,
|
||||
changeFlag: 'MERGED',
|
||||
changeSource: 'CRM_UI',
|
||||
sourceId: 'userId:84916424',
|
||||
mergedObjectIds: [416126906050],
|
||||
},
|
||||
],
|
||||
null,
|
||||
2
|
||||
),
|
||||
readOnly: true,
|
||||
collapsible: true,
|
||||
defaultCollapsed: true,
|
||||
mode: 'trigger',
|
||||
condition: {
|
||||
field: 'selectedTriggerId',
|
||||
value: 'hubspot_deal_merged',
|
||||
},
|
||||
},
|
||||
],
|
||||
|
||||
outputs: buildDealMergedOutputs(),
|
||||
|
||||
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',
|
||||
},
|
||||
},
|
||||
}
|
||||
216
apps/sim/triggers/hubspot/deal_restored.ts
Normal file
216
apps/sim/triggers/hubspot/deal_restored.ts
Normal file
@@ -0,0 +1,216 @@
|
||||
import { HubspotIcon } from '@/components/icons'
|
||||
import {
|
||||
buildDealRestoredOutputs,
|
||||
hubspotDealTriggerOptions,
|
||||
hubspotSetupInstructions,
|
||||
} from '@/triggers/hubspot/utils'
|
||||
import type { TriggerConfig } from '@/triggers/types'
|
||||
|
||||
export const hubspotDealRestoredTrigger: TriggerConfig = {
|
||||
id: 'hubspot_deal_restored',
|
||||
name: 'HubSpot Deal Restored',
|
||||
provider: 'hubspot',
|
||||
description: 'Trigger workflow when a deleted deal is restored in HubSpot',
|
||||
version: '1.0.0',
|
||||
icon: HubspotIcon,
|
||||
|
||||
subBlocks: [
|
||||
{
|
||||
id: 'selectedTriggerId',
|
||||
title: 'Trigger Type',
|
||||
type: 'dropdown',
|
||||
mode: 'trigger',
|
||||
options: hubspotDealTriggerOptions,
|
||||
value: () => 'hubspot_deal_restored',
|
||||
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_deal_restored',
|
||||
},
|
||||
},
|
||||
{
|
||||
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_deal_restored',
|
||||
},
|
||||
},
|
||||
{
|
||||
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_deal_restored',
|
||||
},
|
||||
},
|
||||
{
|
||||
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_deal_restored',
|
||||
},
|
||||
},
|
||||
{
|
||||
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_deal_restored',
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'triggerSave',
|
||||
title: '',
|
||||
type: 'trigger-save',
|
||||
mode: 'trigger',
|
||||
triggerId: 'hubspot_deal_restored',
|
||||
condition: {
|
||||
field: 'selectedTriggerId',
|
||||
value: 'hubspot_deal_restored',
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'triggerInstructions',
|
||||
title: 'Setup Instructions',
|
||||
type: 'text',
|
||||
defaultValue: hubspotSetupInstructions(
|
||||
'deal.restore',
|
||||
'The webhook will trigger whenever a previously deleted deal is restored in your HubSpot account.'
|
||||
),
|
||||
mode: 'trigger',
|
||||
condition: {
|
||||
field: 'selectedTriggerId',
|
||||
value: 'hubspot_deal_restored',
|
||||
},
|
||||
},
|
||||
{
|
||||
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://api.hubapi.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_deal_restored',
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'curlCreateSubscription',
|
||||
title: '2. Create Webhook Subscription',
|
||||
type: 'code',
|
||||
language: 'javascript',
|
||||
defaultValue: `curl -X POST "https://api.hubapi.com/webhooks/v3/{YOUR_APP_ID}/subscriptions?hapikey={YOUR_DEVELOPER_API_KEY}" \\
|
||||
-H "Content-Type: application/json" \\
|
||||
-d '{
|
||||
"eventType": "deal.restore",
|
||||
"active": true
|
||||
}'`,
|
||||
readOnly: true,
|
||||
collapsible: true,
|
||||
defaultCollapsed: true,
|
||||
showCopyButton: true,
|
||||
description: 'Run this command to subscribe to deal restore events',
|
||||
mode: 'trigger',
|
||||
condition: {
|
||||
field: 'selectedTriggerId',
|
||||
value: 'hubspot_deal_restored',
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'samplePayload',
|
||||
title: 'Event Payload Example',
|
||||
type: 'code',
|
||||
language: 'json',
|
||||
defaultValue: JSON.stringify(
|
||||
[
|
||||
{
|
||||
eventId: 3181526816,
|
||||
subscriptionId: 4629977,
|
||||
portalId: 244315265,
|
||||
appId: 23608917,
|
||||
occurredAt: 1762659213730,
|
||||
subscriptionType: 'deal.restore',
|
||||
attemptNumber: 0,
|
||||
objectId: 416126906049,
|
||||
changeFlag: 'RESTORED',
|
||||
changeSource: 'CRM_UI',
|
||||
sourceId: 'userId:84916424',
|
||||
},
|
||||
],
|
||||
null,
|
||||
2
|
||||
),
|
||||
readOnly: true,
|
||||
collapsible: true,
|
||||
defaultCollapsed: true,
|
||||
mode: 'trigger',
|
||||
condition: {
|
||||
field: 'selectedTriggerId',
|
||||
value: 'hubspot_deal_restored',
|
||||
},
|
||||
},
|
||||
],
|
||||
|
||||
outputs: buildDealRestoredOutputs(),
|
||||
|
||||
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',
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -1,10 +1,14 @@
|
||||
export { hubspotCompanyCreatedTrigger } from './company_created'
|
||||
export { hubspotCompanyDeletedTrigger } from './company_deleted'
|
||||
export { hubspotCompanyMergedTrigger } from './company_merged'
|
||||
export { hubspotCompanyPropertyChangedTrigger } from './company_property_changed'
|
||||
export { hubspotCompanyRestoredTrigger } from './company_restored'
|
||||
export { hubspotContactCreatedTrigger } from './contact_created'
|
||||
export { hubspotContactDeletedTrigger } from './contact_deleted'
|
||||
export { hubspotContactMergedTrigger } from './contact_merged'
|
||||
export { hubspotContactPrivacyDeletedTrigger } from './contact_privacy_deleted'
|
||||
export { hubspotContactPropertyChangedTrigger } from './contact_property_changed'
|
||||
export { hubspotContactRestoredTrigger } from './contact_restored'
|
||||
export { hubspotConversationCreationTrigger } from './conversation_creation'
|
||||
export { hubspotConversationDeletionTrigger } from './conversation_deletion'
|
||||
export { hubspotConversationNewMessageTrigger } from './conversation_new_message'
|
||||
@@ -12,8 +16,13 @@ export { hubspotConversationPrivacyDeletionTrigger } from './conversation_privac
|
||||
export { hubspotConversationPropertyChangedTrigger } from './conversation_property_changed'
|
||||
export { hubspotDealCreatedTrigger } from './deal_created'
|
||||
export { hubspotDealDeletedTrigger } from './deal_deleted'
|
||||
export { hubspotDealMergedTrigger } from './deal_merged'
|
||||
export { hubspotDealPropertyChangedTrigger } from './deal_property_changed'
|
||||
export { hubspotDealRestoredTrigger } from './deal_restored'
|
||||
export { hubspotTicketCreatedTrigger } from './ticket_created'
|
||||
export { hubspotTicketDeletedTrigger } from './ticket_deleted'
|
||||
export { hubspotTicketMergedTrigger } from './ticket_merged'
|
||||
export { hubspotTicketPropertyChangedTrigger } from './ticket_property_changed'
|
||||
export { hubspotTicketRestoredTrigger } from './ticket_restored'
|
||||
export { hubspotAllTriggerOptions, isHubSpotContactEventMatch } from './utils'
|
||||
export { hubspotWebhookTrigger } from './webhook'
|
||||
|
||||
217
apps/sim/triggers/hubspot/ticket_merged.ts
Normal file
217
apps/sim/triggers/hubspot/ticket_merged.ts
Normal file
@@ -0,0 +1,217 @@
|
||||
import { HubspotIcon } from '@/components/icons'
|
||||
import {
|
||||
buildTicketMergedOutputs,
|
||||
hubspotSetupInstructions,
|
||||
hubspotTicketTriggerOptions,
|
||||
} from '@/triggers/hubspot/utils'
|
||||
import type { TriggerConfig } from '@/triggers/types'
|
||||
|
||||
export const hubspotTicketMergedTrigger: TriggerConfig = {
|
||||
id: 'hubspot_ticket_merged',
|
||||
name: 'HubSpot Ticket Merged',
|
||||
provider: 'hubspot',
|
||||
description: 'Trigger workflow when tickets are merged in HubSpot',
|
||||
version: '1.0.0',
|
||||
icon: HubspotIcon,
|
||||
|
||||
subBlocks: [
|
||||
{
|
||||
id: 'selectedTriggerId',
|
||||
title: 'Trigger Type',
|
||||
type: 'dropdown',
|
||||
mode: 'trigger',
|
||||
options: hubspotTicketTriggerOptions,
|
||||
value: () => 'hubspot_ticket_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_ticket_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_ticket_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_ticket_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_ticket_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_ticket_merged',
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'triggerSave',
|
||||
title: '',
|
||||
type: 'trigger-save',
|
||||
mode: 'trigger',
|
||||
triggerId: 'hubspot_ticket_merged',
|
||||
condition: {
|
||||
field: 'selectedTriggerId',
|
||||
value: 'hubspot_ticket_merged',
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'triggerInstructions',
|
||||
title: 'Setup Instructions',
|
||||
type: 'text',
|
||||
defaultValue: hubspotSetupInstructions(
|
||||
'ticket.merge',
|
||||
'The webhook will trigger whenever two tickets are merged in your HubSpot account. The objectId will be the winning (primary) ticket ID.'
|
||||
),
|
||||
mode: 'trigger',
|
||||
condition: {
|
||||
field: 'selectedTriggerId',
|
||||
value: 'hubspot_ticket_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://api.hubapi.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_ticket_merged',
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'curlCreateSubscription',
|
||||
title: '2. Create Webhook Subscription',
|
||||
type: 'code',
|
||||
language: 'javascript',
|
||||
defaultValue: `curl -X POST "https://api.hubapi.com/webhooks/v3/{YOUR_APP_ID}/subscriptions?hapikey={YOUR_DEVELOPER_API_KEY}" \\
|
||||
-H "Content-Type: application/json" \\
|
||||
-d '{
|
||||
"eventType": "ticket.merge",
|
||||
"active": true
|
||||
}'`,
|
||||
readOnly: true,
|
||||
collapsible: true,
|
||||
defaultCollapsed: true,
|
||||
showCopyButton: true,
|
||||
description: 'Run this command to subscribe to ticket merge events',
|
||||
mode: 'trigger',
|
||||
condition: {
|
||||
field: 'selectedTriggerId',
|
||||
value: 'hubspot_ticket_merged',
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'samplePayload',
|
||||
title: 'Event Payload Example',
|
||||
type: 'code',
|
||||
language: 'json',
|
||||
defaultValue: JSON.stringify(
|
||||
[
|
||||
{
|
||||
eventId: 3181526817,
|
||||
subscriptionId: 4629978,
|
||||
portalId: 244315265,
|
||||
appId: 23608917,
|
||||
occurredAt: 1762659213730,
|
||||
subscriptionType: 'ticket.merge',
|
||||
attemptNumber: 0,
|
||||
objectId: 516126906049,
|
||||
changeFlag: 'MERGED',
|
||||
changeSource: 'CRM_UI',
|
||||
sourceId: 'userId:84916424',
|
||||
mergedObjectIds: [516126906050],
|
||||
},
|
||||
],
|
||||
null,
|
||||
2
|
||||
),
|
||||
readOnly: true,
|
||||
collapsible: true,
|
||||
defaultCollapsed: true,
|
||||
mode: 'trigger',
|
||||
condition: {
|
||||
field: 'selectedTriggerId',
|
||||
value: 'hubspot_ticket_merged',
|
||||
},
|
||||
},
|
||||
],
|
||||
|
||||
outputs: buildTicketMergedOutputs(),
|
||||
|
||||
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',
|
||||
},
|
||||
},
|
||||
}
|
||||
216
apps/sim/triggers/hubspot/ticket_restored.ts
Normal file
216
apps/sim/triggers/hubspot/ticket_restored.ts
Normal file
@@ -0,0 +1,216 @@
|
||||
import { HubspotIcon } from '@/components/icons'
|
||||
import {
|
||||
buildTicketRestoredOutputs,
|
||||
hubspotSetupInstructions,
|
||||
hubspotTicketTriggerOptions,
|
||||
} from '@/triggers/hubspot/utils'
|
||||
import type { TriggerConfig } from '@/triggers/types'
|
||||
|
||||
export const hubspotTicketRestoredTrigger: TriggerConfig = {
|
||||
id: 'hubspot_ticket_restored',
|
||||
name: 'HubSpot Ticket Restored',
|
||||
provider: 'hubspot',
|
||||
description: 'Trigger workflow when a deleted ticket is restored in HubSpot',
|
||||
version: '1.0.0',
|
||||
icon: HubspotIcon,
|
||||
|
||||
subBlocks: [
|
||||
{
|
||||
id: 'selectedTriggerId',
|
||||
title: 'Trigger Type',
|
||||
type: 'dropdown',
|
||||
mode: 'trigger',
|
||||
options: hubspotTicketTriggerOptions,
|
||||
value: () => 'hubspot_ticket_restored',
|
||||
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_ticket_restored',
|
||||
},
|
||||
},
|
||||
{
|
||||
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_ticket_restored',
|
||||
},
|
||||
},
|
||||
{
|
||||
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_ticket_restored',
|
||||
},
|
||||
},
|
||||
{
|
||||
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_ticket_restored',
|
||||
},
|
||||
},
|
||||
{
|
||||
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_ticket_restored',
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'triggerSave',
|
||||
title: '',
|
||||
type: 'trigger-save',
|
||||
mode: 'trigger',
|
||||
triggerId: 'hubspot_ticket_restored',
|
||||
condition: {
|
||||
field: 'selectedTriggerId',
|
||||
value: 'hubspot_ticket_restored',
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'triggerInstructions',
|
||||
title: 'Setup Instructions',
|
||||
type: 'text',
|
||||
defaultValue: hubspotSetupInstructions(
|
||||
'ticket.restore',
|
||||
'The webhook will trigger whenever a previously deleted ticket is restored in your HubSpot account.'
|
||||
),
|
||||
mode: 'trigger',
|
||||
condition: {
|
||||
field: 'selectedTriggerId',
|
||||
value: 'hubspot_ticket_restored',
|
||||
},
|
||||
},
|
||||
{
|
||||
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://api.hubapi.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_ticket_restored',
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'curlCreateSubscription',
|
||||
title: '2. Create Webhook Subscription',
|
||||
type: 'code',
|
||||
language: 'javascript',
|
||||
defaultValue: `curl -X POST "https://api.hubapi.com/webhooks/v3/{YOUR_APP_ID}/subscriptions?hapikey={YOUR_DEVELOPER_API_KEY}" \\
|
||||
-H "Content-Type: application/json" \\
|
||||
-d '{
|
||||
"eventType": "ticket.restore",
|
||||
"active": true
|
||||
}'`,
|
||||
readOnly: true,
|
||||
collapsible: true,
|
||||
defaultCollapsed: true,
|
||||
showCopyButton: true,
|
||||
description: 'Run this command to subscribe to ticket restore events',
|
||||
mode: 'trigger',
|
||||
condition: {
|
||||
field: 'selectedTriggerId',
|
||||
value: 'hubspot_ticket_restored',
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'samplePayload',
|
||||
title: 'Event Payload Example',
|
||||
type: 'code',
|
||||
language: 'json',
|
||||
defaultValue: JSON.stringify(
|
||||
[
|
||||
{
|
||||
eventId: 3181526818,
|
||||
subscriptionId: 4629979,
|
||||
portalId: 244315265,
|
||||
appId: 23608917,
|
||||
occurredAt: 1762659213730,
|
||||
subscriptionType: 'ticket.restore',
|
||||
attemptNumber: 0,
|
||||
objectId: 516126906049,
|
||||
changeFlag: 'RESTORED',
|
||||
changeSource: 'CRM_UI',
|
||||
sourceId: 'userId:84916424',
|
||||
},
|
||||
],
|
||||
null,
|
||||
2
|
||||
),
|
||||
readOnly: true,
|
||||
collapsible: true,
|
||||
defaultCollapsed: true,
|
||||
mode: 'trigger',
|
||||
condition: {
|
||||
field: 'selectedTriggerId',
|
||||
value: 'hubspot_ticket_restored',
|
||||
},
|
||||
},
|
||||
],
|
||||
|
||||
outputs: buildTicketRestoredOutputs(),
|
||||
|
||||
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',
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -6,11 +6,15 @@ import type { TriggerOutput } from '@/triggers/types'
|
||||
export const hubspotAllTriggerOptions = [
|
||||
{ label: 'Contact Created', id: 'hubspot_contact_created' },
|
||||
{ label: 'Contact Deleted', id: 'hubspot_contact_deleted' },
|
||||
{ label: 'Contact Merged', id: 'hubspot_contact_merged' },
|
||||
{ label: 'Contact Privacy Deleted', id: 'hubspot_contact_privacy_deleted' },
|
||||
{ label: 'Contact Property Changed', id: 'hubspot_contact_property_changed' },
|
||||
{ label: 'Contact Restored', id: 'hubspot_contact_restored' },
|
||||
{ label: 'Company Created', id: 'hubspot_company_created' },
|
||||
{ label: 'Company Deleted', id: 'hubspot_company_deleted' },
|
||||
{ label: 'Company Merged', id: 'hubspot_company_merged' },
|
||||
{ label: 'Company Property Changed', id: 'hubspot_company_property_changed' },
|
||||
{ label: 'Company Restored', id: 'hubspot_company_restored' },
|
||||
{ label: 'Conversation Creation', id: 'hubspot_conversation_creation' },
|
||||
{ label: 'Conversation Deletion', id: 'hubspot_conversation_deletion' },
|
||||
{ label: 'Conversation New Message', id: 'hubspot_conversation_new_message' },
|
||||
@@ -18,10 +22,15 @@ export const hubspotAllTriggerOptions = [
|
||||
{ label: 'Conversation Property Changed', id: 'hubspot_conversation_property_changed' },
|
||||
{ label: 'Deal Created', id: 'hubspot_deal_created' },
|
||||
{ label: 'Deal Deleted', id: 'hubspot_deal_deleted' },
|
||||
{ label: 'Deal Merged', id: 'hubspot_deal_merged' },
|
||||
{ label: 'Deal Property Changed', id: 'hubspot_deal_property_changed' },
|
||||
{ label: 'Deal Restored', id: 'hubspot_deal_restored' },
|
||||
{ label: 'Ticket Created', id: 'hubspot_ticket_created' },
|
||||
{ label: 'Ticket Deleted', id: 'hubspot_ticket_deleted' },
|
||||
{ label: 'Ticket Merged', id: 'hubspot_ticket_merged' },
|
||||
{ label: 'Ticket Property Changed', id: 'hubspot_ticket_property_changed' },
|
||||
{ label: 'Ticket Restored', id: 'hubspot_ticket_restored' },
|
||||
{ label: 'Generic Webhook (All Events)', id: 'hubspot_webhook' },
|
||||
]
|
||||
|
||||
/**
|
||||
@@ -30,8 +39,10 @@ export const hubspotAllTriggerOptions = [
|
||||
export const hubspotContactTriggerOptions = [
|
||||
{ label: 'Contact Created', id: 'hubspot_contact_created' },
|
||||
{ label: 'Contact Deleted', id: 'hubspot_contact_deleted' },
|
||||
{ label: 'Contact Merged', id: 'hubspot_contact_merged' },
|
||||
{ label: 'Contact Privacy Deleted', id: 'hubspot_contact_privacy_deleted' },
|
||||
{ label: 'Contact Property Changed', id: 'hubspot_contact_property_changed' },
|
||||
{ label: 'Contact Restored', id: 'hubspot_contact_restored' },
|
||||
]
|
||||
|
||||
/**
|
||||
@@ -40,7 +51,9 @@ export const hubspotContactTriggerOptions = [
|
||||
export const hubspotCompanyTriggerOptions = [
|
||||
{ label: 'Company Created', id: 'hubspot_company_created' },
|
||||
{ label: 'Company Deleted', id: 'hubspot_company_deleted' },
|
||||
{ label: 'Company Merged', id: 'hubspot_company_merged' },
|
||||
{ label: 'Company Property Changed', id: 'hubspot_company_property_changed' },
|
||||
{ label: 'Company Restored', id: 'hubspot_company_restored' },
|
||||
]
|
||||
|
||||
/**
|
||||
@@ -60,7 +73,9 @@ export const hubspotConversationTriggerOptions = [
|
||||
export const hubspotDealTriggerOptions = [
|
||||
{ label: 'Deal Created', id: 'hubspot_deal_created' },
|
||||
{ label: 'Deal Deleted', id: 'hubspot_deal_deleted' },
|
||||
{ label: 'Deal Merged', id: 'hubspot_deal_merged' },
|
||||
{ label: 'Deal Property Changed', id: 'hubspot_deal_property_changed' },
|
||||
{ label: 'Deal Restored', id: 'hubspot_deal_restored' },
|
||||
]
|
||||
|
||||
/**
|
||||
@@ -69,19 +84,34 @@ export const hubspotDealTriggerOptions = [
|
||||
export const hubspotTicketTriggerOptions = [
|
||||
{ label: 'Ticket Created', id: 'hubspot_ticket_created' },
|
||||
{ label: 'Ticket Deleted', id: 'hubspot_ticket_deleted' },
|
||||
{ label: 'Ticket Merged', id: 'hubspot_ticket_merged' },
|
||||
{ label: 'Ticket Property Changed', id: 'hubspot_ticket_property_changed' },
|
||||
{ label: 'Ticket Restored', id: 'hubspot_ticket_restored' },
|
||||
]
|
||||
|
||||
/**
|
||||
* Derives the required OAuth scope from a HubSpot event type
|
||||
*/
|
||||
function getScopeForEventType(eventType: string): string {
|
||||
if (eventType.startsWith('company')) return 'crm.objects.companies.read'
|
||||
if (eventType.startsWith('deal')) return 'crm.objects.deals.read'
|
||||
if (eventType.startsWith('ticket')) return 'tickets'
|
||||
if (eventType === 'All Events')
|
||||
return 'crm.objects.contacts.read, crm.objects.companies.read, crm.objects.deals.read, tickets'
|
||||
return 'crm.objects.contacts.read'
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate setup instructions for a specific HubSpot event type
|
||||
*/
|
||||
export function hubspotSetupInstructions(eventType: string, additionalNotes?: string): string {
|
||||
const scope = getScopeForEventType(eventType)
|
||||
const instructions = [
|
||||
'<strong>Step 1: Create a HubSpot Developer Account</strong><br/>Sign up for a free developer account at <a href="https://developers.hubspot.com" target="_blank">developers.hubspot.com</a> if you don\'t have one.',
|
||||
'<strong>Step 2: Create a Public App via CLI</strong><br/><strong>Note:</strong> HubSpot has deprecated the web UI for creating apps. You must use the HubSpot CLI to create and manage apps. Install the CLI with <code>npm install -g @hubspot/cli</code> and run <code>hs project create</code> to create a new app. See <a href="https://developers.hubspot.com/docs/platform/create-an-app" target="_blank">HubSpot\'s documentation</a> for details.',
|
||||
'<strong>Step 3: Configure OAuth Settings</strong><br/>After creating your app via CLI, configure it to add the OAuth Redirect URL: <code>https://www.sim.ai/api/auth/oauth2/callback/hubspot</code>. Then retrieve your <strong>Client ID</strong> and <strong>Client Secret</strong> from your app configuration and enter them in the fields above.',
|
||||
"<strong>Step 4: Get App ID and Developer API Key</strong><br/>In your HubSpot developer account, find your <strong>App ID</strong> (shown below your app name) and your <strong>Developer API Key</strong> (in app settings). You'll need both for the next steps.",
|
||||
'<strong>Step 5: Set Required Scopes</strong><br/>Configure your app to include the required OAuth scope: <code>crm.objects.contacts.read</code>',
|
||||
`<strong>Step 5: Set Required Scopes</strong><br/>Configure your app to include the required OAuth scope(s): <code>${scope}</code>`,
|
||||
'<strong>Step 6: Configure Webhook in HubSpot via API</strong><br/>After saving above, copy the <strong>Webhook URL</strong> and run the two curl commands below (replace <code>{YOUR_APP_ID}</code>, <code>{YOUR_DEVELOPER_API_KEY}</code>, and <code>{YOUR_WEBHOOK_URL_FROM_ABOVE}</code> with your actual values).',
|
||||
"<strong>Step 7: Test Your Webhook</strong><br/>Create or modify a contact in HubSpot to trigger the webhook. Check your workflow execution logs in Sim to verify it's working.",
|
||||
]
|
||||
@@ -172,6 +202,76 @@ function buildBaseHubSpotOutputs(): Record<string, TriggerOutput> {
|
||||
} as any
|
||||
}
|
||||
|
||||
/**
|
||||
* Merge-specific webhook outputs that include mergedObjectIds
|
||||
*/
|
||||
function buildMergeHubSpotOutputs(): Record<string, TriggerOutput> {
|
||||
return {
|
||||
payload: {
|
||||
type: 'array',
|
||||
description: 'Full webhook payload array from HubSpot containing merge event details',
|
||||
items: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
objectId: { type: 'number', description: 'HubSpot object ID (winning/primary record)' },
|
||||
subscriptionType: { type: 'string', description: 'Type of subscription event' },
|
||||
portalId: { type: 'number', description: 'HubSpot portal ID' },
|
||||
occurredAt: { type: 'number', description: 'Timestamp when event occurred (ms)' },
|
||||
attemptNumber: { type: 'number', description: 'Webhook delivery attempt number' },
|
||||
eventId: { type: 'number', description: 'Event ID' },
|
||||
changeSource: { type: 'string', description: 'Source of the change' },
|
||||
mergedObjectIds: {
|
||||
type: 'array',
|
||||
description: 'IDs of the objects that were merged into the primary record',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
provider: {
|
||||
type: 'string',
|
||||
description: 'Provider name (hubspot)',
|
||||
},
|
||||
providerConfig: {
|
||||
type: 'object',
|
||||
description: 'Provider configuration',
|
||||
properties: {
|
||||
appId: {
|
||||
type: 'string',
|
||||
description: 'HubSpot App ID',
|
||||
},
|
||||
clientId: {
|
||||
type: 'string',
|
||||
description: 'HubSpot Client ID',
|
||||
},
|
||||
triggerId: {
|
||||
type: 'string',
|
||||
description: 'Trigger ID (e.g., hubspot_contact_merged)',
|
||||
},
|
||||
clientSecret: {
|
||||
type: 'string',
|
||||
description: 'HubSpot Client Secret',
|
||||
},
|
||||
developerApiKey: {
|
||||
type: 'string',
|
||||
description: 'HubSpot Developer API Key',
|
||||
},
|
||||
curlSetWebhookUrl: {
|
||||
type: 'string',
|
||||
description: 'curl command to set webhook URL',
|
||||
},
|
||||
curlCreateSubscription: {
|
||||
type: 'string',
|
||||
description: 'curl command to create subscription',
|
||||
},
|
||||
webhookUrlDisplay: {
|
||||
type: 'string',
|
||||
description: 'Webhook URL display value',
|
||||
},
|
||||
},
|
||||
},
|
||||
} as any
|
||||
}
|
||||
|
||||
/**
|
||||
* Build output schema for contact creation events
|
||||
*/
|
||||
@@ -200,6 +300,20 @@ export function buildContactPropertyChangedOutputs(): Record<string, TriggerOutp
|
||||
return buildBaseHubSpotOutputs()
|
||||
}
|
||||
|
||||
/**
|
||||
* Build output schema for contact merge events
|
||||
*/
|
||||
export function buildContactMergedOutputs(): Record<string, TriggerOutput> {
|
||||
return buildMergeHubSpotOutputs()
|
||||
}
|
||||
|
||||
/**
|
||||
* Build output schema for contact restore events
|
||||
*/
|
||||
export function buildContactRestoredOutputs(): Record<string, TriggerOutput> {
|
||||
return buildBaseHubSpotOutputs()
|
||||
}
|
||||
|
||||
/**
|
||||
* Build output schema for company creation events
|
||||
*/
|
||||
@@ -221,6 +335,20 @@ export function buildCompanyPropertyChangedOutputs(): Record<string, TriggerOutp
|
||||
return buildBaseHubSpotOutputs()
|
||||
}
|
||||
|
||||
/**
|
||||
* Build output schema for company merge events
|
||||
*/
|
||||
export function buildCompanyMergedOutputs(): Record<string, TriggerOutput> {
|
||||
return buildMergeHubSpotOutputs()
|
||||
}
|
||||
|
||||
/**
|
||||
* Build output schema for company restore events
|
||||
*/
|
||||
export function buildCompanyRestoredOutputs(): Record<string, TriggerOutput> {
|
||||
return buildBaseHubSpotOutputs()
|
||||
}
|
||||
|
||||
/**
|
||||
* Build output schema for conversation creation events
|
||||
*/
|
||||
@@ -277,6 +405,20 @@ export function buildDealPropertyChangedOutputs(): Record<string, TriggerOutput>
|
||||
return buildBaseHubSpotOutputs()
|
||||
}
|
||||
|
||||
/**
|
||||
* Build output schema for deal merge events
|
||||
*/
|
||||
export function buildDealMergedOutputs(): Record<string, TriggerOutput> {
|
||||
return buildMergeHubSpotOutputs()
|
||||
}
|
||||
|
||||
/**
|
||||
* Build output schema for deal restore events
|
||||
*/
|
||||
export function buildDealRestoredOutputs(): Record<string, TriggerOutput> {
|
||||
return buildBaseHubSpotOutputs()
|
||||
}
|
||||
|
||||
/**
|
||||
* Build output schema for ticket creation events
|
||||
*/
|
||||
@@ -298,6 +440,27 @@ export function buildTicketPropertyChangedOutputs(): Record<string, TriggerOutpu
|
||||
return buildBaseHubSpotOutputs()
|
||||
}
|
||||
|
||||
/**
|
||||
* Build output schema for ticket merge events
|
||||
*/
|
||||
export function buildTicketMergedOutputs(): Record<string, TriggerOutput> {
|
||||
return buildMergeHubSpotOutputs()
|
||||
}
|
||||
|
||||
/**
|
||||
* Build output schema for ticket restore events
|
||||
*/
|
||||
export function buildTicketRestoredOutputs(): Record<string, TriggerOutput> {
|
||||
return buildBaseHubSpotOutputs()
|
||||
}
|
||||
|
||||
/**
|
||||
* Build output schema for generic webhook events
|
||||
*/
|
||||
export function buildWebhookOutputs(): Record<string, TriggerOutput> {
|
||||
return buildBaseHubSpotOutputs()
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a HubSpot event matches the expected trigger configuration
|
||||
*/
|
||||
@@ -305,11 +468,15 @@ export function isHubSpotContactEventMatch(triggerId: string, eventType: string)
|
||||
const eventMap: Record<string, string> = {
|
||||
hubspot_contact_created: 'contact.creation',
|
||||
hubspot_contact_deleted: 'contact.deletion',
|
||||
hubspot_contact_merged: 'contact.merge',
|
||||
hubspot_contact_privacy_deleted: 'contact.privacyDeletion',
|
||||
hubspot_contact_property_changed: 'contact.propertyChange',
|
||||
hubspot_contact_restored: 'contact.restore',
|
||||
hubspot_company_created: 'company.creation',
|
||||
hubspot_company_deleted: 'company.deletion',
|
||||
hubspot_company_merged: 'company.merge',
|
||||
hubspot_company_property_changed: 'company.propertyChange',
|
||||
hubspot_company_restored: 'company.restore',
|
||||
hubspot_conversation_creation: 'conversation.creation',
|
||||
hubspot_conversation_deletion: 'conversation.deletion',
|
||||
hubspot_conversation_new_message: 'conversation.newMessage',
|
||||
@@ -317,10 +484,14 @@ export function isHubSpotContactEventMatch(triggerId: string, eventType: string)
|
||||
hubspot_conversation_property_changed: 'conversation.propertyChange',
|
||||
hubspot_deal_created: 'deal.creation',
|
||||
hubspot_deal_deleted: 'deal.deletion',
|
||||
hubspot_deal_merged: 'deal.merge',
|
||||
hubspot_deal_property_changed: 'deal.propertyChange',
|
||||
hubspot_deal_restored: 'deal.restore',
|
||||
hubspot_ticket_created: 'ticket.creation',
|
||||
hubspot_ticket_deleted: 'ticket.deletion',
|
||||
hubspot_ticket_merged: 'ticket.merge',
|
||||
hubspot_ticket_property_changed: 'ticket.propertyChange',
|
||||
hubspot_ticket_restored: 'ticket.restore',
|
||||
}
|
||||
|
||||
const expectedEventType = eventMap[triggerId]
|
||||
|
||||
223
apps/sim/triggers/hubspot/webhook.ts
Normal file
223
apps/sim/triggers/hubspot/webhook.ts
Normal file
@@ -0,0 +1,223 @@
|
||||
import { HubspotIcon } from '@/components/icons'
|
||||
import {
|
||||
buildWebhookOutputs,
|
||||
hubspotAllTriggerOptions,
|
||||
hubspotSetupInstructions,
|
||||
} from '@/triggers/hubspot/utils'
|
||||
import type { TriggerConfig } from '@/triggers/types'
|
||||
|
||||
export const hubspotWebhookTrigger: TriggerConfig = {
|
||||
id: 'hubspot_webhook',
|
||||
name: 'HubSpot Webhook (All Events)',
|
||||
provider: 'hubspot',
|
||||
description: 'Trigger workflow on any HubSpot webhook event',
|
||||
version: '1.0.0',
|
||||
icon: HubspotIcon,
|
||||
|
||||
subBlocks: [
|
||||
{
|
||||
id: 'selectedTriggerId',
|
||||
title: 'Trigger Type',
|
||||
type: 'dropdown',
|
||||
mode: 'trigger',
|
||||
options: hubspotAllTriggerOptions,
|
||||
value: () => 'hubspot_webhook',
|
||||
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_webhook',
|
||||
},
|
||||
},
|
||||
{
|
||||
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_webhook',
|
||||
},
|
||||
},
|
||||
{
|
||||
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_webhook',
|
||||
},
|
||||
},
|
||||
{
|
||||
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_webhook',
|
||||
},
|
||||
},
|
||||
{
|
||||
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_webhook',
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'triggerSave',
|
||||
title: '',
|
||||
type: 'trigger-save',
|
||||
mode: 'trigger',
|
||||
triggerId: 'hubspot_webhook',
|
||||
condition: {
|
||||
field: 'selectedTriggerId',
|
||||
value: 'hubspot_webhook',
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'triggerInstructions',
|
||||
title: 'Setup Instructions',
|
||||
type: 'text',
|
||||
defaultValue: hubspotSetupInstructions(
|
||||
'All Events',
|
||||
'This generic webhook trigger will accept all HubSpot webhook events. Create subscriptions for each event type you want to receive using the curl command below (changing the eventType parameter).'
|
||||
),
|
||||
mode: 'trigger',
|
||||
condition: {
|
||||
field: 'selectedTriggerId',
|
||||
value: 'hubspot_webhook',
|
||||
},
|
||||
},
|
||||
{
|
||||
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://api.hubapi.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_webhook',
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'curlCreateSubscription',
|
||||
title: '2. Create Webhook Subscription',
|
||||
type: 'code',
|
||||
language: 'javascript',
|
||||
defaultValue: `# Create subscriptions for each event type you want to receive.
|
||||
# Replace {eventType} with: contact.creation, contact.deletion, contact.propertyChange,
|
||||
# contact.merge, contact.restore, company.creation, company.deletion, company.propertyChange,
|
||||
# company.merge, company.restore, deal.creation, deal.deletion, deal.propertyChange,
|
||||
# deal.merge, deal.restore, ticket.creation, ticket.deletion, ticket.propertyChange,
|
||||
# ticket.merge, ticket.restore, etc.
|
||||
|
||||
curl -X POST "https://api.hubapi.com/webhooks/v3/{YOUR_APP_ID}/subscriptions?hapikey={YOUR_DEVELOPER_API_KEY}" \\
|
||||
-H "Content-Type: application/json" \\
|
||||
-d '{
|
||||
"eventType": "{eventType}",
|
||||
"active": true
|
||||
}'`,
|
||||
readOnly: true,
|
||||
collapsible: true,
|
||||
defaultCollapsed: true,
|
||||
showCopyButton: true,
|
||||
description: 'Run this command for each event type you want to subscribe to',
|
||||
mode: 'trigger',
|
||||
condition: {
|
||||
field: 'selectedTriggerId',
|
||||
value: 'hubspot_webhook',
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'samplePayload',
|
||||
title: 'Event Payload Example',
|
||||
type: 'code',
|
||||
language: 'json',
|
||||
defaultValue: JSON.stringify(
|
||||
[
|
||||
{
|
||||
eventId: 3181526809,
|
||||
subscriptionId: 4629970,
|
||||
portalId: 244315265,
|
||||
appId: 23608917,
|
||||
occurredAt: 1762659213730,
|
||||
subscriptionType: 'contact.creation',
|
||||
attemptNumber: 0,
|
||||
objectId: 316126906049,
|
||||
changeFlag: 'CREATED',
|
||||
changeSource: 'CRM_UI',
|
||||
sourceId: 'userId:84916424',
|
||||
},
|
||||
],
|
||||
null,
|
||||
2
|
||||
),
|
||||
readOnly: true,
|
||||
collapsible: true,
|
||||
defaultCollapsed: true,
|
||||
mode: 'trigger',
|
||||
condition: {
|
||||
field: 'selectedTriggerId',
|
||||
value: 'hubspot_webhook',
|
||||
},
|
||||
},
|
||||
],
|
||||
|
||||
outputs: buildWebhookOutputs(),
|
||||
|
||||
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',
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -103,11 +103,15 @@ import {
|
||||
import {
|
||||
hubspotCompanyCreatedTrigger,
|
||||
hubspotCompanyDeletedTrigger,
|
||||
hubspotCompanyMergedTrigger,
|
||||
hubspotCompanyPropertyChangedTrigger,
|
||||
hubspotCompanyRestoredTrigger,
|
||||
hubspotContactCreatedTrigger,
|
||||
hubspotContactDeletedTrigger,
|
||||
hubspotContactMergedTrigger,
|
||||
hubspotContactPrivacyDeletedTrigger,
|
||||
hubspotContactPropertyChangedTrigger,
|
||||
hubspotContactRestoredTrigger,
|
||||
hubspotConversationCreationTrigger,
|
||||
hubspotConversationDeletionTrigger,
|
||||
hubspotConversationNewMessageTrigger,
|
||||
@@ -115,10 +119,15 @@ import {
|
||||
hubspotConversationPropertyChangedTrigger,
|
||||
hubspotDealCreatedTrigger,
|
||||
hubspotDealDeletedTrigger,
|
||||
hubspotDealMergedTrigger,
|
||||
hubspotDealPropertyChangedTrigger,
|
||||
hubspotDealRestoredTrigger,
|
||||
hubspotTicketCreatedTrigger,
|
||||
hubspotTicketDeletedTrigger,
|
||||
hubspotTicketMergedTrigger,
|
||||
hubspotTicketPropertyChangedTrigger,
|
||||
hubspotTicketRestoredTrigger,
|
||||
hubspotWebhookTrigger,
|
||||
} from '@/triggers/hubspot'
|
||||
import { imapPollingTrigger } from '@/triggers/imap'
|
||||
import {
|
||||
@@ -325,11 +334,15 @@ export const TRIGGER_REGISTRY: TriggerRegistry = {
|
||||
webflow_form_submission: webflowFormSubmissionTrigger,
|
||||
hubspot_contact_created: hubspotContactCreatedTrigger,
|
||||
hubspot_contact_deleted: hubspotContactDeletedTrigger,
|
||||
hubspot_contact_merged: hubspotContactMergedTrigger,
|
||||
hubspot_contact_privacy_deleted: hubspotContactPrivacyDeletedTrigger,
|
||||
hubspot_contact_property_changed: hubspotContactPropertyChangedTrigger,
|
||||
hubspot_contact_restored: hubspotContactRestoredTrigger,
|
||||
hubspot_company_created: hubspotCompanyCreatedTrigger,
|
||||
hubspot_company_deleted: hubspotCompanyDeletedTrigger,
|
||||
hubspot_company_merged: hubspotCompanyMergedTrigger,
|
||||
hubspot_company_property_changed: hubspotCompanyPropertyChangedTrigger,
|
||||
hubspot_company_restored: hubspotCompanyRestoredTrigger,
|
||||
hubspot_conversation_creation: hubspotConversationCreationTrigger,
|
||||
hubspot_conversation_deletion: hubspotConversationDeletionTrigger,
|
||||
hubspot_conversation_new_message: hubspotConversationNewMessageTrigger,
|
||||
@@ -337,9 +350,14 @@ export const TRIGGER_REGISTRY: TriggerRegistry = {
|
||||
hubspot_conversation_property_changed: hubspotConversationPropertyChangedTrigger,
|
||||
hubspot_deal_created: hubspotDealCreatedTrigger,
|
||||
hubspot_deal_deleted: hubspotDealDeletedTrigger,
|
||||
hubspot_deal_merged: hubspotDealMergedTrigger,
|
||||
hubspot_deal_property_changed: hubspotDealPropertyChangedTrigger,
|
||||
hubspot_deal_restored: hubspotDealRestoredTrigger,
|
||||
hubspot_ticket_created: hubspotTicketCreatedTrigger,
|
||||
hubspot_ticket_deleted: hubspotTicketDeletedTrigger,
|
||||
hubspot_ticket_merged: hubspotTicketMergedTrigger,
|
||||
hubspot_ticket_property_changed: hubspotTicketPropertyChangedTrigger,
|
||||
hubspot_ticket_restored: hubspotTicketRestoredTrigger,
|
||||
hubspot_webhook: hubspotWebhookTrigger,
|
||||
imap_poller: imapPollingTrigger,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user