🐛 (whatsapp) Fix webhook when having 2 phone numbers in same WA account
This commit is contained in:
@ -18,6 +18,7 @@ type Props = {
|
||||
receivedMessage: WhatsAppIncomingMessage
|
||||
sessionId: string
|
||||
credentialsId?: string
|
||||
phoneNumberId?: string
|
||||
workspaceId?: string
|
||||
contact: NonNullable<SessionState['whatsApp']>['contact']
|
||||
}
|
||||
@ -27,6 +28,7 @@ export const resumeWhatsAppFlow = async ({
|
||||
sessionId,
|
||||
workspaceId,
|
||||
credentialsId,
|
||||
phoneNumberId,
|
||||
contact,
|
||||
}: Props): Promise<{ message: string }> => {
|
||||
const messageSendDate = new Date(Number(receivedMessage.timestamp) * 1000)
|
||||
@ -54,6 +56,13 @@ export const resumeWhatsAppFlow = async ({
|
||||
}
|
||||
}
|
||||
|
||||
if (credentials.phoneNumberId !== phoneNumberId) {
|
||||
console.error('Credentials point to another phone ID, skipping...')
|
||||
return {
|
||||
message: 'Message received',
|
||||
}
|
||||
}
|
||||
|
||||
const reply = await getIncomingMessageContent({
|
||||
message: receivedMessage,
|
||||
typebotId: typebot?.id,
|
||||
|
Reference in New Issue
Block a user