diff --git a/src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts b/src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts index 0afd5318..3552d243 100644 --- a/src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts +++ b/src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts @@ -270,7 +270,7 @@ export class BaileysStartupService extends ChannelStartupService { public async getProfileStatus() { const status = await this.client.fetchStatus(this.instance.wuid); - return status?.status; + return status[0]?.status; } public get profilePictureUrl() { @@ -1785,7 +1785,7 @@ export class BaileysStartupService extends ChannelStartupService { try { return { wuid: jid, - status: (await this.client.fetchStatus(jid))?.status, + status: (await this.client.fetchStatus(jid))[0]?.status, }; } catch (error) { return { @@ -1808,7 +1808,8 @@ export class BaileysStartupService extends ChannelStartupService { if (number) { const info = (await this.whatsappNumber({ numbers: [jid] }))?.shift(); const picture = await this.profilePicture(info?.jid); - const status = await this.getStatus(info?.jid); + const statusResult = await this.getStatus(info?.jid); + const status = Array.isArray(statusResult) && statusResult.length > 0 ? statusResult[0]?.status : null; const business = await this.fetchBusinessProfile(info?.jid); return { @@ -1816,7 +1817,7 @@ export class BaileysStartupService extends ChannelStartupService { name: info?.name, numberExists: info?.exists, picture: picture?.profilePictureUrl, - status: status?.status, + status: status, isBusiness: business.isBusiness, email: business?.email, description: business?.description,