(chatflowId: string, workspaceId: string)
| 671 | } |
| 672 | |
| 673 | const getWebhookSecret = async (chatflowId: string, workspaceId: string): Promise<string | null> => { |
| 674 | try { |
| 675 | const appServer = getRunningExpressApp() |
| 676 | const dbResponse = await appServer.AppDataSource.getRepository(ChatFlow) |
| 677 | .createQueryBuilder('chatflow') |
| 678 | .select('chatflow.webhookSecret') |
| 679 | .where('chatflow.id = :id', { id: chatflowId }) |
| 680 | .andWhere('chatflow.workspaceId = :workspaceId', { workspaceId }) |
| 681 | .getOne() |
| 682 | const stored = dbResponse?.webhookSecret |
| 683 | if (!stored) return null |
| 684 | const decrypted = await decryptCredentialData(stored) |
| 685 | return (decrypted?.secret as string | undefined) ?? null |
| 686 | } catch (error) { |
| 687 | if (error instanceof InternalFlowiseError) throw error |
| 688 | throw new InternalFlowiseError( |
| 689 | StatusCodes.INTERNAL_SERVER_ERROR, |
| 690 | `Error: chatflowsService.getWebhookSecret - ${getErrorMessage(error)}` |
| 691 | ) |
| 692 | } |
| 693 | } |
| 694 | |
| 695 | export default { |
| 696 | assertChatflowIdsInWorkspace, |
nothing calls this directly
no test coverage detected