Commit 6e1d027
feat(chatwoot): comprehensive improvements to message handling, editing, deletion and i18n
- Fix bidirectional message deletion between Chatwoot and WhatsApp
- Support deletion of multiple attachments sent together
- Implement proper message editing with 'Edited Message:' prefix format
- Enable deletion of edited messages by updating chatwootMessageId
- Skip cache for deleted messages (messageStubType === 1) to prevent duplicates
- Fix i18n translation path detection for production environment
- Add automatic dev/prod path resolution for translation files
- Improve error handling and logging for message operations
Technical improvements:
- Changed Chatwoot deletion query from findFirst to findMany for multiple attachments
- Fixed instanceId override issue in message deletion payload
- Added retry logic with Prisma MessageUpdate validation
- Implemented cache bypass for revoked messages to ensure proper processing
- Enhanced i18n to detect dist/ folder in production vs src/ in development
Resolves issues with:
- Message deletion not working from Chatwoot to WhatsApp
- Multiple attachments causing incomplete deletion
- Edited messages showing raw i18n keys instead of translated text
- Cache collision preventing deletion of edited messages
- Production environment not loading translation files correctly
Note: Tested and validated with Chatwoot v4.1 in production environment1 parent 78c7b96 commit 6e1d027
File tree
3 files changed
+407
-97
lines changed- src
- api/integrations
- channel/whatsapp
- chatbot/chatwoot/services
- utils
3 files changed
+407
-97
lines changedLines changed: 28 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1065 | 1065 | | |
1066 | 1066 | | |
1067 | 1067 | | |
| 1068 | + | |
| 1069 | + | |
| 1070 | + | |
| 1071 | + | |
| 1072 | + | |
1068 | 1073 | | |
1069 | 1074 | | |
1070 | 1075 | | |
| |||
1445 | 1450 | | |
1446 | 1451 | | |
1447 | 1452 | | |
1448 | | - | |
| 1453 | + | |
| 1454 | + | |
| 1455 | + | |
| 1456 | + | |
1449 | 1457 | | |
1450 | 1458 | | |
1451 | 1459 | | |
1452 | 1460 | | |
1453 | | - | |
| 1461 | + | |
| 1462 | + | |
| 1463 | + | |
1454 | 1464 | | |
1455 | 1465 | | |
1456 | 1466 | | |
| |||
1550 | 1560 | | |
1551 | 1561 | | |
1552 | 1562 | | |
1553 | | - | |
1554 | | - | |
| 1563 | + | |
| 1564 | + | |
| 1565 | + | |
| 1566 | + | |
| 1567 | + | |
| 1568 | + | |
| 1569 | + | |
| 1570 | + | |
| 1571 | + | |
| 1572 | + | |
| 1573 | + | |
| 1574 | + | |
| 1575 | + | |
| 1576 | + | |
| 1577 | + | |
| 1578 | + | |
1555 | 1579 | | |
1556 | 1580 | | |
1557 | 1581 | | |
| |||
0 commit comments