MCPcopy Create free account
hub / github.com/FlowiseAI/Flowise / setWebhookSecret

Function setWebhookSecret

packages/server/src/services/chatflows/index.ts:635–653  ·  view source on GitHub ↗
(chatflowId: string, workspaceId: string)

Source from the content-addressed store, hash-verified

633}
634
635const setWebhookSecret = async (chatflowId: string, workspaceId: string): Promise<{ webhookSecret: string }> => {
636 try {
637 const appServer = getRunningExpressApp()
638 const repo = appServer.AppDataSource.getRepository(ChatFlow)
639 const chatflow = await repo.findOne({ where: { id: chatflowId, workspaceId } })
640 if (!chatflow) throw new InternalFlowiseError(StatusCodes.NOT_FOUND, `Chatflow ${chatflowId} not found`)
641 const plaintext = randomBytes(32).toString('hex')
642 chatflow.webhookSecret = await encryptCredentialData({ secret: plaintext })
643 chatflow.webhookSecretConfigured = true
644 await repo.save(chatflow)
645 return { webhookSecret: plaintext }
646 } catch (error) {
647 if (error instanceof InternalFlowiseError) throw error
648 throw new InternalFlowiseError(
649 StatusCodes.INTERNAL_SERVER_ERROR,
650 `Error: chatflowsService.setWebhookSecret - ${getErrorMessage(error)}`
651 )
652 }
653}
654
655const clearWebhookSecret = async (chatflowId: string, workspaceId: string): Promise<void> => {
656 try {

Callers

nothing calls this directly

Calls 3

getRunningExpressAppFunction · 0.90
encryptCredentialDataFunction · 0.90
getErrorMessageFunction · 0.90

Tested by

no test coverage detected