iachat/app/javascript/dashboard/helper
Gabriel Jablonski 11e9932e9b
feat(whatsapp): show contact typing and recording indicators via baileys presence (#264)
* feat(whatsapp): show contact typing and recording indicators via baileys presence

Subscribe to WhatsApp presence updates via the baileys-api provider to
display real-time typing and recording indicators in the dashboard.

- Handle presence.update webhook events (composing, recording, paused,
  available) and broadcast via ActionCable
- Add conversation.recording event to ActionCable, webhook, and channel
  listeners for parity with typing_on/typing_off
- Show "typing..." / "recording..." in green text on the chat list,
  replacing the message preview
- Show "X is typing" / "X is recording audio" in the conversation view
- Add presence_subscribe provider config option (default off) to gate
  all subscription calls to the baileys-api
- Subscribe to presence on conversation open and periodically (1 min)
  for the top 10 chat list conversations
- Consolidate contact LID from presence.update jidAlt payload
- Prevent echo-back of contact typing events to the channel

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: address review feedback

- Filter chat list typing indicator to contact-only events
- Add dedupe to presence subscribe bulk calls
- Use strong parameters for conversation_ids
- Remove redundant YAML quotes in swagger webhook enum

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: address review feedback

- Extract phone from data[:id] when JID is @s.whatsapp.net (fallback
  when jidAlt is absent)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: address review feedback

- Filter recording users in getTypingUsersText to show correct names
- Add 10s timeout to presence_subscribe HTTP request

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: scope typing timer per user instead of per conversation

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: make presence subscribe best-effort with rescue per channel

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: address review feedback

- Add messagePreviewClass to typing preview for consistent padding
- Fix specs to use WebMock assertions instead of instance spying

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 11:38:11 -03:00
..
AnalyticsHelper feat: Add natural language date parser for snooze functionality (#13587) 2026-03-06 12:20:22 +04:00
AudioAlerts feat: handle mine event for incoming messages (#10867) 2025-02-11 17:45:31 +05:30
CacheHelper feat: fallback to DB localStorage for idb names (#8682) 2024-01-15 15:08:15 +05:30
commandbar feat: Rewrite command bar mixin to a composable (#10015) 2024-08-26 15:55:59 +05:30
snoozeDateParser feat: Add natural language date parser for snooze functionality (#13587) 2026-03-06 12:20:22 +04:00
specs Merge branch 'chatwoot/develop' into chore/merge-upstream-4.12.0 2026-03-20 00:27:45 -03:00
actionCable.js feat(whatsapp): show contact typing and recording indicators via baileys presence (#264) 2026-04-13 11:38:11 -03:00
actionQueryGenerator.js feat: mensagens agendadas (#198) 2026-01-30 22:08:16 -03:00
agentHelper.js fix: Translate "None" option in agent assignment dropdown (#11060) 2025-03-11 14:49:27 -07:00
APIHelper.js fix: Allow users to login even if they have access to more than 15 accounts (#4475) 2022-04-14 20:54:26 +05:30
auditlogHelper.js feat: Add conversation delete feature (#11677) 2025-06-05 15:53:17 -05:00
automationHelper.js feat: group conversations (#228) 2026-03-19 21:56:58 -03:00
commons.js feat(whatsapp): show contact typing and recording indicators via baileys presence (#264) 2026-04-13 11:38:11 -03:00
conversationHelper.js fix: TypeError: t.messages.at is not a function (#9950) 2024-08-13 19:16:15 +05:30
customViewsHelper.js feat: group conversations (#228) 2026-03-19 21:56:58 -03:00
DOMHelpers.js feat: add promise based loader for FB script (#9780) 2024-07-22 11:32:05 +05:30
downloadHelper.js feat: Add business hours in downloadable reports (#4674) 2022-05-27 09:26:59 +05:30
editorHelper.js Merge branch 'main' into chore/merge-upstream-4.11.0 2026-02-17 23:05:26 -03:00
emailQuoteExtractor.js feat: sanitize html before assiging it to tempDiv (#13252) 2026-01-12 22:41:37 +05:30
featureHelper.js chore: make all the deprecated feature flag reclaimable (#13646) 2026-02-26 18:01:13 +05:30
filterQueryGenerator.js chore: Support multiple values for automation message content (#7871) 2023-09-19 13:04:58 +05:30
flag.js chore: Replace packages with native functions (#5140) 2022-08-03 17:08:21 +05:30
inbox.js feat(V5): Update settings pages UI (#13396) 2026-02-19 15:04:40 +05:30
labelColor.js feat: Create portal UI improvements (#5261) 2022-08-18 17:11:19 +05:30
pendingGroupNavigation.js feat: group conversations (#228) 2026-03-19 21:56:58 -03:00
permissionsHelper.js chore: Remove older UI (#11720) 2025-07-01 09:43:44 +05:30
phoneHelper.js feat: group conversations (#228) 2026-03-19 21:56:58 -03:00
portalHelper.js feat: Add draft status for help center locales (#13768) 2026-03-17 12:45:54 +04:00
preChat.js feat: Support Regex validation for custom attributes (#7856) 2024-01-23 18:01:57 +04:00
pushHelper.js feat: Log push notification error (#12543) 2025-09-29 15:19:45 +05:30
quotedEmailHelper.js feat: sanitize html before assiging it to tempDiv (#13252) 2026-01-12 22:41:37 +05:30
ReconnectService.js feat: Vite + vue 3 💚 (#10047) 2024-10-02 00:36:30 -07:00
recurrenceHelpers.js feat: schedule messages recurrence (#240) 2026-03-19 22:51:14 -03:00
routeHelpers.js chore: Custom Roles to manage permissions [ UI ] (#9865) 2024-09-17 11:40:11 -07:00
scheduleDateShortcutHelpers.js feat: scheduled message shortcuts (#238) 2026-03-19 22:43:51 -03:00
scriptHelpers.js Chore/merge upstream 4.8.0 (#150) 2025-11-19 16:25:58 -03:00
snoozeHelpers.js feat: Add natural language date parser for snooze functionality (#13587) 2026-03-06 12:20:22 +04:00
states.js Move src to dashboard (#152) 2019-10-16 14:36:17 +05:30
templateHelper.js feat: Add media_name support for WhatsApp templates document files (#12462) 2025-09-18 15:25:31 +05:30
themeHelper.js feat: Support bigger font size in dashboard (#10974) 2025-02-27 12:10:33 +05:30
Timer.js feat: Voice Channel (#11602) 2025-12-19 12:41:33 -08:00
uploadHelper.js feat: Add the ability to paste images to editor (#10072) 2024-09-11 09:44:13 +05:30
URLHelper.js feat: Add UI to manage web widget allowed domains (#12495) 2025-09-24 16:46:19 +05:30
validations.js Merge branch 'main' into chore/merge-upstream-4.11.0 2026-02-17 23:05:26 -03:00
voice.js feat: Voice Channel (#11602) 2025-12-19 12:41:33 -08:00