Free, Open Source, Self-Hosted WhatsApp API Gateway
TypeScript apibotgatewayself-hostedwhatsappwhatsapp-apiwhatsapp-automationwhatsapp-botwhatsapp-gatewaywhatsapp-gateway-apiwhatsapp-webwhatsapp-web-api
feat(chats): render call and location messages in the dashboard (#541)
Yudhi Armyndharisf4961e55a541
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex d321c9a9f..14a99a578 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0### Added- **Outbound @mentions on text and media sends.** `send-text` and the media send routes now accept an optional `mentions` array of WIDs (`<phone>@c.us`) to tag participants — most useful in groups. The contract is engine-neutral: pass neutral `@c.us` WIDs and the active engine (whatsapp-web.js or Baileys) de-normalizes them. For a tag to render and notify, the `text`/`caption` must also contain the matching `@<number>` token. This brings outbound parity with the `mentions` field already surfaced on inbound webhooks. (#530) Thanks @adampalli.+- **Call and location messages render in the dashboard chat view.** Call logs now show a labeled bubble (voice/video, and "missed" for an unanswered incoming call) instead of an empty message, and shared locations render their map-preview thumbnail with a "📍 Location" label instead of dumping the raw base64 thumbnail as text. A new engine-neutral `call` message type carries the `{ video, missed }` detail, localized across all 10 dashboard locales. Based on work by @softronicve (#494).## [0.7.13] - 2026-06-29diff --git a/dashboard/src/components/FilterBuilder.tsx b/dashboard/src/components/FilterBuilder.tsxindex 2d827ab70..ac3812f05 100644--- a/dashboard/src/components/FilterBuilder.tsx+++ b/dashboard/src/components/FilterBuilder.tsx@@ -28,6 +28,7 @@ const MESSAGE_TYPES = ['sticker','location','contact',+ 'call','revoked','unknown',];diff --git a/dashboard/src/i18n/locales/ar.json b/dashboard/src/i18n/locales/ar.jsonindex b34cf814e..b41fd8b33 100644--- a/dashboard/src/i18n/locales/ar.json+++ b/dashboard/src/i18n/locales/ar.json@@ -78,6 +78,13 @@"logs": "السجلات"},"chats": {+ "media": {+ "location": "الموقع",+ "call": "مكالمة",+ "callMissed": "مكالمة فائتة",+ "callVideo": "مكالمة فيديو",+ "callVideoMissed": "مكالمة فيديو فائتة"+ },"subtitle": "أرسل ورد على رسائل واتساب في الوقت الفعلي","noSessionsTitle": "لا توجد جلسات متصلة","noSessionsDesc": "يرجى أولاً توصيل جلسة واتساب من قائمة <1>الجلسات</1> لاستخدام ميزة المحادثة.",diff --git a/dashboard/src/i18n/locales/en.json b/dashboard/src/i18n/locales/en.jsonindex 0bd039b77..8a0dc6131 100644--- a/dashboard/src/i18n/locales/en.json+++ b/dashboard/src/i18n/locales/en.json@@ -78,6 +78,13 @@"logs": "Logs"},"chats": {+ "media": {+ "location": "Location",+ "call": "Call",+ "callMissed": "Missed call",+ "callVideo": "Video call",+ "callVideoMissed": "Missed video call"+ },"subtitle": "Send and reply to WhatsApp messages in real time","noSessionsTitle": "No connected sessions","noSessionsDesc": "Please connect a WhatsApp session from the <1>Sessions</1> menu first to use the chat feature.",diff --git a/dashboard/src/i18n/locales/es.json b/dashboard/src/i18n/locales/es.jsonindex 29d65a072..362fc8c2b 100644--- a/dashboard/src/i18n/locales/es.json+++ b/dashboard/src/i18n/locales/es.json@@ -78,6 +78,13 @@"templates": "Plantillas"},"chats": {+ "media": {+ "location": "Ubicación",+ "call": "Llamada",+ "callMissed": "Llamada perdida",+ "callVideo": "Videollamada",+ "callVideoMissed": "Videollamada perdida"+ },"subtitle": "Envía y responde mensajes de WhatsApp en tiempo real","noSessionsTitle": "Sin sesiones conectadas","noSessionsDesc": "Conecta primero una sesión de WhatsApp desde el menú <1>Sesiones</1> para usar el chat.",diff --git a/dashboard/src/i18n/locales/fr.json b/dashboard/src/i18n/locales/fr.jsonindex 62edb6a8e..f3d4d4275 100644--- a/dashboard/src/i18n/locales/fr.json+++ b/dashboard/src/i18n/locales/fr.json@@ -78,6 +78,13 @@"logs": "Journaux"},"chats": {+ "media": {+ "location": "Localisation",+ "call": "Appel",+ "callMissed": "Appel manqué",+ "callVideo": "Appel vidéo",+ "callVideoMissed": "Appel vidéo manqué"+ },"subtitle": "Envoyez et répondez aux messages WhatsApp en temps réel","noSessionsTitle": "Aucune session connectée","noSessionsDesc": "Veuillez d'abord connecter une session WhatsApp depuis le menu <1>Sessions</1> pour utiliser la fonction de discussion.",diff --git a/dashboard/src/i18n/locales/he.json b/dashboard/src/i18n/locales/he.jsonindex 3325eeccf..0bfe63bd0 100644--- a/dashboard/src/i18n/locales/he.json+++ b/dashboard/src/i18n/locales/he.json@@ -78,6 +78,13 @@"logs": "לוגים"},"chats": {+ "media": {+ "location": "מיקום",+ "call": "שיחה",+ "callMissed": "שיחה שלא נענתה",+ "callVideo": "שיחת וידאו",+ "callVideoMissed": "שיחת וידאו שלא נענתה"+ },"subtitle": "שליחה ומענה להודעות WhatsApp בזמן אמת","noSessionsTitle": "אין סשנים מחוברים","noSessionsDesc": "יש לחבר סשן WhatsApp מתפריט <1>Sessions</1> תחילה כדי להשתמש בתכונת הצ'אט.",diff --git a/dashboard/src/i18n/locales/it.json b/dashboard/src/i18n/locales/it.jsonindex 331646efc..4d7de516a 100644--- a/dashboard/src/i18n/locales/it.json+++ b/dashboard/src/i18n/locales/it.json@@ -78,6 +78,13 @@"logs": "Log"},"chats": {+ "media": {+ "location": "Posizione",+ "call": "Chiamata",+ "callMissed": "Chiamata persa",+ "callVideo": "Videochiamata",+ "callVideoMissed": "Videochiamata persa"+ },"subtitle": "Invia e rispondi ai messaggi WhatsApp in tempo reale","noSessionsTitle": "Nessuna sessione connessa","noSessionsDesc": "Per utilizzare la funzione chat, connetti prima una sessione WhatsApp dal menu <1>Sessioni</1>.",diff --git a/dashboard/src/i18n/locales/pt-BR.json b/dashboard/src/i18n/locales/pt-BR.jsonindex f704f1fdf..d6fcd5193 100644--- a/dashboard/src/i18n/locales/pt-BR.json+++ b/dashboard/src/i18n/locales/pt-BR.json@@ -78,6 +78,13 @@"templates": "Modelos"},"chats": {+ "media": {+ "location": "Localização",+ "call": "Chamada",+ "callMissed": "Chamada perdida",+ "callVideo": "Chamada de vídeo",+ "callVideoMissed": "Chamada de vídeo perdida"+ },"subtitle": "Envie e responda mensagens do WhatsApp em tempo real","noSessionsTitle": "Nenhuma sessão conectada","noSessionsDesc": "Conecte primeiro uma sessão do WhatsApp no menu <1>Sessões</1> para usar o chat.",diff --git a/dashboard/src/i18n/locales/te.json b/dashboard/src/i18n/locales/te.jsonindex a313026df..3be8198f4 100644--- a/dashboard/src/i18n/locales/te.json+++ b/dashboard/src/i18n/locales/te.json@@ -78,6 +78,13 @@"logs": "లాగ్స్"},"chats": {+ "media": {+ "location": "స్థానం",+ "call": "కాల్",+ "callMissed": "మిస్డ్ కాల్",+ "callVideo": "వీడియో కాల్",+ "callVideoMissed": "మిస్డ్ వీడియో కాల్"+ },"subtitle": "వాట్సాప్ సందేశాలను నిజ-సమయంలో పంపండి మరియు ప్రత్యుత్తరం ఇవ్వండి","noSessionsTitle": "కనెక్ట్ అయిన సెషన్లు లేవు","noSessionsDesc": "చాట్ ఫీచర్ను ఉపయోగించడానికి దయచేసి ముందుగా <1>సెషన్స్</1> మెను నుండి ఒక వాట్సాప్ సెషన్ను కనెక్ట్ చేయండి.",diff --git a/dashboard/src/i18n/locales/zh-CN.json b/dashboard/src/i18n/locales/zh-CN.jsonindex cd1790a3f..6d0d8474d 100644--- a/dashboard/src/i18n/locales/zh-CN.json+++ b/dashboard/src/i18n/locales/zh-CN.json@@ -78,6 +78,13 @@"logs": "日志"},"chats": {+ "media": {+ "location": "位置",+ "call": "通话",+ "callMissed": "未接来电",+ "callVideo": "视频通话",+ "callVideoMissed": "未接视频通话"+ },"subtitle": "实时发送和回复 WhatsApp 消息","noSessionsTitle": "没有已连接的会话","noSessionsDesc": "请先从 <1>会话</1> 菜单连接一个 WhatsApp 会话,才能使用聊天功能。",diff --git a/dashboard/src/i18n/locales/zh-HK.json b/dashboard/src/i18n/locales/zh-HK.jsonindex 83d666bcb..dc7dce41b 100644--- a/dashboard/src/i18n/locales/zh-HK.json+++ b/dashboard/src/i18n/locales/zh-HK.json@@ -78,6 +78,13 @@"logs": "記錄"},"chats": {+ "media": {+ "location": "位置",+ "call": "通話",+ "callMissed": "未接來電",+ "callVideo": "視像通話",+ "callVideoMissed": "未接視像通話"+ },"subtitle": "即時傳送和回覆 WhatsApp 訊息","noSessionsTitle": "沒有已連線的工作階段","noSessionsDesc": "請先從 <1>工作階段</1> 選單連線一個 WhatsApp 工作階段,才能使用聊天功能。",diff --git a/dashboard/src/pages/Chats.tsx b/dashboard/src/pages/Chats.tsxindex fd3e419d9..11e0edc3d 100644--- a/dashboard/src/pages/Chats.tsx+++ b/dashboard/src/pages/Chats.tsx@@ -801,6 +801,39 @@ export function Chats() {const renderMedia = () => {if (msg.type === 'revoked') return null;+ // location/call have no downloadable media payload — render them before the+ // mediaInfo gate. The raw body (a base64 thumbnail / empty token) is suppressed below.+ if (msg.type === 'location') {+ // WhatsApp location messages carry a base64 JPEG map-preview thumbnail in `body`.+ const thumb = msg.body && msg.body.length > 100 ? `data:image/jpeg;base64,${msg.body}` : '';+ return (+ <div className="message-location">+ {thumb && (+ <img+ src={thumb}+ alt=""+ style={{ maxWidth: 220, borderRadius: 8, display: 'block', marginBottom: 4 }}+ />+ )}+ <span className="message-media-omitted">📍 {t('chats.media.location')}</span>+ </div>+ );+ }+ if (msg.type === 'call') {+ const call = msg.metadata?.call;+ const callKey = call?.video+ ? call.missed+ ? 'callVideoMissed'+ : 'callVideo'+ : call?.missed+ ? 'callMissed'+ : 'call';+ return (+ <div className="message-media-omitted">+ {`${call?.video ? '📹' : '📞'} ${t(`chats.media.${callKey}`)}`}+ </div>+ );+ }if (!mediaInfo) return null;if (mediaInfo.omitted) {return <div className="message-media-omitted">📎 Media</div>;@@ -884,7 +917,9 @@ export function Chats() {<div className="message-text">{t('chats.messageDeleted')}</div>) : (msg.body &&- (!mediaInfo || msg.body !== mediaInfo.filename) && (+ (!mediaInfo || msg.body !== mediaInfo.filename) &&+ msg.type !== 'location' &&+ msg.type !== 'call' && (<MessageBody text={msg.body} className="message-text" />))}diff --git a/dashboard/src/services/api.ts b/dashboard/src/services/api.tsindex 1dceb7574..a0068f955 100644--- a/dashboard/src/services/api.ts+++ b/dashboard/src/services/api.ts@@ -140,6 +140,7 @@ export const MESSAGE_TYPES = ['sticker','location','contact',+ 'call','revoked','unknown',] as const;@@ -166,6 +167,7 @@ export interface ChatMessage {media?: { mimetype: string; filename?: string; data?: string; omitted?: boolean; sizeBytes?: number };quotedMessage?: { id: string; body: string };reactions?: Record<string, string>;+ call?: { video: boolean; missed: boolean };};}diff --git a/dashboard/src/utils/chatMessages.ts b/dashboard/src/utils/chatMessages.tsindex 25b4e9602..d67f2021d 100644--- a/dashboard/src/utils/chatMessages.ts+++ b/dashboard/src/utils/chatMessages.ts@@ -54,6 +54,7 @@ export interface ChatMessageView extends ChatMessage {media?: MessageMedia;quotedMessage?: { id: string; body: string };reactions?: Record<string, string>;+ call?: { video: boolean; missed: boolean };};}diff --git a/docs/06-api-specification.md b/docs/06-api-specification.mdindex 2207e024e..78ee9a3b1 100644--- a/docs/06-api-specification.md+++ b/docs/06-api-specification.md@@ -783,7 +783,7 @@ Returns a bare array of engine-neutral `IncomingMessage` objects:]```-Each item may also include `isStatusBroadcast`, `mentionedIds`, `isLidSender`, `contact`, `media { mimetype, filename?, data?, omitted?, sizeBytes? }`, `quotedMessage { id, body }`, and `location { latitude, longitude, description?, address?, url? }`. `type` is one of `text|image|video|audio|voice|document|sticker|location|contact|revoked|unknown`.+Each item may also include `isStatusBroadcast`, `mentionedIds`, `isLidSender`, `contact`, `media { mimetype, filename?, data?, omitted?, sizeBytes? }`, `quotedMessage { id, body }`, `call { video, missed }` (for `call` messages), and `location { latitude, longitude, description?, address?, url? }`. `type` is one of `text|image|video|audio|voice|document|sticker|location|contact|call|revoked|unknown`.**Errors:** `400` session not active · `401` missing/invalid API key · `500` engine errordiff --git a/src/engine/adapters/message-mapper.spec.ts b/src/engine/adapters/message-mapper.spec.tsindex 86e851d1e..9439c4bd7 100644--- a/src/engine/adapters/message-mapper.spec.ts+++ b/src/engine/adapters/message-mapper.spec.ts@@ -122,6 +122,7 @@ describe('mapWwebjsMessageType (engine type-token -> neutral MessageType boundar['location', 'location'],['vcard', 'contact'],['multi_vcard', 'contact'],+ ['call_log', 'call'],['revoked', 'revoked'],['e2e_notification', 'unknown'], // any unmapped wwebjs type])('maps wwebjs type %s -> %s', (raw, expected) => {diff --git a/src/engine/adapters/message-mapper.ts b/src/engine/adapters/message-mapper.tsindex b91b9abd8..e566a37f9 100644--- a/src/engine/adapters/message-mapper.ts+++ b/src/engine/adapters/message-mapper.ts@@ -27,6 +27,8 @@ export function mapWwebjsMessageType(raw: string): MessageType {case 'vcard':case 'multi_vcard':return 'contact';+ case 'call_log':+ return 'call';case 'revoked':return 'revoked';default:diff --git a/src/engine/adapters/whatsapp-web-js.adapter.spec.ts b/src/engine/adapters/whatsapp-web-js.adapter.spec.tsindex 5d0485036..7e0b9dc5e 100644--- a/src/engine/adapters/whatsapp-web-js.adapter.spec.ts+++ b/src/engine/adapters/whatsapp-web-js.adapter.spec.ts@@ -8,6 +8,7 @@ import {loadRemoteMedia,resolveAuthTimeoutMs,wwebjsAckToDeliveryStatus,+ extractWwebjsCall,} from './whatsapp-web-js.adapter';import { getEffectiveWebVersionInfo, resolveWebVersionPin, __resetWebVersionCache } from '../wa-web-version';import * as fs from 'fs';@@ -910,3 +911,34 @@ describe('outbound mentions (#530)', () => {);});});++describe('extractWwebjsCall (call_log → { video, missed }, salvaged from #494)', () => {+ const m = (over: Record<string, unknown>) => over as unknown as Parameters<typeof extractWwebjsCall>[0];++ it('returns undefined for a non-call message', () => {+ expect(extractWwebjsCall(m({ type: 'chat' }))).toBeUndefined();+ });++ it('flags a video call with a recorded duration as not-missed', () => {+ expect(+ extractWwebjsCall(m({ type: 'call_log', fromMe: false, _data: { isVideoCall: true, callDuration: 30 } })),+ ).toEqual({+ video: true,+ missed: false,+ });+ });++ it('marks an unanswered incoming voice call (no duration) as missed', () => {+ expect(extractWwebjsCall(m({ type: 'call_log', fromMe: false, _data: {} }))).toEqual({+ video: false,+ missed: true,+ });+ });++ it('never marks an outgoing call as missed', () => {+ expect(extractWwebjsCall(m({ type: 'call_log', fromMe: true, _data: {} }))).toEqual({+ video: false,+ missed: false,+ });+ });+});diff --git a/src/engine/adapters/whatsapp-web-js.adapter.ts b/src/engine/adapters/whatsapp-web-js.adapter.tsindex 1af0fe0a3..7e158a76a 100644--- a/src/engine/adapters/whatsapp-web-js.adapter.ts+++ b/src/engine/adapters/whatsapp-web-js.adapter.ts@@ -73,6 +73,18 @@ export function wwebjsAckToDeliveryStatus(ack: number): DeliveryStatus {return 'pending';}+/**+ * Extract call detail from a whatsapp-web.js `call_log` message, or `undefined` for any other type.+ * The public Message wrapper doesn't expose call fields, so we read them off the raw `_data`. An+ * incoming call (`!fromMe`) with no recorded `callDuration` was never answered → missed; an outgoing+ * call is never "missed". Used by getChatHistory, where `call_log` entries actually appear.+ */+export function extractWwebjsCall(msg: Message): { video: boolean; missed: boolean } | undefined {+ if ((msg.type as string) !== 'call_log') return undefined;+ const d = (msg as unknown as { _data?: { isVideoCall?: boolean; callDuration?: number } })._data ?? {};+ return { video: Boolean(d.isVideoCall), missed: !msg.fromMe && !d.callDuration };+}+/*** Whether a per-session proxy URL parses to a supported scheme — defense-in-depth for a stored proxy* that bypassed DTO validation (e.g. loaded from the DB on restart). The host is NOT SSRF-blocked: a@@ -1322,6 +1334,8 @@ export class WhatsAppWebJsAdapter extends EventEmitter implements IWhatsAppEnginout.chatId = chatId;out.isGroup = chatId.endsWith('@g.us');out.isStatusBroadcast = chatId === 'status@broadcast';+ const call = extractWwebjsCall(msg);+ if (call) out.call = call;if (includeMedia && msg.hasMedia) {try {// Same pre-gate + limiter as live media: a large historical blob shouldn't bloat the response/heap.diff --git a/src/engine/interfaces/whatsapp-engine.interface.ts b/src/engine/interfaces/whatsapp-engine.interface.tsindex 299484225..968945a16 100644--- a/src/engine/interfaces/whatsapp-engine.interface.ts+++ b/src/engine/interfaces/whatsapp-engine.interface.ts@@ -53,6 +53,7 @@ export type MessageType =| 'sticker'| 'location'| 'contact'+ | 'call'| 'revoked'| 'unknown';@@ -79,6 +80,8 @@ export interface IncomingMessage {author?: string;/** WIDs @mentioned in the message (empty/absent when none). Surfaced for command targeting. */mentionedIds?: string[];+ /** Set for `call` (call_log) messages: video vs voice, and whether an incoming call went unanswered. */+ call?: { video: boolean; missed: boolean };/*** Set by the adapter when the sender is identified by a privacy id (e.g. a WhatsApp `@lid`) rather* than a phone number, so engine-neutral code can decide whether to attempt phone resolution withoutdiff --git a/src/modules/session/session.service.ts b/src/modules/session/session.service.tsindex 688be051f..481042174 100644--- a/src/modules/session/session.service.ts+++ b/src/modules/session/session.service.ts@@ -499,6 +499,7 @@ export class SessionService implements OnModuleDestroy, OnModuleInit, OnApplicatconst metadata: Record<string, unknown> = {};if (m.media) metadata.media = m.media;if (m.quotedMessage) metadata.quotedMessage = m.quotedMessage;+ if (m.call) metadata.call = m.call;const row = this.messageRepository.create({sessionId: id,waMessageId: m.id,@@ -686,6 +687,9 @@ export class SessionService implements OnModuleDestroy, OnModuleInit, OnApplicatif (incoming.quotedMessage) {metadata.quotedMessage = incoming.quotedMessage;}+ if (incoming.call) {+ metadata.call = incoming.call;+ }const dbMessage = this.messageRepository.create({sessionId: id,diff --git a/src/modules/webhook/filters/filter-types.ts b/src/modules/webhook/filters/filter-types.tsindex 4b005f638..24786cfae 100644--- a/src/modules/webhook/filters/filter-types.ts+++ b/src/modules/webhook/filters/filter-types.ts@@ -45,6 +45,7 @@ export const MESSAGE_TYPES = ['sticker','location','contact',+ 'call','revoked','unknown',] as const;