You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -1437,6 +1437,104 @@ export async function fetchAndProcessAirtablePayloads(
1437
1437
/**
1438
1438
* Process webhook verification and authorization
1439
1439
*/
1440
+
/**
1441
+
* Handle Microsoft Teams webhooks with immediate acknowledgment
1442
+
*/
1443
+
asyncfunctionprocessMicrosoftTeamsWebhook(
1444
+
foundWebhook: any,
1445
+
foundWorkflow: any,
1446
+
input: any,
1447
+
executionId: string,
1448
+
requestId: string
1449
+
): Promise<NextResponse>{
1450
+
logger.info(
1451
+
`[${requestId}] Acknowledging Microsoft Teams webhook ${foundWebhook.id} and executing workflow ${foundWorkflow.id} asynchronously (Execution: ${executionId})`
1452
+
)
1453
+
1454
+
// Execute workflow asynchronously without waiting for completion
1455
+
executeWorkflowFromPayload(
1456
+
foundWorkflow,
1457
+
input,
1458
+
executionId,
1459
+
requestId,
1460
+
foundWebhook.blockId
1461
+
).catch((error)=>{
1462
+
// Log any errors that occur during async execution
1463
+
logger.error(
1464
+
`[${requestId}] Error during async workflow execution for webhook ${foundWebhook.id} (Execution: ${executionId})`,
1465
+
error
1466
+
)
1467
+
})
1468
+
1469
+
// Return immediate acknowledgment for Microsoft Teams
1470
+
returnNextResponse.json(
1471
+
{
1472
+
type: 'message',
1473
+
text: 'Sim Studio',
1474
+
},
1475
+
{status: 200}
1476
+
)
1477
+
}
1478
+
1479
+
/**
1480
+
* Handle standard webhooks with synchronous execution
1481
+
*/
1482
+
asyncfunctionprocessStandardWebhook(
1483
+
foundWebhook: any,
1484
+
foundWorkflow: any,
1485
+
input: any,
1486
+
executionId: string,
1487
+
requestId: string
1488
+
): Promise<NextResponse>{
1489
+
logger.info(
1490
+
`[${requestId}] Executing workflow ${foundWorkflow.id} for webhook ${foundWebhook.id} (Execution: ${executionId})`
1491
+
)
1492
+
1493
+
awaitexecuteWorkflowFromPayload(
1494
+
foundWorkflow,
1495
+
input,
1496
+
executionId,
1497
+
requestId,
1498
+
foundWebhook.blockId
1499
+
)
1500
+
1501
+
// Since executeWorkflowFromPayload handles logging and errors internally,
1502
+
// we just need to return a standard success response for synchronous webhooks.
1503
+
// Note: The actual result isn't typically returned in the webhook response itself.
0 commit comments