( provider: string, savedWebhook: Record<string, unknown>, requestId: string )
| 374 | } |
| 375 | |
| 376 | async function configurePollingIfNeeded( |
| 377 | provider: string, |
| 378 | savedWebhook: Record<string, unknown>, |
| 379 | requestId: string |
| 380 | ): Promise<TriggerSaveError | null> { |
| 381 | const handler = getProviderHandler(provider) |
| 382 | if (!handler.configurePolling) { |
| 383 | return null |
| 384 | } |
| 385 | |
| 386 | const success = await handler.configurePolling({ webhook: savedWebhook, requestId }) |
| 387 | if (!success) { |
| 388 | await db.delete(webhook).where(eq(webhook.id, savedWebhook.id as string)) |
| 389 | return { |
| 390 | message: `Failed to configure ${provider} polling. Please check your account permissions.`, |
| 391 | status: 500, |
| 392 | } |
| 393 | } |
| 394 | |
| 395 | return null |
| 396 | } |
| 397 | |
| 398 | async function syncCredentialSetWebhooks(params: { |
| 399 | workflowId: string |
no test coverage detected