Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(message): fix depercated sendFileFromBase64 #812

Merged
merged 5 commits into from
Jun 30, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/controller/messageController.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,16 @@ export async function sendFile(req, res) {
}

export async function sendFile64(req, res) {
const { base64, phone, filename = 'file', message } = req.body;
const { base64, phone } = req.body;

if (!base64) return res.status(401).send({ message: 'The base64 of the file was not informed' });

const options = req.body.options || {};

try {
let results = [];
for (const contato of phone) {
results.push(await req.client.sendFileFromBase64(contato, base64, filename, message));
results.push(await req.client.sendFile(contato, base64, options));
}

if (results.length === 0) return res.status(400).json('Error sending message');
Expand Down