diff --git a/package-lock.json b/package-lock.json index a86c2c5d..ac0f1025 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,7 +16,7 @@ "qr-image": "^3.2.0", "qrcode-terminal": "^0.12.0", "swagger-ui-express": "^4.6.3", - "whatsapp-web.js": "1.23.1-alpha.4" + "whatsapp-web.js": "1.23.1-alpha.5" }, "devDependencies": { "eslint": "^8.38.0", @@ -7323,9 +7323,9 @@ "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" }, "node_modules/whatsapp-web.js": { - "version": "1.23.1-alpha.4", - "resolved": "https://registry.npmjs.org/whatsapp-web.js/-/whatsapp-web.js-1.23.1-alpha.4.tgz", - "integrity": "sha512-GDWfWdd9YlIppExgziHhQLsVWstD9yNhRwqMPQsFfyXD/DcN5b9wFONsvzRTD+Twc6RTjBUzoUA8BkvSgh8tUg==", + "version": "1.23.1-alpha.5", + "resolved": "https://registry.npmjs.org/whatsapp-web.js/-/whatsapp-web.js-1.23.1-alpha.5.tgz", + "integrity": "sha512-eA2CWGZI4zmbFfX2buITZo/If31mzk/hVYGN07aDJublj4RxHCuGYiop4rouHH0e6HK9FX6Ak8Zp2Sr2BbTYcw==", "dependencies": { "@pedroslopez/moduleraid": "^5.0.2", "fluent-ffmpeg": "2.1.2", diff --git a/package.json b/package.json index ad584cb7..a7865fb5 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "qr-image": "^3.2.0", "qrcode-terminal": "^0.12.0", "swagger-ui-express": "^4.6.3", - "whatsapp-web.js": "1.23.1-alpha.4" + "whatsapp-web.js": "1.23.1-alpha.5" }, "devDependencies": { "eslint": "^8.38.0", diff --git a/src/controllers/clientController.js b/src/controllers/clientController.js index 09d96100..399268e7 100644 --- a/src/controllers/clientController.js +++ b/src/controllers/clientController.js @@ -107,7 +107,8 @@ const sendMessage = async (req, res) => { break } case 'Contact': { - const contact = await client.getContactById(typeof content.contactId === 'number' ? content.contactId + '@c.us' : content.contactId) + const contactId = content.contactId.endsWith('@c.us') ? content.contactId : `${content.contactId}@c.us` + const contact = await client.getContactById(contactId) messageOut = await client.sendMessage(chatId, contact, options) break }