Skip to content

Free, Open Source, Self-Hosted WhatsApp API Gateway

feat(dashboard): add CSV/TXT file upload for bulk recipients

Harry700747ea7eba
diff --git a/dashboard/src/i18n/locales/ar.json b/dashboard/src/i18n/locales/ar.json
index 3323755ad..47c3c3903 100644
--- a/dashboard/src/i18n/locales/ar.json
+++ b/dashboard/src/i18n/locales/ar.json
@@ -695,7 +695,8 @@
"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 4542b1e67..c0535680f 100644
--- a/dashboard/src/i18n/locales/de.json
+++ b/dashboard/src/i18n/locales/de.json
@@ -680,7 +680,8 @@
"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/en.json b/dashboard/src/i18n/locales/en.json
index f4b323e61..595046dfc 100644
--- a/dashboard/src/i18n/locales/en.json
+++ b/dashboard/src/i18n/locales/en.json
@@ -650,6 +650,7 @@
"forwardMessageId": "Message ID",
"forwardMessageIdHint": "ID of the message to forward",
"bulkRecipients": "Recipients",
+ "bulkRecipientsUpload": "Upload CSV/TXT",
"bulkRecipientsPlaceholder": "+62812345678",
"bulkRecipientsHint": "One phone number or chat ID per line (max 100)",
"bulkRecipientsCount": "Recipients: {{count}}",
diff --git a/dashboard/src/i18n/locales/es.json b/dashboard/src/i18n/locales/es.json
index a6c7c347c..6db3a4175 100644
--- a/dashboard/src/i18n/locales/es.json
+++ b/dashboard/src/i18n/locales/es.json
@@ -634,7 +634,8 @@
"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 1b80b8ed9..b6d35e49e 100644
--- a/dashboard/src/i18n/locales/fr.json
+++ b/dashboard/src/i18n/locales/fr.json
@@ -680,7 +680,8 @@
"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 e82baf561..8961f8e2d 100644
--- a/dashboard/src/i18n/locales/he.json
+++ b/dashboard/src/i18n/locales/he.json
@@ -689,7 +689,8 @@
"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 8196a0c5b..974cc046e 100644
--- a/dashboard/src/i18n/locales/it.json
+++ b/dashboard/src/i18n/locales/it.json
@@ -680,7 +680,8 @@
"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 41ba479cf..2cfd98b7b 100644
--- a/dashboard/src/i18n/locales/ko.json
+++ b/dashboard/src/i18n/locales/ko.json
@@ -680,7 +680,8 @@
"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 01f28ece6..f815a27d8 100644
--- a/dashboard/src/i18n/locales/pt-BR.json
+++ b/dashboard/src/i18n/locales/pt-BR.json
@@ -634,7 +634,8 @@
"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 df2eae15e..6ccc4ebc1 100644
--- a/dashboard/src/i18n/locales/te.json
+++ b/dashboard/src/i18n/locales/te.json
@@ -680,7 +680,8 @@
"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 4a3700198..166737f84 100644
--- a/dashboard/src/i18n/locales/tr.json
+++ b/dashboard/src/i18n/locales/tr.json
@@ -680,7 +680,8 @@
"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 3441f04c0..9288f00ef 100644
--- a/dashboard/src/i18n/locales/zh-CN.json
+++ b/dashboard/src/i18n/locales/zh-CN.json
@@ -680,7 +680,8 @@
"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 ad176393f..e8e42fff1 100644
--- a/dashboard/src/i18n/locales/zh-HK.json
+++ b/dashboard/src/i18n/locales/zh-HK.json
@@ -680,7 +680,8 @@
"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 8079d2c7f..163c865b5 100644
--- a/dashboard/src/pages/MessageTester.tsx
+++ b/dashboard/src/pages/MessageTester.tsx
@@ -189,6 +189,35 @@ export function MessageTester() {
}, 2000);
};
+ const handleBulkFileChange = (e: ChangeEvent<HTMLInputElement>) => {
+ const file = e.target.files?.[0];
+ e.target.value = '';
+ 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.readAsText(file);
+ };
+
const handleCancelBatch = async () => {
if (!batchStatus || !batchSessionRef.current) return;
setBatchCancelling(true);
@@ -805,7 +834,39 @@ export function MessageTester() {
{messageType === 'bulk' && (
<>
<div className="form-group">
- <label htmlFor="mt-11">{t('messageTester.bulkRecipients')}</label>
+ <div
+ style={{
+ display: 'flex',
+ justifyContent: 'space-between',
+ alignItems: 'center',
+ marginBottom: '8px',
+ }}
+ >
+ <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>
+ </div>
<textarea
id="mt-11"
value={bulkRecipients}