mirror of
https://github.com/simstudioai/sim.git
synced 2026-04-06 03:00:16 -04:00
fix(teams-webhook): response json needs type (#741)
This commit is contained in:
committed by
GitHub
parent
7f0f902204
commit
e4fbb67833
@@ -1491,6 +1491,18 @@ export async function processWebhook(
|
||||
// Since executeWorkflowFromPayload handles logging and errors internally,
|
||||
// we just need to return a standard success response for synchronous webhooks.
|
||||
// Note: The actual result isn't typically returned in the webhook response itself.
|
||||
|
||||
// For Microsoft Teams outgoing webhooks, return the expected response format
|
||||
if (foundWebhook.provider === 'microsoftteams') {
|
||||
return NextResponse.json(
|
||||
{
|
||||
type: 'message',
|
||||
text: 'Webhook processed successfully',
|
||||
},
|
||||
{ status: 200 }
|
||||
)
|
||||
}
|
||||
|
||||
return NextResponse.json({ message: 'Webhook processed' }, { status: 200 })
|
||||
} catch (error: any) {
|
||||
// Catch errors *before* calling executeWorkflowFromPayload (e.g., auth errors)
|
||||
@@ -1498,6 +1510,18 @@ export async function processWebhook(
|
||||
`[${requestId}] Error in processWebhook *before* execution for ${foundWebhook.id} (Execution: ${executionId})`,
|
||||
error
|
||||
)
|
||||
|
||||
// For Microsoft Teams outgoing webhooks, return the expected error format
|
||||
if (foundWebhook.provider === 'microsoftteams') {
|
||||
return NextResponse.json(
|
||||
{
|
||||
type: 'message',
|
||||
text: 'Webhook processing failed',
|
||||
},
|
||||
{ status: 200 }
|
||||
) // Still return 200 to prevent Teams from showing additional error messages
|
||||
}
|
||||
|
||||
return new NextResponse(`Internal Server Error: ${error.message}`, {
|
||||
status: 500,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user