Commit 679b56e
committed
fix(chatwoot): skip duplicate messages when device redelivers same key.id
When a sender device redelivers a message with the same key.id (for
example an unofficial client stuck in a resend loop), the live event
path posted a new Chatwoot message on every arrival; one production
report accumulated 837 copies of a single message.
Reuse the dedup check that sendData already applies to media messages:
query Chatwoot's messages.source_id through getExistingSourceIds before
posting, gated by isImportHistoryAvailable, and skip the message when
the WAID source id already exists in the target conversation. The
helper is fail open: on lookup errors it logs and returns an empty set,
so delivery is never blocked.
The check sits at the top of the messages.upsert/send.message block so
it covers text, reactions, interactive buttons, ads and media, and does
not touch the messages.edit path, which legitimately re-posts using the
original message's source id.
Fixes #26751 parent e273b90 commit 679b56e
1 file changed
Lines changed: 11 additions & 0 deletions
Lines changed: 11 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2240 | 2240 | | |
2241 | 2241 | | |
2242 | 2242 | | |
| 2243 | + | |
| 2244 | + | |
| 2245 | + | |
| 2246 | + | |
| 2247 | + | |
| 2248 | + | |
| 2249 | + | |
| 2250 | + | |
| 2251 | + | |
| 2252 | + | |
| 2253 | + | |
2243 | 2254 | | |
2244 | 2255 | | |
2245 | 2256 | | |
| |||
0 commit comments