Skip to content

Commit c5df499

Browse files
committed
feat: implement Baileys service for WhatsApp channel, managing connections, messages, groups, profiles, and integrating with Chatwoot, OpenAI, and S3.
1 parent 260ad02 commit c5df499

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2244,12 +2244,23 @@ export class BaileysStartupService extends ChannelStartupService {
22442244

22452245
const image = previewData.images && previewData.images.length > 0 ? previewData.images[0] : undefined;
22462246

2247+
let thumbnail: Buffer | undefined = undefined;
2248+
if (image) {
2249+
try {
2250+
const response = await axios.get(image, { responseType: 'arraybuffer' });
2251+
thumbnail = Buffer.from(response.data);
2252+
} catch {
2253+
// Ignore image fetch failures
2254+
}
2255+
}
2256+
22472257
return {
22482258
externalAdReply: {
22492259
title: previewData.title,
22502260
body: previewData.description,
2251-
mediaType: 2, // 2 for video/image preview, though usually 1 is for thumbnail
2261+
mediaType: 1, // 1 for image, 2 for video. Using 1 for better cover image support with renderLargerThumbnail
22522262
thumbnailUrl: image,
2263+
thumbnail: thumbnail,
22532264
sourceUrl: url,
22542265
mediaUrl: url,
22552266
renderLargerThumbnail: true

0 commit comments

Comments
 (0)