Free, Open Source, Self-Hosted WhatsApp API Gateway
TypeScript apibotgatewayself-hostedwhatsappwhatsapp-apiwhatsapp-automationwhatsapp-botwhatsapp-gatewaywhatsapp-gateway-apiwhatsapp-webwhatsapp-web-api
feat(channels): create, delete and mute channels
Yudhi Armyndharisd5078c24f5ec
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex ef1a96165..29da2c05b 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -24,6 +24,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0### Added+- **Channel administration: create, delete, mute.** `POST /api/sessions/:sessionId/channels`,+ `POST .../channels/:channelId/delete` and `POST .../channels/:channelId/mute`, in all five SDKs.++ Supported on **both** engines — whatsapp-web.js has `createChannel`/`deleteChannel` and mute on the+ Channel model, and Baileys has the matching newsletter calls. (The enhancement notes this was+ planned against expected `501`s on whatsapp-web.js; checking the library showed otherwise, so both+ engines are wired.)++ Deletion is `POST .../delete`, not `DELETE .../channels/:channelId` — that route already exists and+ means *unsubscribe*. Leaving a channel and destroying it for every subscriber are very different+ acts, and one mistyped verb should not be able to turn the first into the second.++ Two whatsapp-web.js failure modes are translated rather than passed on: `createChannel` signals+ failure by **returning an error string** instead of throwing, which would otherwise have been+ mapped into a channel object full of undefineds and reported as success; and `deleteChannel` and+ the mute calls return `false` rather than raising. All three now surface as a refusal.+- **Labels can now be created, renamed, recoloured and deleted** — `PUT` and`DELETE /api/sessions/:sessionId/labels/:labelId` — and **listed by chat**:`GET /api/sessions/:sessionId/labels/:labelId/chats`. All five SDKs gain the matching methods.diff --git a/docs/06-api-specification.md b/docs/06-api-specification.mdindex d69842531..e9b8e6699 100644--- a/docs/06-api-specification.md+++ b/docs/06-api-specification.md@@ -3174,6 +3174,63 @@ Bare array. `timestamp` is an epoch number (seconds).**Errors:** `400` `Session is not started` · `401` missing/invalid API key+#### POST /api/sessions/:sessionId/channels++Create a channel. Supported on **both** engines.++**Auth:** API key (OPERATOR) · **Scope:** session-scoped++The account becomes the channel's owner, which is what makes deleting it possible later — neither+engine can delete a channel it does not own.++**Request body** — `CreateChannelDto`++| Field | Type | Required | Constraints | Description |+| --- | --- | --- | --- | --- |+| `name` | string | Yes | 1–100 chars | Channel name |+| `description` | string | No | ≤ 2048 chars | Channel description |++**Response** `201` — the created `Channel`, including its `inviteCode` (the code, not the full+`https://whatsapp.com/channel/…` link — the code is what `POST /channels/subscribe` takes).++**Errors:** `400` validation, or session not started · `401` · `403` · `422` the engine refused — on whatsapp-web.js this includes channel creation being disabled for the account++#### POST /api/sessions/:sessionId/channels/:channelId/delete++Delete a channel this account owns. Supported on **both** engines.++**Auth:** API key (OPERATOR) · **Scope:** session-scoped++Irreversible, and every subscriber loses the channel.++> **Why not `DELETE /channels/:channelId`?** That route already exists and means *unsubscribe*.+> Leaving a channel and destroying it are very different acts, and they must not be reachable by the+> same request with one wrong verb — so deletion takes an explicit path, matching the+> `POST .../messages/delete` and `POST .../chats/delete` convention used elsewhere.++**Response** `200` — `{ "success": true }`++**Errors:** `400` session not started · `401` · `403` · `422` the engine refused — not found, or this account does not own it++#### POST /api/sessions/:sessionId/channels/:channelId/mute++Mute or unmute a channel. Supported on **both** engines.++**Auth:** API key (OPERATOR) · **Scope:** session-scoped++Silences the channel's notifications for this account. The subscription is untouched — this is not a+soft unsubscribe.++**Request body** — `MuteChannelDto`++| Field | Type | Required | Description |+| --- | --- | --- | --- |+| `mute` | boolean | Yes | `true` mutes, `false` unmutes |++**Response** `200` — `{ "success": true }`++**Errors:** `400` validation, or session not started · `401` · `403` · `422` the engine refused+#### POST /api/sessions/:sessionId/channels/subscribeSubscribe to a channel using its invite code.diff --git a/docs/29-engine-capability-matrix.md b/docs/29-engine-capability-matrix.mdindex 473f9c86e..c3cf38fe7 100644--- a/docs/29-engine-capability-matrix.md+++ b/docs/29-engine-capability-matrix.md@@ -174,8 +174,8 @@ These are hand-maintained and had drifted from the source before this pass; theyfrom `engine-capability-matrix.ts` rather than adjusted by hand. Re-derive them the same way whenadding a method, instead of incrementing the previous figure.-- **95** interface methods, **190** adapter-cells (95 × 2 engines).-- **168** supported cells; **22** not-available cells across **21** methods.+- **98** interface methods, **196** adapter-cells (98 × 2 engines).+- **174** supported cells; **22** not-available cells across **21** methods.- Of the 22 not-available cells: **2 adapter-gaps** (fixable) + **20 library-limitations** + **0 uncertain**.- **0 phantom-support rows** — every `not-available` row throws at the adapter boundary.diff --git a/openapi.json b/openapi.jsonindex abc0d884f..6d0dc8ffc 100644--- a/openapi.json+++ b/openapi.json@@ -4778,6 +4778,46 @@"tags": ["channels"]+ },+ "post": {+ "description": "The account becomes the channel owner, which is what makes deleting it possible later — neither engine can delete a channel it does not own.",+ "operationId": "ChannelController_create",+ "parameters": [+ {+ "name": "sessionId",+ "required": true,+ "in": "path",+ "description": "Session ID",+ "schema": {+ "type": "string"+ }+ }+ ],+ "requestBody": {+ "required": true,+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/CreateChannelDto"+ }+ }+ }+ },+ "responses": {+ "201": {+ "description": "The created channel"+ },+ "400": {+ "description": "Session not started, or validation failed"+ },+ "422": {+ "description": "The engine refused — channel creation may be disabled for this account"+ }+ },+ "summary": "Create a channel",+ "tags": [+ "channels"+ ]}},"/api/sessions/{sessionId}/channels/{channelId}": {@@ -4892,6 +4932,98 @@]}},+ "/api/sessions/{sessionId}/channels/{channelId}/delete": {+ "post": {+ "description": "Irreversible, and every subscriber loses the channel. Deliberately NOT `DELETE /channels/:channelId` — that route unsubscribes, and the two must not be reachable by the same request with a slip of the wrist. Only the owner can delete.",+ "operationId": "ChannelController_remove",+ "parameters": [+ {+ "name": "sessionId",+ "required": true,+ "in": "path",+ "description": "Session ID",+ "schema": {+ "type": "string"+ }+ },+ {+ "name": "channelId",+ "required": true,+ "in": "path",+ "description": "Channel ID",+ "schema": {+ "type": "string"+ }+ }+ ],+ "responses": {+ "200": {+ "description": "Channel deleted"+ },+ "400": {+ "description": "Session not started"+ },+ "422": {+ "description": "The engine refused — not found, or this account does not own it"+ }+ },+ "summary": "Delete a channel this account owns",+ "tags": [+ "channels"+ ]+ }+ },+ "/api/sessions/{sessionId}/channels/{channelId}/mute": {+ "post": {+ "description": "Silences the channel's notifications for this account. The subscription is untouched.",+ "operationId": "ChannelController_mute",+ "parameters": [+ {+ "name": "sessionId",+ "required": true,+ "in": "path",+ "description": "Session ID",+ "schema": {+ "type": "string"+ }+ },+ {+ "name": "channelId",+ "required": true,+ "in": "path",+ "description": "Channel ID",+ "schema": {+ "type": "string"+ }+ }+ ],+ "requestBody": {+ "required": true,+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/MuteChannelDto"+ }+ }+ }+ },+ "responses": {+ "200": {+ "description": "Channel muted or unmuted"+ },+ "400": {+ "description": "Session not started, or validation failed"+ },+ "422": {+ "description": "The engine refused"+ }+ },+ "summary": "Mute or unmute a channel",+ "tags": [+ "channels"+ ]+ }+ },"/api/sessions/{sessionId}/channels/subscribe": {"post": {"operationId": "ChannelController_subscribe",@@ -8681,6 +8813,38 @@}}},+ "CreateChannelDto": {+ "type": "object",+ "properties": {+ "name": {+ "type": "string",+ "description": "Channel name",+ "example": "Product updates",+ "maxLength": 100+ },+ "description": {+ "type": "string",+ "description": "Channel description",+ "example": "Release notes and downtime notices"+ }+ },+ "required": [+ "name"+ ]+ },+ "MuteChannelDto": {+ "type": "object",+ "properties": {+ "mute": {+ "type": "boolean",+ "description": "True to mute the channel, false to unmute it. Subscription is unaffected either way.",+ "example": true+ }+ },+ "required": [+ "mute"+ ]+ },"SendTextStatusDto": {"type": "object","properties": {diff --git a/sdk/go/channels.go b/sdk/go/channels.goindex 98a8c68a1..120bb9ca7 100644--- a/sdk/go/channels.go+++ b/sdk/go/channels.go@@ -34,6 +34,30 @@ func (s *ChannelsService) Messages(ctx context.Context, sessionID, channelID strreturn out, err}+// Create makes a channel. The account owns it, which is what makes Delete possible later.+func (s *ChannelsService) Create(ctx context.Context, sessionID string, body CreateChannelRequest) (*ChannelRecord, error) {+ var out ChannelRecord+ err := s.client.do(ctx, "POST", s.base(sessionID), nil, body, &out)+ return &out, err+}++// Delete destroys a channel this account owns. Irreversible, and every subscriber loses it.+//+// Note the path: Unsubscribe is the DELETE route, and the two are deliberately not reachable by the+// same request — leaving a channel and destroying it are very different acts.+func (s *ChannelsService) Delete(ctx context.Context, sessionID, channelID string) (*SuccessResult, error) {+ var out SuccessResult+ err := s.client.do(ctx, "POST", s.base(sessionID)+"/"+pathEscape(channelID)+"/delete", nil, nil, &out)+ return &out, err+}++// Mute mutes or unmutes a channel's notifications. The subscription is untouched either way.+func (s *ChannelsService) Mute(ctx context.Context, sessionID, channelID string, body MuteChannelRequest) (*SuccessResult, error) {+ var out SuccessResult+ err := s.client.do(ctx, "POST", s.base(sessionID)+"/"+pathEscape(channelID)+"/mute", nil, body, &out)+ return &out, err+}+// Subscribe subscribes to a channel by invite code. Requires an OPERATOR-level key.func (s *ChannelsService) Subscribe(ctx context.Context, sessionID string, body SubscribeChannelRequest) (*ChannelRecord, error) {var out ChannelRecorddiff --git a/sdk/go/routing_test.go b/sdk/go/routing_test.goindex c5332461d..b1eefbe2e 100644--- a/sdk/go/routing_test.go+++ b/sdk/go/routing_test.go@@ -91,6 +91,9 @@ func TestRouting(t *testing.T) {{"Chats.List", func(c *Client) { c.Chats.List(ctx, "s1", nil) }, "GET", "/api/sessions/s1/chats"},{"Chats.MarkRead", func(c *Client) { c.Chats.MarkRead(ctx, "s1", MarkChatRequest{}) }, "POST", "/api/sessions/s1/chats/read"},{"Chats.SubscribePresence", func(c *Client) { c.Chats.SubscribePresence(ctx, "s1", MarkChatRequest{}) }, "POST", "/api/sessions/s1/presence/subscribe"},+ {"Channels.Create", func(c *Client) { c.Channels.Create(ctx, "s1", CreateChannelRequest{}) }, "POST", "/api/sessions/s1/channels"},+ {"Channels.Delete", func(c *Client) { c.Channels.Delete(ctx, "s1", "ch1") }, "POST", "/api/sessions/s1/channels/ch1/delete"},+ {"Channels.Mute", func(c *Client) { c.Channels.Mute(ctx, "s1", "ch1", MuteChannelRequest{}) }, "POST", "/api/sessions/s1/channels/ch1/mute"},{"Labels.Chats", func(c *Client) { c.Labels.Chats(ctx, "s1", "l1") }, "GET", "/api/sessions/s1/labels/l1/chats"},{"Labels.Upsert", func(c *Client) { c.Labels.Upsert(ctx, "s1", "l1", UpsertLabelRequest{}) }, "PUT", "/api/sessions/s1/labels/l1"},{"Labels.Delete", func(c *Client) { c.Labels.Delete(ctx, "s1", "l1") }, "DELETE", "/api/sessions/s1/labels/l1"},diff --git a/sdk/go/types_session.go b/sdk/go/types_session.goindex 69348ac94..89b79c325 100644--- a/sdk/go/types_session.go+++ b/sdk/go/types_session.go@@ -15,6 +15,18 @@ func (q *ListSessionsQuery) values() url.Values {return v}+// CreateChannelRequest is the body for creating a channel.+type CreateChannelRequest struct {+ Name string `json:"name"`+ Description string `json:"description,omitempty"`+}++// MuteChannelRequest is the body for muting or unmuting a channel. The subscription is unaffected+// either way.+type MuteChannelRequest struct {+ Mute bool `json:"mute"`+}+// UpsertLabelRequest is a label create-or-update body. The id travels in the path, because WhatsApp// keys the write on it.type UpsertLabelRequest struct {diff --git a/sdk/java/src/main/java/com/rmyndharis/openwa/model/CreateChannelRequest.java b/sdk/java/src/main/java/com/rmyndharis/openwa/model/CreateChannelRequest.javanew file mode 100644index 000000000..5c98a7361--- /dev/null+++ b/sdk/java/src/main/java/com/rmyndharis/openwa/model/CreateChannelRequest.java@@ -0,0 +1,4 @@+package com.rmyndharis.openwa.model;++/** Body for creating a channel. */+public record CreateChannelRequest(String name, String description) {}diff --git a/sdk/java/src/main/java/com/rmyndharis/openwa/model/MuteChannelRequest.java b/sdk/java/src/main/java/com/rmyndharis/openwa/model/MuteChannelRequest.javanew file mode 100644index 000000000..616eff6e6--- /dev/null+++ b/sdk/java/src/main/java/com/rmyndharis/openwa/model/MuteChannelRequest.java@@ -0,0 +1,8 @@+package com.rmyndharis.openwa.model;++/**+ * Body for muting or unmuting a channel.+ *+ * @param mute {@code true} mutes, {@code false} unmutes; the subscription is unaffected either way+ */+public record MuteChannelRequest(boolean mute) {}diff --git a/sdk/java/src/main/java/com/rmyndharis/openwa/resources/ChannelsResource.java b/sdk/java/src/main/java/com/rmyndharis/openwa/resources/ChannelsResource.javaindex 6893b5cc7..fd6d45a26 100644--- a/sdk/java/src/main/java/com/rmyndharis/openwa/resources/ChannelsResource.java+++ b/sdk/java/src/main/java/com/rmyndharis/openwa/resources/ChannelsResource.java@@ -7,6 +7,8 @@ import com.rmyndharis.openwa.http.HttpMethod;import com.rmyndharis.openwa.model.ChannelMessageQuery;import com.rmyndharis.openwa.model.ChannelMessageRecord;import com.rmyndharis.openwa.model.ChannelRecord;+import com.rmyndharis.openwa.model.CreateChannelRequest;+import com.rmyndharis.openwa.model.MuteChannelRequest;import com.rmyndharis.openwa.model.SubscribeChannelRequest;import com.rmyndharis.openwa.model.SuccessResult;import java.util.List;@@ -49,6 +51,37 @@ public final class ChannelsResource {ChannelMessageRecord.class);}+ /** Create a channel. The account owns it, which is what makes {@link #delete} possible later. */+ public ChannelRecord create(String sessionId, CreateChannelRequest body) {+ return client.request(+ HttpMethod.POST, "/api/sessions/" + encodeSegment(sessionId) + "/channels", null, body, ChannelRecord.class);+ }++ /**+ * Delete a channel this account owns. Irreversible, and every subscriber loses it.+ *+ * <p>Note the path: {@code unsubscribe} is the {@code DELETE} route, and the two are deliberately+ * not reachable by the same request — leaving a channel and destroying it are very different acts.+ */+ public SuccessResult delete(String sessionId, String channelId) {+ return client.request(+ HttpMethod.POST,+ "/api/sessions/" + encodeSegment(sessionId) + "/channels/" + encodeSegment(channelId) + "/delete",+ null,+ null,+ SuccessResult.class);+ }++ /** Mute or unmute a channel's notifications. The subscription is untouched either way. */+ public SuccessResult mute(String sessionId, String channelId, MuteChannelRequest body) {+ return client.request(+ HttpMethod.POST,+ "/api/sessions/" + encodeSegment(sessionId) + "/channels/" + encodeSegment(channelId) + "/mute",+ null,+ body,+ SuccessResult.class);+ }+/** Subscribe to a channel using its invite code. Requires an OPERATOR-level key. */public ChannelRecord subscribe(String sessionId, SubscribeChannelRequest body) {return client.request(diff --git a/sdk/javascript/src/resources/channels.ts b/sdk/javascript/src/resources/channels.tsindex 20af165b6..8191a5ae4 100644--- a/sdk/javascript/src/resources/channels.ts+++ b/sdk/javascript/src/resources/channels.ts@@ -8,6 +8,8 @@import { encodeSegment } from '../http.js';import type { OpenWAClient } from '../client.js';import type {+ CreateChannelRequest,+ MuteChannelRequest,ChannelMessageQuery,ChannelMessageRecord,ChannelRecord,@@ -44,6 +46,37 @@ export class ChannelsResource {}/** Subscribe to a channel using its invite code. Requires an OPERATOR-level key. */+ /** Create a channel. The account owns it, which is what makes `delete` possible later. */+ create(sessionId: string, body: CreateChannelRequest): Promise<ChannelRecord> {+ return this.client.request<ChannelRecord>({+ method: 'POST',+ path: `/api/sessions/${encodeSegment(sessionId)}/channels`,+ body,+ });+ }++ /**+ * Delete a channel this account owns. Irreversible, and every subscriber loses it.+ *+ * Note the path: `unsubscribe` is the `DELETE` route, and these two are deliberately not reachable+ * by the same request — leaving a channel and destroying it are very different acts.+ */+ delete(sessionId: string, channelId: string): Promise<SuccessResult> {+ return this.client.request<SuccessResult>({+ method: 'POST',+ path: `/api/sessions/${encodeSegment(sessionId)}/channels/${encodeSegment(channelId)}/delete`,+ });+ }++ /** Mute or unmute a channel's notifications. The subscription is untouched either way. */+ mute(sessionId: string, channelId: string, body: MuteChannelRequest): Promise<SuccessResult> {+ return this.client.request<SuccessResult>({+ method: 'POST',+ path: `/api/sessions/${encodeSegment(sessionId)}/channels/${encodeSegment(channelId)}/mute`,+ body,+ });+ }+subscribe(sessionId: string, body: SubscribeChannelRequest): Promise<ChannelRecord> {return this.client.request<ChannelRecord>({method: 'POST',diff --git a/sdk/javascript/src/types.ts b/sdk/javascript/src/types.tsindex 45c4de8a3..d32f54e2b 100644--- a/sdk/javascript/src/types.ts+++ b/sdk/javascript/src/types.ts@@ -113,6 +113,18 @@ export interface UpsertLabelRequest {color?: number;}+/** Body for creating a channel. */+export interface CreateChannelRequest {+ name: string;+ description?: string;+}++/** Body for muting or unmuting a channel. */+export interface MuteChannelRequest {+ /** True mutes, false unmutes. The subscription is unaffected either way. */+ mute: boolean;+}+export interface CreateSessionRequest {/** Alphanumeric + hyphens, 3–50 chars. */name: string;diff --git a/sdk/php/src/Resources/ChannelsResource.php b/sdk/php/src/Resources/ChannelsResource.phpindex 3cae6543d..5af671024 100644--- a/sdk/php/src/Resources/ChannelsResource.php+++ b/sdk/php/src/Resources/ChannelsResource.php@@ -43,6 +43,40 @@ class ChannelsResourcereturn $this->http->request('GET', "/api/sessions/{$this->http->encodeSegment($sessionId)}/channels/{$this->http->encodeSegment($channelId)}/messages", $query) ?? [];}+ /**+ * Create a channel. The account owns it, which is what makes delete() possible later.+ *+ * @param array<string,mixed> $body+ * @return array<string,mixed>+ */+ public function create(string $sessionId, array $body): array+ {+ return $this->http->request('POST', "/api/sessions/{$this->http->encodeSegment($sessionId)}/channels", [], $body);+ }++ /**+ * Delete a channel this account owns. Irreversible; every subscriber loses it.+ *+ * Note the path: unsubscribe is the DELETE route, and the two are deliberately not reachable by+ * the same request — leaving a channel and destroying it are very different acts.+ *+ * @return array<string,mixed>+ */+ public function delete(string $sessionId, string $channelId): array+ {+ return $this->http->request('POST', "/api/sessions/{$this->http->encodeSegment($sessionId)}/channels/{$this->http->encodeSegment($channelId)}/delete");+ }++ /**+ * Mute or unmute a channel's notifications. The subscription is untouched either way.+ *+ * @param array<string,mixed> $body+ * @return array<string,mixed>+ */+ public function mute(string $sessionId, string $channelId, array $body): array+ {+ return $this->http->request('POST', "/api/sessions/{$this->http->encodeSegment($sessionId)}/channels/{$this->http->encodeSegment($channelId)}/mute", [], $body);+ }/*** Subscribe to a channel using its invite code. Requires an OPERATOR-level key.*diff --git a/sdk/python/openwa/resources/channels.py b/sdk/python/openwa/resources/channels.pyindex 07c07adbf..cda4d57f6 100644--- a/sdk/python/openwa/resources/channels.py+++ b/sdk/python/openwa/resources/channels.py@@ -10,6 +10,8 @@ from typing import TYPE_CHECKINGfrom .._http import quote_segmentfrom ..types import (+ CreateChannelRequest,+ MuteChannelRequest,ChannelMessageQuery,ChannelMessageRecord,ChannelRecord,@@ -38,6 +40,26 @@ class ChannelsResource:"GET", f"/api/sessions/{quote_segment(session_id)}/channels/{quote_segment(channel_id)}/messages", query=query)+ def create(self, session_id: str, body: CreateChannelRequest) -> ChannelRecord:+ """Create a channel. The account owns it, which is what makes delete() possible later."""+ return self._http.request("POST", f"/api/sessions/{quote_segment(session_id)}/channels", body=body)++ def delete(self, session_id: str, channel_id: str) -> SuccessResult:+ """Delete a channel this account owns. Irreversible; every subscriber loses it.++ Note the path: unsubscribe is the DELETE route, and the two are deliberately not reachable+ by the same request -- leaving a channel and destroying it are very different acts.+ """+ return self._http.request(+ "POST", f"/api/sessions/{quote_segment(session_id)}/channels/{quote_segment(channel_id)}/delete"+ )++ def mute(self, session_id: str, channel_id: str, body: MuteChannelRequest) -> SuccessResult:+ """Mute or unmute a channel's notifications. The subscription is untouched either way."""+ return self._http.request(+ "POST", f"/api/sessions/{quote_segment(session_id)}/channels/{quote_segment(channel_id)}/mute", body=body+ )+def subscribe(self, session_id: str, body: SubscribeChannelRequest) -> ChannelRecord:"""Subscribe to a channel using its invite code. Requires an OPERATOR-level key."""return self._http.request("POST", f"/api/sessions/{quote_segment(session_id)}/channels/subscribe", body=body)diff --git a/sdk/python/openwa/types.py b/sdk/python/openwa/types.pyindex 163d2953d..b3652b258 100644--- a/sdk/python/openwa/types.py+++ b/sdk/python/openwa/types.py@@ -72,6 +72,20 @@ class UpsertLabelRequest(TypedDict, total=False):color: int+class CreateChannelRequest(TypedDict, total=False):+ """Body for creating a channel."""++ name: str+ description: str+++class MuteChannelRequest(TypedDict):+ """Body for muting or unmuting a channel."""++ # True mutes, False unmutes. The subscription is unaffected either way.+ mute: bool++# ── Session ───────────────────────────────────────────────────────diff --git a/src/engine/adapters/baileys-channels.ts b/src/engine/adapters/baileys-channels.tsindex 75d6da257..d198fdecc 100644--- a/src/engine/adapters/baileys-channels.ts+++ b/src/engine/adapters/baileys-channels.ts@@ -38,6 +38,22 @@ export class BaileysChannels {return this.toChannel(meta);}+ async createChannel(name: string, description?: string): Promise<Channel> {+ this.host.ensureReady();+ const meta = await this.sock().newsletterCreate(name, description);+ return this.toChannel(meta);+ }++ async deleteChannel(channelId: string): Promise<void> {+ this.host.ensureReady();+ await this.sock().newsletterDelete(channelId);+ }++ async muteChannel(channelId: string, mute: boolean): Promise<void> {+ this.host.ensureReady();+ await (mute ? this.sock().newsletterMute(channelId) : this.sock().newsletterUnmute(channelId));+ }+async unsubscribeFromChannel(channelId: string): Promise<void> {this.host.ensureReady();await this.sock().newsletterUnfollow(channelId);diff --git a/src/engine/adapters/baileys.adapter.spec.ts b/src/engine/adapters/baileys.adapter.spec.tsindex f2b09eb3b..a25ab2c0f 100644--- a/src/engine/adapters/baileys.adapter.spec.ts+++ b/src/engine/adapters/baileys.adapter.spec.ts@@ -61,6 +61,10 @@ class FakeSock extends EventEmitter {public getCatalog = jest.fn();public getCollections = jest.fn();public newsletterFollow = jest.fn().mockResolvedValue(undefined);+ public newsletterCreate = jest.fn().mockResolvedValue({ id: 'c@newsletter', name: 'c' });+ public newsletterDelete = jest.fn().mockResolvedValue(undefined);+ public newsletterMute = jest.fn().mockResolvedValue(undefined);+ public newsletterUnmute = jest.fn().mockResolvedValue(undefined);public newsletterUnfollow = jest.fn().mockResolvedValue(undefined);public rejectCall = jest.fn().mockResolvedValue(undefined);public presenceSubscribe = jest.fn().mockResolvedValue(undefined);@@ -4416,3 +4420,59 @@ describe('BaileysAdapter label editing', () => {await expect(adapter.getChatsByLabel('l1')).rejects.toThrow(/getChatsByLabel/);});});++// Baileys has first-class newsletter admin, so these pin the mapping and the mute/unmute split+// rather than any failure translation.+describe('BaileysAdapter channel administration', () => {+ const CHANNEL = '120363401234567890@newsletter';++ beforeEach(() => {+ fakeSock.user = undefined;+ fakeSock.resetEmitter();+ jest.clearAllMocks();+ });++ const readyAdapter = async () => {+ const adapter = newAdapter();+ await adapter.initialize(noopCallbacks({}));+ fakeSock.user = { id: '628999:[email protected]', name: 'Me' };+ fakeSock.fire('connection.update', { connection: 'open' });+ return adapter;+ };++ it('creates a channel and maps the metadata to the neutral shape', async () => {+ fakeSock.newsletterCreate.mockResolvedValue({+ id: CHANNEL,+ name: 'Product updates',+ description: 'Release notes',+ invite: 'ABC123',+ });+ const adapter = await readyAdapter();++ const channel = await adapter.createChannel('Product updates', 'Release notes');++ expect(fakeSock.newsletterCreate).toHaveBeenCalledWith('Product updates', 'Release notes');+ expect(channel).toMatchObject({ id: CHANNEL, name: 'Product updates', inviteCode: 'ABC123' });+ });++ it('deletes a channel by id', async () => {+ const adapter = await readyAdapter();++ await expect(adapter.deleteChannel(CHANNEL)).resolves.toBeUndefined();++ expect(fakeSock.newsletterDelete).toHaveBeenCalledWith(CHANNEL);+ });++ // Two separate library calls, so the boolean must actually pick between them — a wrong branch+ // silently does the opposite of what was asked.+ it('routes mute and unmute to their own library calls', async () => {+ const adapter = await readyAdapter();++ await adapter.muteChannel(CHANNEL, true);+ expect(fakeSock.newsletterMute).toHaveBeenCalledWith(CHANNEL);+ expect(fakeSock.newsletterUnmute).not.toHaveBeenCalled();++ await adapter.muteChannel(CHANNEL, false);+ expect(fakeSock.newsletterUnmute).toHaveBeenCalledWith(CHANNEL);+ });+});diff --git a/src/engine/adapters/baileys.adapter.ts b/src/engine/adapters/baileys.adapter.tsindex 8d106ab43..04caecd18 100644--- a/src/engine/adapters/baileys.adapter.ts+++ b/src/engine/adapters/baileys.adapter.ts@@ -598,6 +598,18 @@ export class BaileysAdapter implements IWhatsAppEngine {return this.sock?.user?.id ?? 'status@broadcast';}+ createChannel(name: string, description?: string): Promise<Channel> {+ return this.channels.createChannel(name, description);+ }++ deleteChannel(channelId: string): Promise<void> {+ return this.channels.deleteChannel(channelId);+ }++ muteChannel(channelId: string, mute: boolean): Promise<void> {+ return this.channels.muteChannel(channelId, mute);+ }+getSubscribedChannels(): Promise<Channel[]> {return this.unsupported('getSubscribedChannels');}diff --git a/src/engine/adapters/whatsapp-web-js.adapter.spec.ts b/src/engine/adapters/whatsapp-web-js.adapter.spec.tsindex 1d87db6a3..3c7286d4f 100644--- a/src/engine/adapters/whatsapp-web-js.adapter.spec.ts+++ b/src/engine/adapters/whatsapp-web-js.adapter.spec.ts@@ -5703,3 +5703,100 @@ describe('WhatsAppWebJsAdapter labels', () => {expect(String(body)).toMatch(/EngineNotSupportedError/);});});++// whatsapp-web.js signals channel-admin failures by RETURNING them, not throwing: createChannel+// resolves an error STRING and deleteChannel resolves false. Both look like success to an unguarded+// caller, which is the whole reason these tests exist.+describe('WhatsAppWebJsAdapter channel administration', () => {+ const CHANNEL = '120363401234567890@newsletter';++ const readyAdapter = (client: unknown): WhatsAppWebJsAdapter => {+ const adapter = new WhatsAppWebJsAdapter({ sessionId: 's', sessionDataPath: './data/sessions', puppeteer: {} });+ (adapter as unknown as { status: EngineStatus }).status = EngineStatus.READY;+ (adapter as unknown as { client: unknown }).client = client;+ return adapter;+ };++ it('maps a created channel to the neutral shape, with the invite CODE rather than the link', async () => {+ const createChannel = jest.fn().mockResolvedValue({+ title: 'Product updates',+ nid: { _serialized: CHANNEL },+ inviteLink: 'https://whatsapp.com/channel/ABC123',+ });++ const channel = await readyAdapter({ createChannel }).createChannel('Product updates', 'Release notes');++ expect(createChannel).toHaveBeenCalledWith('Product updates', { description: 'Release notes' });+ // inviteCode, not inviteLink: it is what subscribeToChannel takes.+ expect(channel).toEqual({+ id: CHANNEL,+ name: 'Product updates',+ description: 'Release notes',+ inviteCode: 'ABC123',+ });+ });++ // The library returns 'CreateChannelError: …' as a plain string. Unguarded, that string is truthy+ // and would be mapped into a Channel of undefineds and reported as a successful creation.+ it('turns the returned error string into a refusal instead of a phantom channel', async () => {+ const createChannel = jest.fn().mockResolvedValue('CreateChannelError: A channel creation is not enabled');++ await expect(readyAdapter({ createChannel }).createChannel('Nope')).rejects.toBeInstanceOf(EngineRefusedError);+ await expect(readyAdapter({ createChannel }).createChannel('Nope')).rejects.toThrow(/not enabled/);+ });++ it('refuses a result with no channel id rather than returning one', async () => {+ const createChannel = jest.fn().mockResolvedValue({ title: 'x' });++ await expect(readyAdapter({ createChannel }).createChannel('x')).rejects.toBeInstanceOf(EngineRefusedError);+ });++ it('omits the description when the caller gave none', async () => {+ const createChannel = jest.fn().mockResolvedValue({ nid: { _serialized: CHANNEL }, title: 'x' });++ const channel = await readyAdapter({ createChannel }).createChannel('x');++ expect(createChannel).toHaveBeenCalledWith('x', {});+ expect(channel).not.toHaveProperty('description');+ });++ it('surfaces a refused delete rather than reporting success', async () => {+ const deleteChannel = jest.fn().mockResolvedValue(false);++ await expect(readyAdapter({ deleteChannel }).deleteChannel(CHANNEL)).rejects.toBeInstanceOf(EngineRefusedError);+ });++ it('resolves a successful delete', async () => {+ const deleteChannel = jest.fn().mockResolvedValue(true);++ await expect(readyAdapter({ deleteChannel }).deleteChannel(CHANNEL)).resolves.toBeUndefined();+ });++ // Mute lives on the Channel structure, reached through getChatById — the client itself has no+ // channel mute.+ it.each([+ [true, 'mute'],+ [false, 'unmute'],+ ])('routes mute=%s to Channel.%s', async (mute, method) => {+ const act = jest.fn().mockResolvedValue(true);+ const getChatById = jest.fn().mockResolvedValue({ [method]: act });++ await expect(readyAdapter({ getChatById }).muteChannel(CHANNEL, mute)).resolves.toBeUndefined();++ expect(getChatById).toHaveBeenCalledWith(CHANNEL);+ expect(act).toHaveBeenCalled();+ });++ it('surfaces a refused mute rather than reporting success', async () => {+ const getChatById = jest.fn().mockResolvedValue({ mute: jest.fn().mockResolvedValue(false) });++ await expect(readyAdapter({ getChatById }).muteChannel(CHANNEL, true)).rejects.toBeInstanceOf(EngineRefusedError);+ });++ // A non-channel chat has no mute() at all; that is a wrong-id error, not a refusal.+ it('reports an unknown or non-channel id as not-found', async () => {+ const getChatById = jest.fn().mockResolvedValue(null);++ await expect(readyAdapter({ getChatById }).muteChannel(CHANNEL, true)).rejects.toBeInstanceOf(ChannelNotFoundError);+ });+});diff --git a/src/engine/adapters/whatsapp-web-js.adapter.ts b/src/engine/adapters/whatsapp-web-js.adapter.tsindex 2a0478b91..c7b1a78a9 100644--- a/src/engine/adapters/whatsapp-web-js.adapter.ts+++ b/src/engine/adapters/whatsapp-web-js.adapter.ts@@ -638,6 +638,18 @@ export class WhatsAppWebJsAdapter extends EventEmitter implements IWhatsAppEngin* off the prototype, so a throw hidden behind a delegate call is invisible to it and the* `not-available` matrix row would go unverified; inline, the gate checks it.*/+ createChannel(name: string, description?: string): Promise<Channel> {+ return this.channels.createChannel(name, description);+ }++ deleteChannel(channelId: string): Promise<void> {+ return this.channels.deleteChannel(channelId);+ }++ muteChannel(channelId: string, mute: boolean): Promise<void> {+ return this.channels.muteChannel(channelId, mute);+ }+getChatsByLabel(labelId: string): Promise<ChatSummary[]> {return this.labels.getChatsByLabel(labelId);}diff --git a/src/engine/adapters/wwebjs-channels.ts b/src/engine/adapters/wwebjs-channels.tsindex ea4d77308..e5b59e1ae 100644--- a/src/engine/adapters/wwebjs-channels.ts+++ b/src/engine/adapters/wwebjs-channels.ts@@ -35,6 +35,63 @@ export class WwebjsChannels {}));}+ /**+ * Create a channel.+ *+ * whatsapp-web.js signals failure by RETURNING A STRING ('CreateChannelError: …') rather than+ * throwing — both when channel creation is disabled for the account and when the server refuses+ * (Client.js:2474-2510). Left unchecked that string would be treated as a successful result and+ * mapped into a Channel with undefined everything, so it is turned into a refusal here.+ */+ async createChannel(name: string, description?: string): Promise<Channel> {+ this.host.ensureReady();+ const result = await (this.client() as unknown as BusinessClient).createChannel(+ name,+ description === undefined ? {} : { description },+ );+ if (typeof result === 'string' || !result?.nid) {+ throw new EngineRefusedError(typeof result === 'string' ? result : `Failed to create the channel '${name}'`);+ }+ return {+ id: String(result.nid._serialized),+ name: String(result.title ?? name),+ ...(description === undefined ? {} : { description }),+ // The library hands back a full invite LINK; the neutral shape carries the code, which is what+ // subscribeToChannel takes.+ ...(result.inviteLink ? { inviteCode: result.inviteLink.split('/').pop() } : {}),+ };+ }++ /** Delete a channel. `false` means the channel was not found or the server refused. */+ async deleteChannel(channelId: string): Promise<void> {+ this.host.ensureReady();+ const ok = await (this.client() as unknown as BusinessClient).deleteChannel(channelId);+ if (!ok) {+ throw new EngineRefusedError(`Failed to delete channel ${channelId}`);+ }+ }++ /**+ * Mute or unmute a channel. Reached through the Chat model rather than the client: whatsapp-web.js+ * puts mute on the Channel structure, and `getChatById` yields one for a `@newsletter` id+ * (ChatFactory.create → isChannel). Both return false rather than throwing when refused.+ */+ async muteChannel(channelId: string, mute: boolean): Promise<void> {+ this.host.ensureReady();+ const chat = (await this.client().getChatById(channelId)) as unknown as {+ mute?: () => Promise<boolean>;+ unmute?: () => Promise<boolean>;+ } | null;+ const act = mute ? chat?.mute : chat?.unmute;+ if (!act) {+ throw new ChannelNotFoundError(channelId);+ }+ const ok = await act.call(chat);+ if (!ok) {+ throw new EngineRefusedError(`Failed to ${mute ? 'mute' : 'unmute'} channel ${channelId}`);+ }+ }+async getChannelById(channelId: string): Promise<Channel | null> {this.host.ensureReady();// wwebjs 1.34.x exposes no client.getChannelById; resolve from the subscribed-channel list (#625).diff --git a/src/engine/engine-capability-matrix.ts b/src/engine/engine-capability-matrix.tsindex 38e3853df..5868f322f 100644--- a/src/engine/engine-capability-matrix.ts+++ b/src/engine/engine-capability-matrix.ts@@ -132,6 +132,9 @@ export const ENGINE_CAPABILITY_MATRIX: Record<string, MethodCapability> = {evidence:'baileys getCollections(jid) (Socket/business.d.ts:11) → first collection synthesized into Catalog metadata at BaileysCatalog (adapters/baileys-catalog.ts; #905); wwjs index.d.ts has NO Client.getCatalog (0 hits) — adapter throws EngineNotSupportedError',},+ createChannel: { wwjs: { status: 'supported' }, baileys: { status: 'supported' } },+ deleteChannel: { wwjs: { status: 'supported' }, baileys: { status: 'supported' } },+ muteChannel: { wwjs: { status: 'supported' }, baileys: { status: 'supported' } },getChannelById: { wwjs: { status: 'supported' }, baileys: { status: 'supported' } },getChannelMessages: {wwjs: { status: 'supported' },diff --git a/src/engine/interfaces/whatsapp-engine.interface.ts b/src/engine/interfaces/whatsapp-engine.interface.tsindex 9443fa45e..b417c89ba 100644--- a/src/engine/interfaces/whatsapp-engine.interface.ts+++ b/src/engine/interfaces/whatsapp-engine.interface.ts@@ -892,6 +892,15 @@ export interface IWhatsAppEngine {* through a single app-state write, and which one happens depends on whether the id already* exists. Only fields that are set are changed.*/+ /**+ * Create a channel and return it. The account becomes its owner, which is what makes deleting it+ * possible later — neither engine can delete a channel it does not own.+ */+ createChannel(name: string, description?: string): Promise<Channel>;+ /** Delete a channel this account owns. Irreversible, and its subscribers lose it. */+ deleteChannel(channelId: string): Promise<void>;+ /** Mute or unmute a channel's notifications for this account. Does not affect subscription. */+ muteChannel(channelId: string, mute: boolean): Promise<void>;upsertLabel(label: LabelInput): Promise<void>;/** Delete a label. It disappears from every chat it was on. */deleteLabel(labelId: string): Promise<void>;diff --git a/src/engine/types/whatsapp-web-js.types.ts b/src/engine/types/whatsapp-web-js.types.tsindex c359f4456..d5331a346 100644--- a/src/engine/types/whatsapp-web-js.types.ts+++ b/src/engine/types/whatsapp-web-js.types.ts@@ -107,7 +107,14 @@ export interface MessageWithReactions extends Omit<Message, 'hasReaction' | 'get*/export interface BusinessClient extends Omit<Client,- 'subscribeToChannel' | 'unsubscribeFromChannel' | 'getLabels' | 'getLabelById' | 'getChannels' | 'getChatsByLabelId'+ | 'subscribeToChannel'+ | 'unsubscribeFromChannel'+ | 'getLabels'+ | 'getLabelById'+ | 'getChannels'+ | 'getChatsByLabelId'+ | 'createChannel'+ | 'deleteChannel'> {getLabels(): Promise<Array<{ id: string; name: string; hexColor: string }>>;getLabelById(id: string): Promise<{ id: string; name: string; hexColor: string } | null>;@@ -120,6 +127,16 @@ export interface BusinessClient extends Omit<getChannels(): Promise<WwjsChannelData[]>;/** Takes a channel ID (`…@newsletter`), NOT an invite code; resolves true only on success. */subscribeToChannel(channelId: string): Promise<boolean>;+ /**+ * Resolves a RESULT OBJECT on success and an error STRING on failure — it does not throw+ * (Client.js:2474-2510), so callers must narrow before using it.+ */+ createChannel(+ title: string,+ options?: { description?: string },+ ): Promise<{ title?: string; nid: { _serialized: string }; inviteLink?: string } | string>;+ /** False when the channel was not found or the server refused. */+ deleteChannel(channelId: string): Promise<boolean>;/** Resolves true only when the unsubscription completed. */unsubscribeFromChannel(id: string, options?: Record<string, unknown>): Promise<boolean>;}diff --git a/src/modules/channel/channel.controller.ts b/src/modules/channel/channel.controller.tsindex 94753f5ae..e15feb388 100644--- a/src/modules/channel/channel.controller.ts+++ b/src/modules/channel/channel.controller.ts@@ -1,7 +1,9 @@-import { Controller, Get, Post, Delete, Param, Body, Query } from '@nestjs/common';+import { Controller, Get, Post, Delete, Param, Body, Query, HttpCode, HttpStatus } from '@nestjs/common';import { ApiTags, ApiOperation, ApiResponse, ApiParam, ApiBody, ApiQuery } from '@nestjs/swagger';import { ChannelService } from './channel.service';import { SubscribeChannelDto } from './dto/subscribe-channel.dto';+import { CreateChannelDto } from './dto/create-channel.dto';+import { MuteChannelDto } from './dto/mute-channel.dto';import { RequireRole } from '../auth/decorators/auth.decorators';import { ApiKeyRole } from '../auth/entities/api-key.entity';@@ -60,6 +62,69 @@ export class ChannelController {return this.channelService.getChannelMessages(sessionId, channelId, Number.isNaN(parsed) ? undefined : parsed);}+ @Post()+ @RequireRole(ApiKeyRole.OPERATOR)+ @HttpCode(HttpStatus.CREATED)+ @ApiOperation({+ summary: 'Create a channel',+ description:+ 'The account becomes the channel owner, which is what makes deleting it possible later — ' ++ 'neither engine can delete a channel it does not own.',+ })+ @ApiParam({ name: 'sessionId', description: 'Session ID' })+ @ApiBody({ type: CreateChannelDto })+ @ApiResponse({ status: 201, description: 'The created channel' })+ @ApiResponse({ status: 400, description: 'Session not started, or validation failed' })+ @ApiResponse({ status: 422, description: 'The engine refused — channel creation may be disabled for this account' })+ async create(@Param('sessionId') sessionId: string, @Body() dto: CreateChannelDto) {+ return this.channelService.createChannel(sessionId, dto.name, dto.description);+ }++ @Post(':channelId/delete')+ @RequireRole(ApiKeyRole.OPERATOR)+ @HttpCode(HttpStatus.OK)+ @ApiOperation({+ summary: 'Delete a channel this account owns',+ description:+ 'Irreversible, and every subscriber loses the channel. Deliberately NOT `DELETE ' ++ '/channels/:channelId` — that route unsubscribes, and the two must not be reachable by the ' ++ 'same request with a slip of the wrist. Only the owner can delete.',+ })+ @ApiParam({ name: 'sessionId', description: 'Session ID' })+ @ApiParam({ name: 'channelId', description: 'Channel ID' })+ @ApiResponse({ status: 200, description: 'Channel deleted' })+ @ApiResponse({ status: 400, description: 'Session not started' })+ @ApiResponse({ status: 422, description: 'The engine refused — not found, or this account does not own it' })+ async remove(+ @Param('sessionId') sessionId: string,+ @Param('channelId') channelId: string,+ ): Promise<{ success: boolean }> {+ await this.channelService.deleteChannel(sessionId, channelId);+ return { success: true };+ }++ @Post(':channelId/mute')+ @RequireRole(ApiKeyRole.OPERATOR)+ @HttpCode(HttpStatus.OK)+ @ApiOperation({+ summary: 'Mute or unmute a channel',+ description: "Silences the channel's notifications for this account. The subscription is untouched.",+ })+ @ApiParam({ name: 'sessionId', description: 'Session ID' })+ @ApiParam({ name: 'channelId', description: 'Channel ID' })+ @ApiBody({ type: MuteChannelDto })+ @ApiResponse({ status: 200, description: 'Channel muted or unmuted' })+ @ApiResponse({ status: 400, description: 'Session not started, or validation failed' })+ @ApiResponse({ status: 422, description: 'The engine refused' })+ async mute(+ @Param('sessionId') sessionId: string,+ @Param('channelId') channelId: string,+ @Body() dto: MuteChannelDto,+ ): Promise<{ success: boolean }> {+ await this.channelService.muteChannel(sessionId, channelId, dto.mute);+ return { success: true };+ }+@Post('subscribe')@RequireRole(ApiKeyRole.OPERATOR)@ApiOperation({ summary: 'Subscribe to a channel using invite code' })diff --git a/src/modules/channel/channel.service.ts b/src/modules/channel/channel.service.tsindex b2c385fae..c7ab3c953 100644--- a/src/modules/channel/channel.service.ts+++ b/src/modules/channel/channel.service.ts@@ -41,6 +41,21 @@ export class ChannelService {return this.getEngine(sessionId).getChannelMessages(channelId, safeLimit);}+ /** Create a channel. The account owns it, which is what makes deleting it possible later. */+ createChannel(sessionId: string, name: string, description?: string) {+ return this.getEngine(sessionId).createChannel(name, description);+ }++ /** Delete a channel this account owns. Irreversible, and its subscribers lose it. */+ deleteChannel(sessionId: string, channelId: string) {+ return this.getEngine(sessionId).deleteChannel(channelId);+ }++ /** Mute or unmute a channel's notifications. Subscription is untouched either way. */+ muteChannel(sessionId: string, channelId: string, mute: boolean) {+ return this.getEngine(sessionId).muteChannel(channelId, mute);+ }+subscribeToChannel(sessionId: string, inviteCode: string) {return this.getEngine(sessionId).subscribeToChannel(inviteCode);}diff --git a/src/modules/channel/dto/create-channel.dto.ts b/src/modules/channel/dto/create-channel.dto.tsnew file mode 100644index 000000000..e60bf01f0--- /dev/null+++ b/src/modules/channel/dto/create-channel.dto.ts@@ -0,0 +1,18 @@+import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';+import { IsNotEmpty, IsOptional, IsString, MaxLength } from 'class-validator';++export class CreateChannelDto {+ @ApiProperty({ description: 'Channel name', example: 'Product updates', maxLength: 100 })+ @IsString()+ @IsNotEmpty()+ // Bounds a runaway payload rather than mirroring a protocol limit; WhatsApp's own editor stops+ // well short of this.+ @MaxLength(100)+ name: string;++ @ApiPropertyOptional({ description: 'Channel description', example: 'Release notes and downtime notices' })+ @IsOptional()+ @IsString()+ @MaxLength(2048)+ description?: string;+}diff --git a/src/modules/channel/dto/mute-channel.dto.ts b/src/modules/channel/dto/mute-channel.dto.tsnew file mode 100644index 000000000..00904fbfd--- /dev/null+++ b/src/modules/channel/dto/mute-channel.dto.ts@@ -0,0 +1,15 @@+import { ApiProperty } from '@nestjs/swagger';+import { IsBoolean } from 'class-validator';+import { ToStrictBoolean } from '../../../common/utils/strict-boolean';++export class MuteChannelDto {+ @ApiProperty({+ description: 'True to mute the channel, false to unmute it. Subscription is unaffected either way.',+ example: true,+ })+ // The global pipe runs with implicit conversion, which turns EVERY non-empty string into true —+ // so an unguarded `false` sent as a string would mute instead of unmuting.+ @ToStrictBoolean()+ @IsBoolean()+ mute: boolean;+}