Skip to content

Free, Open Source, Self-Hosted WhatsApp API Gateway

fix(dashboard): address review comments for bulk CSV upload

Harry15d6bf23b2e7
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 02219ebaf..b737fdfbd 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
+- The dashboard's Message Tester gains an Upload CSV/TXT action to populate bulk recipients, localized across all thirteen locales.
+
- `PUPPETEER_PROTOCOL_TIMEOUT_MS` raises the per-browser-command budget on the whatsapp-web.js
engine, for large accounts whose reads fail with `Runtime.callFunctionOn timed out`. Unset keeps
Puppeteer's own budget, so nothing changes for a deployment that does not set it. The gateway
diff --git a/dashboard/src/i18n/locales/ar.json b/dashboard/src/i18n/locales/ar.json
index 47c3c3903..db57f4228 100644
--- a/dashboard/src/i18n/locales/ar.json
+++ b/dashboard/src/i18n/locales/ar.json
@@ -665,6 +665,7 @@
"forwardMessageId": "معرّف الرسالة",
"forwardMessageIdHint": "معرّف الرسالة المراد إعادة توجيهها",
"bulkRecipients": "المستلمون",
+ "bulkRecipientsUpload": "رفع CSV/TXT",
"bulkRecipientsPlaceholder": "+62812345678",
"bulkRecipientsHint": "رقم هاتف أو معرّف دردشة واحد في كل سطر (100 كحد أقصى)",
"bulkRecipientsCount": "المستلمون: {{count}}",
@@ -695,8 +696,7 @@
"progress": "تم إرسال {{sent}} من {{total}} · {{failed}} فشلت · {{pending}} قيد الانتظار",
"cancel": "إلغاء الدفعة",
"cancelling": "جارٍ الإلغاء..."
- },
- "bulkRecipientsUpload": "تحميل CSV/TXT"
+ }
},
"infrastructure": {
"title": "البنية التحتية",
diff --git a/dashboard/src/i18n/locales/de.json b/dashboard/src/i18n/locales/de.json
index c0535680f..d63a612b1 100644
--- a/dashboard/src/i18n/locales/de.json
+++ b/dashboard/src/i18n/locales/de.json
@@ -650,6 +650,7 @@
"forwardMessageId": "Nachrichten-ID",
"forwardMessageIdHint": "ID der weiterzuleitenden Nachricht",
"bulkRecipients": "Empfänger",
+ "bulkRecipientsUpload": "CSV/TXT hochladen",
"bulkRecipientsPlaceholder": "+491701234567",
"bulkRecipientsHint": "Eine Telefonnummer oder Chat-ID pro Zeile (max. 100)",
"bulkRecipientsCount": "Empfänger: {{count}}",
@@ -680,8 +681,7 @@
"progress": "{{sent}} von {{total}} gesendet · {{failed}} fehlgeschlagen · {{pending}} ausstehend",
"cancel": "Batch abbrechen",
"cancelling": "Wird abgebrochen..."
- },
- "bulkRecipientsUpload": "CSV/TXT hochladen"
+ }
},
"infrastructure": {
"title": "Infrastruktur",
diff --git a/dashboard/src/i18n/locales/es.json b/dashboard/src/i18n/locales/es.json
index 6db3a4175..52159bbea 100644
--- a/dashboard/src/i18n/locales/es.json
+++ b/dashboard/src/i18n/locales/es.json
@@ -604,6 +604,7 @@
"forwardMessageId": "ID del mensaje",
"forwardMessageIdHint": "ID del mensaje que se va a reenviar",
"bulkRecipients": "Destinatarios",
+ "bulkRecipientsUpload": "Subir CSV/TXT",
"bulkRecipientsPlaceholder": "+62812345678",
"bulkRecipientsHint": "Un número de teléfono o ID de chat por línea (máx. 100)",
"bulkRecipientsCount": "Destinatarios: {{count}}",
@@ -634,8 +635,7 @@
"progress": "Enviados {{sent}} de {{total}} · {{failed}} fallidos · {{pending}} pendientes",
"cancel": "Cancelar lote",
"cancelling": "Cancelando..."
- },
- "bulkRecipientsUpload": "Subir CSV/TXT"
+ }
},
"templates": {
"title": "Plantillas",
diff --git a/dashboard/src/i18n/locales/fr.json b/dashboard/src/i18n/locales/fr.json
index b6d35e49e..44372c1ea 100644
--- a/dashboard/src/i18n/locales/fr.json
+++ b/dashboard/src/i18n/locales/fr.json
@@ -650,6 +650,7 @@
"forwardMessageId": "ID du message",
"forwardMessageIdHint": "ID du message à transférer",
"bulkRecipients": "Destinataires",
+ "bulkRecipientsUpload": "Téléverser CSV/TXT",
"bulkRecipientsPlaceholder": "+62812345678",
"bulkRecipientsHint": "Un numéro de téléphone ou ID de chat par ligne (max 100)",
"bulkRecipientsCount": "Destinataires : {{count}}",
@@ -680,8 +681,7 @@
"progress": "Envoyés {{sent}} sur {{total}} · {{failed}} échoués · {{pending}} en attente",
"cancel": "Annuler le lot",
"cancelling": "Annulation..."
- },
- "bulkRecipientsUpload": "Télécharger CSV/TXT"
+ }
},
"infrastructure": {
"title": "Infrastructure",
diff --git a/dashboard/src/i18n/locales/he.json b/dashboard/src/i18n/locales/he.json
index 8961f8e2d..83c957faf 100644
--- a/dashboard/src/i18n/locales/he.json
+++ b/dashboard/src/i18n/locales/he.json
@@ -659,6 +659,7 @@
"forwardMessageId": "מזהה הודעה",
"forwardMessageIdHint": "מזהה ההודעה להעברה",
"bulkRecipients": "נמענים",
+ "bulkRecipientsUpload": "העלאת CSV/TXT",
"bulkRecipientsPlaceholder": "+62812345678",
"bulkRecipientsHint": "מספר טלפון או מזהה צ'אט אחד בכל שורה (עד 100)",
"bulkRecipientsCount": "נמענים: {{count}}",
@@ -689,8 +690,7 @@
"progress": "נשלחו {{sent}} מתוך {{total}} · {{failed}} נכשלו · {{pending}} ממתינים",
"cancel": "ביטול אצווה",
"cancelling": "מבטל..."
- },
- "bulkRecipientsUpload": "העלה CSV/TXT"
+ }
},
"infrastructure": {
"title": "תשתית",
diff --git a/dashboard/src/i18n/locales/it.json b/dashboard/src/i18n/locales/it.json
index 974cc046e..385f928a5 100644
--- a/dashboard/src/i18n/locales/it.json
+++ b/dashboard/src/i18n/locales/it.json
@@ -650,6 +650,7 @@
"forwardMessageId": "ID messaggio",
"forwardMessageIdHint": "ID del messaggio da inoltrare",
"bulkRecipients": "Destinatari",
+ "bulkRecipientsUpload": "Carica CSV/TXT",
"bulkRecipientsPlaceholder": "+62812345678",
"bulkRecipientsHint": "Un numero di telefono o ID chat per riga (max 100)",
"bulkRecipientsCount": "Destinatari: {{count}}",
@@ -680,8 +681,7 @@
"progress": "Inviati {{sent}} di {{total}} · {{failed}} non riusciti · {{pending}} in attesa",
"cancel": "Annulla batch",
"cancelling": "Annullamento..."
- },
- "bulkRecipientsUpload": "Carica CSV/TXT"
+ }
},
"infrastructure": {
"title": "Infrastruttura",
diff --git a/dashboard/src/i18n/locales/ko.json b/dashboard/src/i18n/locales/ko.json
index 2cfd98b7b..6927952db 100644
--- a/dashboard/src/i18n/locales/ko.json
+++ b/dashboard/src/i18n/locales/ko.json
@@ -650,6 +650,7 @@
"forwardMessageId": "메시지 ID",
"forwardMessageIdHint": "전달할 메시지의 ID",
"bulkRecipients": "수신자",
+ "bulkRecipientsUpload": "CSV/TXT 업로드",
"bulkRecipientsPlaceholder": "+62812345678",
"bulkRecipientsHint": "한 줄에 하나의 전화번호 또는 채팅 ID (최대 100개)",
"bulkRecipientsCount": "수신자: {{count}}",
@@ -680,8 +681,7 @@
"progress": "{{total}}개 중 {{sent}}개 전송됨 · {{failed}}개 실패 · {{pending}}개 대기 중",
"cancel": "배치 취소",
"cancelling": "취소 중..."
- },
- "bulkRecipientsUpload": "CSV/TXT 업로드"
+ }
},
"infrastructure": {
"title": "인프라",
diff --git a/dashboard/src/i18n/locales/pt-BR.json b/dashboard/src/i18n/locales/pt-BR.json
index f815a27d8..8a2818e72 100644
--- a/dashboard/src/i18n/locales/pt-BR.json
+++ b/dashboard/src/i18n/locales/pt-BR.json
@@ -604,6 +604,7 @@
"forwardMessageId": "ID da mensagem",
"forwardMessageIdHint": "ID da mensagem a ser encaminhada",
"bulkRecipients": "Destinatários",
+ "bulkRecipientsUpload": "Enviar CSV/TXT",
"bulkRecipientsPlaceholder": "+62812345678",
"bulkRecipientsHint": "Um número de telefone ou ID de chat por linha (máx. 100)",
"bulkRecipientsCount": "Destinatários: {{count}}",
@@ -634,8 +635,7 @@
"progress": "Enviadas {{sent}} de {{total}} · {{failed}} falharam · {{pending}} pendentes",
"cancel": "Cancelar lote",
"cancelling": "Cancelando..."
- },
- "bulkRecipientsUpload": "Enviar CSV/TXT"
+ }
},
"templates": {
"title": "Modelos",
diff --git a/dashboard/src/i18n/locales/te.json b/dashboard/src/i18n/locales/te.json
index 6ccc4ebc1..e24ac5d29 100644
--- a/dashboard/src/i18n/locales/te.json
+++ b/dashboard/src/i18n/locales/te.json
@@ -650,6 +650,7 @@
"forwardMessageId": "సందేశ ID",
"forwardMessageIdHint": "ఫార్వార్డ్ చేయాల్సిన సందేశం యొక్క ID",
"bulkRecipients": "గ్రహీతలు",
+ "bulkRecipientsUpload": "CSV/TXT అప్‌లోడ్ చేయండి",
"bulkRecipientsPlaceholder": "+62812345678",
"bulkRecipientsHint": "ఒక్కో లైన్‌లో ఒక ఫోన్ నంబర్ లేదా చాట్ ID (గరిష్టంగా 100)",
"bulkRecipientsCount": "గ్రహీతలు: {{count}}",
@@ -680,8 +681,7 @@
"progress": "{{total}}లో {{sent}} పంపబడ్డాయి · {{failed}} విఫలమయ్యాయి · {{pending}} పెండింగ్‌లో ఉన్నాయి",
"cancel": "బ్యాచ్‌ను రద్దు చేయండి",
"cancelling": "రద్దు చేస్తోంది..."
- },
- "bulkRecipientsUpload": "CSV/TXT అప్‌లోడ్ చేయండి"
+ }
},
"infrastructure": {
"title": "ఇన్‌ఫ్రాస్ట్రక్చర్",
diff --git a/dashboard/src/i18n/locales/tr.json b/dashboard/src/i18n/locales/tr.json
index 166737f84..2f9a43f85 100644
--- a/dashboard/src/i18n/locales/tr.json
+++ b/dashboard/src/i18n/locales/tr.json
@@ -650,6 +650,7 @@
"forwardMessageId": "Mesaj ID'si",
"forwardMessageIdHint": "İletilecek mesajın ID'si",
"bulkRecipients": "Alıcılar",
+ "bulkRecipientsUpload": "CSV/TXT Yükle",
"bulkRecipientsPlaceholder": "+905XXXXXXXXX",
"bulkRecipientsHint": "Her satıra bir telefon numarası veya sohbet ID'si (maks 100)",
"bulkRecipientsCount": "Alıcılar: {{count}}",
@@ -680,8 +681,7 @@
"progress": "{{total}} içerisinden {{sent}} gönderildi · {{failed}} başarısız · {{pending}} beklemede",
"cancel": "Toplu İşlemi İptal Et",
"cancelling": "İptal ediliyor..."
- },
- "bulkRecipientsUpload": "CSV/TXT Yükle"
+ }
},
"infrastructure": {
"title": "Altyapı",
diff --git a/dashboard/src/i18n/locales/zh-CN.json b/dashboard/src/i18n/locales/zh-CN.json
index 9288f00ef..9653cd5b9 100644
--- a/dashboard/src/i18n/locales/zh-CN.json
+++ b/dashboard/src/i18n/locales/zh-CN.json
@@ -650,6 +650,7 @@
"forwardMessageId": "消息 ID",
"forwardMessageIdHint": "要转发的消息 ID",
"bulkRecipients": "接收者",
+ "bulkRecipientsUpload": "上传 CSV/TXT",
"bulkRecipientsPlaceholder": "+62812345678",
"bulkRecipientsHint": "每行一个电话号码或聊天 ID(最多 100 个)",
"bulkRecipientsCount": "接收者:{{count}}",
@@ -680,8 +681,7 @@
"progress": "已发送 {{sent}}/{{total}} · {{failed}} 失败 · {{pending}} 待发送",
"cancel": "取消批次",
"cancelling": "取消中..."
- },
- "bulkRecipientsUpload": "上传 CSV/TXT"
+ }
},
"infrastructure": {
"title": "基础设施",
diff --git a/dashboard/src/i18n/locales/zh-HK.json b/dashboard/src/i18n/locales/zh-HK.json
index e8e42fff1..8bf8bf592 100644
--- a/dashboard/src/i18n/locales/zh-HK.json
+++ b/dashboard/src/i18n/locales/zh-HK.json
@@ -650,6 +650,7 @@
"forwardMessageId": "訊息 ID",
"forwardMessageIdHint": "要轉發的訊息 ID",
"bulkRecipients": "收件人",
+ "bulkRecipientsUpload": "上傳 CSV/TXT",
"bulkRecipientsPlaceholder": "+62812345678",
"bulkRecipientsHint": "每行一個電話號碼或對話 ID(最多 100 個)",
"bulkRecipientsCount": "收件人:{{count}}",
@@ -680,8 +681,7 @@
"progress": "已發送 {{sent}}/{{total}} · {{failed}} 失敗 · {{pending}} 待發送",
"cancel": "取消批次",
"cancelling": "取消中..."
- },
- "bulkRecipientsUpload": "上傳 CSV/TXT"
+ }
},
"infrastructure": {
"title": "基礎架構",
diff --git a/dashboard/src/pages/MessageTester.tsx b/dashboard/src/pages/MessageTester.tsx
index 163c865b5..063f7bfd3 100644
--- a/dashboard/src/pages/MessageTester.tsx
+++ b/dashboard/src/pages/MessageTester.tsx
@@ -103,6 +103,7 @@ export function MessageTester() {
// exclusive with mediaUrl: picking a file clears the URL field; typing a URL drops the file.
const [mediaFile, setMediaFile] = useState<{ base64: string; mimetype: string; filename: string } | null>(null);
const fileInputRef = useRef<HTMLInputElement>(null);
+ const bulkFileInputRef = useRef<HTMLInputElement>(null);
// Monotonic token invalidating an in-flight FileReader: a second pick, a URL edit, a removal,
// or an unmount before `onload` fires must win over the late-arriving bytes — otherwise the
// slower read overwrites the newer state (and re-clears a URL the user just typed).
@@ -195,25 +196,13 @@ export function MessageTester() {
if (!file) return;
const reader = new FileReader();
- reader.onload = ev => {
- const text = ev.target?.result as string;
- if (!text) return;
-
- const extracted = text
- .split(/[\r\n,]+/)
- .map(line => line.trim())
- .filter(line => line.length > 0);
-
- if (extracted.length === 0) return;
-
- setBulkRecipients(prev => {
- const prevList = prev
- .split('\n')
- .map(l => l.trim())
- .filter(l => l.length > 0);
- const combined = Array.from(new Set([...prevList, ...extracted]));
- return combined.join('\n');
- });
+ reader.onload = () => {
+ const text = reader.result;
+ if (typeof text !== 'string' || !text.trim()) return;
+ setBulkRecipients(prev => (prev.trim() ? `${prev.trimEnd()}\n` : '') + text.trim());
+ };
+ reader.onerror = () => {
+ setResponse({ success: false, timestamp: new Date().toISOString(), error: t('messageTester.fileReadError') });
};
reader.readAsText(file);
};
@@ -839,33 +828,16 @@ export function MessageTester() {
display: 'flex',
justifyContent: 'space-between',
alignItems: 'center',
- marginBottom: '8px',
+ marginBottom: '0.5rem',
}}
>
<label htmlFor="mt-11" style={{ marginBottom: 0 }}>
{t('messageTester.bulkRecipients')}
</label>
- <label
- className="upload-btn"
- style={{
- margin: 0,
- padding: '4px 8px',
- fontSize: '0.85rem',
- cursor: 'pointer',
- display: 'flex',
- alignItems: 'center',
- backgroundColor: 'var(--bg-secondary)',
- border: '1px solid var(--border-color)',
- borderRadius: '4px',
- textTransform: 'none',
- fontWeight: 500,
- letterSpacing: 'normal',
- }}
- >
- <Upload size={14} style={{ marginRight: '6px' }} />
- {t('messageTester.bulkRecipientsUpload')}
- <input type="file" accept=".txt,.csv" onChange={handleBulkFileChange} style={{ display: 'none' }} />
- </label>
+ <button type="button" className="browse-btn" onClick={() => bulkFileInputRef.current?.click()}>
+ <Upload size={14} /> {t('messageTester.bulkRecipientsUpload')}
+ </button>
+ <input ref={bulkFileInputRef} type="file" accept=".txt,.csv" style={{ display: 'none' }} onChange={handleBulkFileChange} />
</div>
<textarea
id="mt-11"