MCPcopy Index your code
hub / github.com/FlowiseAI/Flowise / dispatchCallback

Function dispatchCallback

packages/server/src/utils/callbackDispatcher.ts:12–32  ·  view source on GitHub ↗
(url: string, payload: Record<string, unknown>, secret?: string)

Source from the content-addressed store, hash-verified

10}
11
12export async function dispatchCallback(url: string, payload: Record<string, unknown>, secret?: string): Promise<void> {
13 const body = JSON.stringify(payload)
14 const headers: Record<string, string> = { 'Content-Type': 'application/json' }
15 if (secret) headers['X-Flowise-Signature'] = sign(body, secret)
16
17 for (let attempt = 0; attempt < RETRY_DELAYS.length; attempt++) {
18 if (RETRY_DELAYS[attempt] > 0) {
19 await new Promise((r) => setTimeout(r, RETRY_DELAYS[attempt]))
20 }
21 try {
22 await secureAxiosRequest({ method: 'POST', url, data: body, headers, timeout: 10000 })
23 return
24 } catch (err: any) {
25 if (attempt === RETRY_DELAYS.length - 1) {
26 logger.error(
27 `[callbackDispatcher] Failed to deliver callback to ${url} after ${RETRY_DELAYS.length} attempts: ${err.message}`
28 )
29 }
30 }
31 }
32}

Callers 2

createWebhookFunction · 0.90

Calls 3

secureAxiosRequestFunction · 0.85
stringifyMethod · 0.80
signFunction · 0.70

Tested by

no test coverage detected