From d52eb71c769d09f1d9170b7b09f0f62e3fb771fc Mon Sep 17 00:00:00 2001 From: devlikepro Date: Wed, 4 Mar 2026 17:18:24 +0700 Subject: [PATCH] [core] channels - try to resolve code or use id provided --- src/api/channels.controller.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/api/channels.controller.ts b/src/api/channels.controller.ts index 02790695..f1bc6d9c 100644 --- a/src/api/channels.controller.ts +++ b/src/api/channels.controller.ts @@ -131,14 +131,15 @@ export class ChannelsController { }) async previewChannelMessages( @WorkingSessionParam session: WhatsappSession, - @Param('id') code: string, + @Param('id') codeOrId: string, @Query() query: PreviewChannelMessages, ): Promise { - if (isJidNewsletter(code)) { - const channel = await session.channelsGetChannel(code); + let code = null; + if (isJidNewsletter(codeOrId)) { + const channel = await session.channelsGetChannel(codeOrId); code = parseChannelInviteLink(channel.invite); } - const inviteCode = parseChannelInviteLink(code); + const inviteCode = parseChannelInviteLink(code || codeOrId); return session.previewChannelMessages(inviteCode, query); }