fix(chatwoot): QR code not delivered when bot conversation is resolved after init
Description
When using Chatwoot bot contact (CHATWOOT_BOT_CONTACT=true), sending init in the bot conversation (+123456) can start Baileys QR generation, but the QR image/instructions never arrive in Chatwoot.
Steps to reproduce
- Enable Chatwoot integration with bot contact
- Open bot conversation in the instance inbox
- Send
init(or letinitInstanceChatwootsend it on setup) - Chatwoot automation resolves the conversation (
status: resolved) - Baileys generates QR codes
Expected behavior
QR code image and scan instructions are posted to the bot conversation.
Actual behavior
- Evolution logs:
WARN [ChatwootService] conversation not found - User receives no QR in Chatwoot
- Instance stays
connectinguntilQRCODE_LIMITis reached
Root cause
createBotMessage / createBotQr only target conversations with status === 'open' via getOpenConversationByContact(). If the bot thread is resolved by automations, QR delivery fails silently.
Suggested fix
Reopen the latest bot inbox conversation (or create one) before posting QR/status bot messages. Also tighten init command matching and avoid duplicate QR messages per refresh.
Pull request
#2579
Environment
- Evolution API v2.3.7
- Integration: WHATSAPP-BAILEYS + Chatwoot
- Observed in production with Chatwoot automations resolving bot conversations after
init
we are already in 2.4.0-rc2, try it with that << than change your PR to develop