Skip to content

Free, Open Source, Self-Hosted WhatsApp API Gateway

feat(baileys): make the linked-device name brandable via BAILEYS_BROWSER_NAME (#822)

Yaqui Martínez Leudocbc036332f12
diff --git a/.env.example b/.env.example
index b9533598c..284f114f1 100644
--- a/.env.example
+++ b/.env.example
@@ -118,6 +118,10 @@ BAILEYS_AUTH_DIR=./data/baileys
# Pull the FULL message-history archive on connect (large). Off by default: the engine still enables the
# initial sync (contacts, chats, recent messages, lid mappings) without downloading the entire history.
BAILEYS_SYNC_FULL_HISTORY=false
+# Device name shown in WhatsApp Settings → Linked Devices for NEW pairings (existing sessions keep
+# the name they were paired with until re-linked). Default: OpenWA.
+# BAILEYS_BROWSER_NAME=
+
# Surface the Baileys library's own logs for debugging (trace|debug|info|warn|error). Silent by default.
# `trace` dumps the decoded WhatsApp wire frames to stdout (context "baileys-wire").
# BAILEYS_LOG_LEVEL=debug
diff --git a/src/engine/adapters/baileys.adapter.ts b/src/engine/adapters/baileys.adapter.ts
index 0e09ad0fb..5835b4d9c 100644
--- a/src/engine/adapters/baileys.adapter.ts
+++ b/src/engine/adapters/baileys.adapter.ts
@@ -57,8 +57,13 @@ import {
} from './inbound-media-cap';
import { ConcurrencyLimiter } from '../../common/utils/concurrency-limiter';
-/** Linked-device identity shown in WhatsApp (Settings → Linked Devices). */
-const BAILEYS_BROWSER: [string, string, string] = ['OpenWA', 'Chrome', '120.0.0'];
+/** Linked-device identity shown in WhatsApp (Settings → Linked Devices). The display name is
+ * operator-brandable via BAILEYS_BROWSER_NAME; it only applies to pairings made after the change. */
+const BAILEYS_BROWSER: [string, string, string] = [
+ process.env.BAILEYS_BROWSER_NAME?.trim() || 'OpenWA',
+ 'Chrome',
+ '120.0.0',
+];
/** Fully silent logger so Baileys does not spam stdout; diagnostics flow via connection.update. */
function createSilentLogger(): BaileysLogger {