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

View File

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