From cd0d98b052798b4b0f4fed55dd400620f0f5ab4c Mon Sep 17 00:00:00 2001 From: AlexisJusviack <67768512+AlexisJusviack@users.noreply.github.com> Date: Tue, 12 May 2026 18:54:04 -0300 Subject: [PATCH 1/4] feat: add gifPlayback support for video messages Allow gifPlayback and gifAttribution options to be passed to Baileys video messages. --- .../channel/whatsapp/whatsapp.baileys.service.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts b/src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts index df5e3add5..11f607f03 100644 --- a/src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts +++ b/src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts @@ -3157,7 +3157,11 @@ export class BaileysStartupService extends ChannelStartupService { prepareMedia[mediaType].fileName = mediaMessage.fileName; if (mediaMessage.mediatype === 'video') { - prepareMedia[mediaType].gifPlayback = false; + prepareMedia[mediaType].gifPlayback = mediaMessage.gifPlayback === true || mediaMessage.gifPlayback === 'true'; + + if (mediaMessage.gifAttribution !== undefined) { + prepareMedia[mediaType].gifAttribution = Number(mediaMessage.gifAttribution); + } } return generateWAMessageFromContent( From 7761d8d8da3f70de888c3b05e8e000cb3bf359e4 Mon Sep 17 00:00:00 2001 From: AlexisJusviack <67768512+AlexisJusviack@users.noreply.github.com> Date: Tue, 12 May 2026 18:57:07 -0300 Subject: [PATCH 2/4] feat: add gif options to media DTOs Add gifPlayback and gifAttribution properties to media DTO definitions. --- src/api/dto/sendMessage.dto.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/api/dto/sendMessage.dto.ts b/src/api/dto/sendMessage.dto.ts index da71494b9..b3d87e5e0 100644 --- a/src/api/dto/sendMessage.dto.ts +++ b/src/api/dto/sendMessage.dto.ts @@ -25,6 +25,8 @@ export class MediaMessage { fileName?: string; // url or base64 media: string; + gifPlayback?: boolean | string; + gifAttribution?: number | string; } export class StatusMessage { @@ -83,6 +85,8 @@ export class SendMediaDto extends Metadata { fileName?: string; // url or base64 media: string; + gifPlayback?: boolean | string; + gifAttribution?: number | string; } export class SendPtvDto extends Metadata { From fc17c530457bc9235e2432c95d940663f1155b45 Mon Sep 17 00:00:00 2001 From: AlexisJusviack <67768512+AlexisJusviack@users.noreply.github.com> Date: Tue, 12 May 2026 18:59:15 -0300 Subject: [PATCH 3/4] feat: add gif fields to media message schema Add gifPlayback and gifAttribution validation support to media message schema. --- src/validate/message.schema.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/validate/message.schema.ts b/src/validate/message.schema.ts index 040b22280..db76fe1c8 100644 --- a/src/validate/message.schema.ts +++ b/src/validate/message.schema.ts @@ -102,6 +102,15 @@ export const mediaMessageSchema: JSONSchema7 = { media: { type: 'string' }, fileName: { type: 'string' }, caption: { type: 'string' }, + gifPlayback: { + oneOf: [{ type: 'boolean' }, { type: 'string', enum: ['true', 'false'] }], + }, + gifAttribution: { + oneOf: [ + { type: 'integer', enum: [0, 1, 2] }, + { type: 'string', enum: ['0', '1', '2'] }, + ], + }, delay: { type: 'integer', description: 'Enter a value in milliseconds', From fd199c2666bae999ccee33eb93e97aaa893084be Mon Sep 17 00:00:00 2001 From: AlexisJusviack <67768512+AlexisJusviack@users.noreply.github.com> Date: Tue, 12 May 2026 20:23:17 -0300 Subject: [PATCH 4/4] fix: validate gifAttribution values before assignment Prevent invalid gifAttribution values from reaching Baileys media payload. --- .../channel/whatsapp/whatsapp.baileys.service.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts b/src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts index 11f607f03..821a78047 100644 --- a/src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts +++ b/src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts @@ -3160,7 +3160,10 @@ export class BaileysStartupService extends ChannelStartupService { prepareMedia[mediaType].gifPlayback = mediaMessage.gifPlayback === true || mediaMessage.gifPlayback === 'true'; if (mediaMessage.gifAttribution !== undefined) { - prepareMedia[mediaType].gifAttribution = Number(mediaMessage.gifAttribution); + const gifAttribution = Number(mediaMessage.gifAttribution); + if (gifAttribution === 0 || gifAttribution === 1 || gifAttribution === 2) { + prepareMedia[mediaType].gifAttribution = gifAttribution; + } } }