diff --git a/src/controller/deviceController.ts b/src/controller/deviceController.ts index df8a16556e..3e59860932 100644 --- a/src/controller/deviceController.ts +++ b/src/controller/deviceController.ts @@ -377,21 +377,19 @@ export async function getChatById(req: Request, res: Response) { schema: 'NERDWHATS_AMERICA' } #swagger.parameters["phone"] = { - schema: '5521999999999' + schema: '5521999999999@c.us' } #swagger.parameters["isGroup"] = { schema: 'false' } */ const { phone } = req.params; - const { isGroup } = req.query; + const { isGroup = false } = req.query; try { let result = {} as Chat; - if (isGroup) { - result = await req.client.getChatById(`${phone}@g.us`); - } else { - result = await req.client.getChatById(`${phone}@c.us`); + for (const contato of contactToArray(phone as string, isGroup as boolean)) { + result = await req.client.getChatById(contato); } return res.status(200).json(result);