Skip to content

chore: Backfill 29 ad messages that failed to sync to Chatwoot #21

@wahyuwidgetworks

Description

@wahyuwidgetworks

Summary

After deploying the ad thumbnail fix (EvolutionAPI#2408), backfill the 29 messages that failed to sync to Chatwoot in the past 7 days.

Context

These messages exist in Evolution DB with chatwootMessageId = NULL and contain externalAdReply data. Once the fix is deployed, these historical messages need to be manually synced.

Affected Messages Query

SELECT 
  m.key->>'id' AS message_id,
  m.key->>'remoteJid' AS remote_jid,
  to_timestamp(m."messageTimestamp") AS ts,
  m."instanceId"
FROM "Message" m
WHERE m."chatwootMessageId" IS NULL
  AND m."messageTimestamp" > EXTRACT(EPOCH FROM NOW() - INTERVAL '7 days')
  AND (
    m."contextInfo"->'externalAdReply' IS NOT NULL
    OR m.message->'extendedTextMessage'->'contextInfo'->'externalAdReply' IS NOT NULL
    OR m.message->'imageMessage'->'contextInfo'->'externalAdReply' IS NOT NULL
  );

Approach Options

  1. Manual re-trigger: Call chatwootService.eventWhatsapp() for each message
  2. Script: Write a one-time migration script to process these messages
  3. API endpoint: Create a temporary admin endpoint to re-sync specific messages

Acceptance Criteria

  • All 29 messages appear in their respective Chatwoot conversations
  • chatwootMessageId is populated for each message in Evolution DB

Dependencies

References

  • Troubleshooting doc: docs/troubleshooting/02-02-26-mama-first-realtime-lid-missing-ads-autoreply.md

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions