2
0

🐛 (whatsapp) Fix auto start when first input is file

Closes #1246
This commit is contained in:
Baptiste Arnaud
2024-03-07 14:26:02 +01:00
parent 59cf993146
commit 583294f90c
2 changed files with 15 additions and 11 deletions

View File

@ -7837,6 +7837,10 @@
"type": "string",
"nullable": true
},
"folderId": {
"type": "string",
"nullable": true
},
"resultsTablePreferences": {
"type": "object",
"nullable": true,
@ -7880,7 +7884,8 @@
"variables",
"theme",
"settings",
"icon"
"icon",
"folderId"
],
"title": "Typebot V6"
},
@ -10451,6 +10456,10 @@
"type": "string",
"nullable": true
},
"folderId": {
"type": "string",
"nullable": true
},
"resultsTablePreferences": {
"type": "object",
"nullable": true,
@ -10494,7 +10503,8 @@
"variables",
"theme",
"settings",
"icon"
"icon",
"folderId"
],
"title": "Typebot V5"
}
@ -15348,7 +15358,7 @@
},
"folderName": {
"type": "string",
"default": "New folder"
"default": ""
},
"parentFolderId": {
"type": "string"

View File

@ -41,12 +41,8 @@ export const resumeWhatsAppFlow = async ({
}
}
const session = await getSession(sessionId)
const isPreview = workspaceId === undefined || credentialsId === undefined
const { typebot } = session?.state.typebotsQueue[0] ?? {}
const credentials = await getCredentials({ credentialsId, isPreview })
if (!credentials) {
@ -65,11 +61,12 @@ export const resumeWhatsAppFlow = async ({
const reply = await getIncomingMessageContent({
message: receivedMessage,
typebotId: typebot?.id,
workspaceId,
accessToken: credentials?.systemUserAccessToken,
})
const session = await getSession(sessionId)
const isSessionExpired =
session &&
isDefined(session.state.expiryTimeout) &&
@ -140,12 +137,10 @@ export const resumeWhatsAppFlow = async ({
const getIncomingMessageContent = async ({
message,
typebotId,
workspaceId,
accessToken,
}: {
message: WhatsAppIncomingMessage
typebotId?: string
workspaceId?: string
accessToken: string
}): Promise<Reply> => {
@ -161,7 +156,6 @@ const getIncomingMessageContent = async ({
case 'audio':
case 'video':
case 'image':
if (!typebotId) return
let mediaId: string | undefined
if (message.type === 'video') mediaId = message.video.id
if (message.type === 'image') mediaId = message.image.id