Skip to content

Commit cfb40bb

Browse files
waleedlatif1claude
andcommitted
fix(confluence): align trigger outputs with actual webhook payloads
- Rewrite output builders to match real Confluence webhook payload structure (flat spaceKey, numeric version, actual API fields) - Remove fabricated fields (nested space/version objects, comment.body) - Add missing fields (creatorAccountId, lastModifierAccountId, self, creationDate, modificationDate, accountType) - Add extractor functions (extractPageData, extractCommentData, etc.) following the same pattern as Jira - Add formatWebhookInput handler for Confluence in utils.server.ts so payloads are properly destructured before reaching workflows - Make event field matching resilient (check both event and webhookEvent) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent ffb1fbb commit cfb40bb

File tree

3 files changed

+182
-310
lines changed

3 files changed

+182
-310
lines changed

apps/sim/lib/webhooks/processor.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -962,9 +962,10 @@ export async function queueWebhookExecution(
962962
const triggerId = providerConfig.triggerId as string | undefined
963963

964964
if (triggerId && triggerId !== 'confluence_webhook') {
965-
const event = body.event as string | undefined
965+
// Confluence may use `event`, `webhookEvent`, or neither — check both
966+
const event = (body.event || body.webhookEvent) as string | undefined
966967

967-
if (!isConfluenceEventMatch(triggerId, event || '')) {
968+
if (event && !isConfluenceEventMatch(triggerId, event)) {
968969
logger.debug(
969970
`[${options.requestId}] Confluence event mismatch for trigger ${triggerId}. Event: ${event}. Skipping execution.`,
970971
{

apps/sim/lib/webhooks/utils.server.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1197,6 +1197,38 @@ export async function formatWebhookInput(
11971197
return extractIssueData(body)
11981198
}
11991199

1200+
if (foundWebhook.provider === 'confluence') {
1201+
const {
1202+
extractPageData,
1203+
extractCommentData,
1204+
extractBlogData,
1205+
extractAttachmentData,
1206+
extractSpaceData,
1207+
extractLabelData,
1208+
} = await import('@/triggers/confluence/utils')
1209+
1210+
const providerConfig = (foundWebhook.providerConfig as Record<string, any>) || {}
1211+
const triggerId = providerConfig.triggerId as string | undefined
1212+
1213+
if (triggerId?.startsWith('confluence_comment_')) {
1214+
return extractCommentData(body)
1215+
}
1216+
if (triggerId?.startsWith('confluence_blog_')) {
1217+
return extractBlogData(body)
1218+
}
1219+
if (triggerId?.startsWith('confluence_attachment_')) {
1220+
return extractAttachmentData(body)
1221+
}
1222+
if (triggerId?.startsWith('confluence_space_')) {
1223+
return extractSpaceData(body)
1224+
}
1225+
if (triggerId?.startsWith('confluence_label_')) {
1226+
return extractLabelData(body)
1227+
}
1228+
// Default: page events and generic webhook
1229+
return extractPageData(body)
1230+
}
1231+
12001232
if (foundWebhook.provider === 'stripe') {
12011233
return body
12021234
}

0 commit comments

Comments
 (0)