Skip to content

Commit e4fbb67

Browse files
fix(teams-webhook): response json needs type (#741)
1 parent 7f0f902 commit e4fbb67

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

apps/sim/lib/webhooks/utils.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1491,13 +1491,37 @@ export async function processWebhook(
14911491
// Since executeWorkflowFromPayload handles logging and errors internally,
14921492
// we just need to return a standard success response for synchronous webhooks.
14931493
// Note: The actual result isn't typically returned in the webhook response itself.
1494+
1495+
// For Microsoft Teams outgoing webhooks, return the expected response format
1496+
if (foundWebhook.provider === 'microsoftteams') {
1497+
return NextResponse.json(
1498+
{
1499+
type: 'message',
1500+
text: 'Webhook processed successfully',
1501+
},
1502+
{ status: 200 }
1503+
)
1504+
}
1505+
14941506
return NextResponse.json({ message: 'Webhook processed' }, { status: 200 })
14951507
} catch (error: any) {
14961508
// Catch errors *before* calling executeWorkflowFromPayload (e.g., auth errors)
14971509
logger.error(
14981510
`[${requestId}] Error in processWebhook *before* execution for ${foundWebhook.id} (Execution: ${executionId})`,
14991511
error
15001512
)
1513+
1514+
// For Microsoft Teams outgoing webhooks, return the expected error format
1515+
if (foundWebhook.provider === 'microsoftteams') {
1516+
return NextResponse.json(
1517+
{
1518+
type: 'message',
1519+
text: 'Webhook processing failed',
1520+
},
1521+
{ status: 200 }
1522+
) // Still return 200 to prevent Teams from showing additional error messages
1523+
}
1524+
15011525
return new NextResponse(`Internal Server Error: ${error.message}`, {
15021526
status: 500,
15031527
})

0 commit comments

Comments
 (0)