Skip to content

feat(chatwoot-adapter): self-heal @lid contact names + self-hosting docs (#609)#25

Merged
rmyndharis merged 1 commit into
mainfrom
feat/chatwoot-lid-name-refresh
Jul 3, 2026
Merged

feat(chatwoot-adapter): self-heal @lid contact names + self-hosting docs (#609)#25
rmyndharis merged 1 commit into
mainfrom
feat/chatwoot-lid-name-refresh

Conversation

@rmyndharis

Copy link
Copy Markdown
Owner

Part of rmyndharis/OpenWA#609 (P1). Folds into the unreleased v0.2.0.

Contact names self-heal for @lid chats

A 1:1 chat first seen from a privacy-id (@lid) sender has no display name yet, so it's created in Chatwoot with the bare id. Once a real WhatsApp pushName arrives on a later message, the Chatwoot contact is renamed to it, so agents see a human name instead of an id — the same outcome a manual name-resync script produces, done inline.

  • New ChatwootClient.updateContact(contactId, name) (PUT /contacts/{id}).
  • The chat link now records the last-synced name; the refresh fires only when the name actually changed, so there's at most one rename per real change.
  • Guardrails: best-effort (a failed rename is logged, never blocks the relay), never renames a group contact from a member's name, and only a genuine pushName/name qualifies — a senderPhone/JID fallback never overwrites a real name.

Docs

  • New Self-hosted Chatwoot section: baseUrl must be a public https URL (LAN/localhost/host.docker.internal are rejected by the SSRF guard), how to expose a self-hosted instance via a tunnel, and how to avoid 502/530 on large media uploads.
  • Corrected the compatibility floor to OpenWA ≥ 0.8.3 (matches the manifest; the media/voice sends need it).

Not included (tracked in #609)

History backfill and an inbound retry/dead-letter queue are deferred: both need capabilities the plugin sandbox doesn't expose (reading message history; durable background work). They'd require a host-side change rather than an adapter-only one.

Tests

New: updateContact PUTs the name; an @lid contact is renamed once a real pushName arrives; no rename when the stored name already matches; a group contact is never renamed from a member's name. Full suite green (192 tests across all plugins), tsc --noEmit clean, plugin packages, catalog up to date.

…ocs (#609)

A 1:1 chat first seen from a privacy-id (@lid) sender is seeded in Chatwoot
with the bare id as its name. Once a real WhatsApp display name arrives on a
later message, the Chatwoot contact is renamed to it via a new
ChatwootClient.updateContact — best-effort, only when the name actually
changed, never for group contacts, and never overwriting a real name with a
fallback. The last-synced name is stored on the chat link to avoid redundant
renames.

Docs: a Self-hosted Chatwoot section (public https/tunnel requirement, large
upload 502/530 guidance) and the compatibility floor corrected to 0.8.3.

Folded into the unreleased v0.2.0.
@rmyndharis rmyndharis merged commit a1b1162 into main Jul 3, 2026
1 check passed
@rmyndharis rmyndharis deleted the feat/chatwoot-lid-name-refresh branch July 3, 2026 07:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant