2
0

fix: Allow webhook with basic auth

This commit is contained in:
Baptiste Arnaud
2022-02-15 12:36:08 +01:00
parent b95d907e8f
commit 93e8f90ac3
9 changed files with 38 additions and 37 deletions

View File

@ -20,11 +20,11 @@ import { parseVariables, parseVariablesInObject } from './variable'
const safeEval = eval
type Indices = { blockIndex: number; stepIndex: number }
type IntegrationContext = {
apiHost: string
typebotId: string
indices: Indices
blockId: string
stepId: string
isPreview: boolean
variables: Variable[]
updateVariableValue: (variableId: string, value: string) => void
@ -153,7 +153,8 @@ const parseCellValues = (
const executeWebhook = async (
step: WebhookStep,
{
indices,
blockId,
stepId,
variables,
updateVariableValue,
typebotId,
@ -161,9 +162,8 @@ const executeWebhook = async (
}: IntegrationContext
) => {
if (!step.webhook) return step.outgoingEdgeId
const { blockIndex, stepIndex } = indices
const { data, error } = await sendRequest({
url: `${apiHost}/api/typebots/${typebotId}/blocks/${blockIndex}/steps/${stepIndex}/executeWebhook`,
url: `${apiHost}/api/typebots/${typebotId}/blocks/${blockId}/steps/${stepId}/executeWebhook`,
method: 'POST',
body: {
variables,