Skip to content

Commit 1658484

Browse files
Adam Goughwaleed
authored andcommitted
hubspot triggers working, plus other fixes
1 parent 6fc4a3c commit 1658484

17 files changed

Lines changed: 1888 additions & 7 deletions

File tree

apps/sim/app/api/webhooks/trigger/[path]/route.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,13 @@ export async function POST(
5252
const requestId = generateRequestId()
5353
const { path } = await params
5454

55+
// Log ALL incoming webhook requests for debugging
56+
logger.info(`[${requestId}] Incoming webhook request`, {
57+
path,
58+
method: request.method,
59+
headers: Object.fromEntries(request.headers.entries()),
60+
})
61+
5562
// Handle Microsoft Graph subscription validation (some environments send POST with validationToken)
5663
try {
5764
const url = new URL(request.url)
@@ -91,6 +98,23 @@ export async function POST(
9198

9299
const { webhook: foundWebhook, workflow: foundWorkflow } = findResult
93100

101+
// Log HubSpot webhook details for debugging
102+
if (foundWebhook.provider === 'hubspot') {
103+
const events = Array.isArray(body) ? body : [body]
104+
const firstEvent = events[0]
105+
106+
logger.info(`[${requestId}] HubSpot webhook received`, {
107+
path,
108+
subscriptionType: firstEvent?.subscriptionType,
109+
objectId: firstEvent?.objectId,
110+
portalId: firstEvent?.portalId,
111+
webhookId: foundWebhook.id,
112+
workflowId: foundWorkflow.id,
113+
triggerId: foundWebhook.providerConfig?.triggerId,
114+
eventCount: events.length,
115+
})
116+
}
117+
94118
const authError = await verifyProviderAuth(
95119
foundWebhook,
96120
foundWorkflow,

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel-new/components/editor/components/sub-block/components/webhook/webhook.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,9 @@ export function WebhookConfig({
370370
'outlookCredential'
371371
)
372372

373+
// Get the selected trigger ID for trigger-based webhooks (e.g., HubSpot, GitHub, Jira)
374+
const [selectedTriggerId] = useSubBlockValue(blockId, 'selectedTriggerId')
375+
373376
// Don't auto-generate webhook paths - only create them when user actually configures a webhook
374377
// This prevents the "Active Webhook" badge from showing on unconfigured blocks
375378

@@ -603,6 +606,16 @@ export function WebhookConfig({
603606
...config,
604607
credentialId: outlookCredentialId,
605608
}
609+
} else if (webhookProvider === 'hubspot' && selectedTriggerId) {
610+
// Include triggerId for HubSpot webhooks to enable event filtering
611+
finalConfig = {
612+
...config,
613+
triggerId: selectedTriggerId,
614+
}
615+
logger.info('Adding triggerId to HubSpot webhook config', {
616+
triggerId: selectedTriggerId,
617+
blockId,
618+
})
606619
}
607620

608621
// Set the provider config in the block state

apps/sim/background/webhook-execution.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,19 @@ async function executeWebhookJobInternal(
329329

330330
const input = await formatWebhookInput(actualWebhook, mockWorkflow, payload.body, mockRequest)
331331

332+
// Log HubSpot webhook input for debugging
333+
if (payload.provider === 'hubspot') {
334+
logger.info(`[${requestId}] HubSpot webhook input formatted`, {
335+
workflowId: payload.workflowId,
336+
executionId,
337+
eventType: input?.eventType,
338+
objectId: input?.objectId,
339+
portalId: input?.portalId,
340+
triggerId: actualWebhook.providerConfig?.triggerId,
341+
hasInput: !!input,
342+
})
343+
}
344+
332345
if (!input && payload.provider === 'whatsapp') {
333346
logger.info(`[${requestId}] No messages in WhatsApp payload, skipping execution`)
334347
await loggingSession.safeComplete({

0 commit comments

Comments
 (0)