Open Nawkhi opened 1 year ago
next update yap
ok bang di tunggu
exports.sendPdf = async (req, res, next) => { try { let to = req.body.to || req.query.to; let media = req.body.media || req.query.media; let isGroup = req.body.isGroup || req.query.isGroup; const sessionId = req.body.session || req.query.session || req.headers.session;
if (!to || !media) throw new ValidationError("Missing Parameters");
const receiver = to;
const filename = media;
const document = fs.readFileSync(media); // return Buffer
if (!sessionId) throw new ValidationError("Session Not Founds");
const send = await whatsapp.sendDocument({
sessionId,
to: receiver,
isGroup: !!isGroup,
filename: filename,
media: document,
});
res.status(200).json(
responseSuccessWithData({
id: send?.key?.id,
status: send?.status,
message: send?.message?.extendedTextMessage?.caption || "Not Text",
remoteJid: send?.key?.remoteJid,
})
);
} catch (error) { next(error); } };
medianya lewat url bagaimana bang.??
Untuk File baru bisa via Buffer, untuk url baru bisa image dan video
Sudah bisa bang pakai axios Terimakasih ya bang Coding abang sangat membantu. 🙏🙏🙏
Sudah bisa bang pakai axios Terimakasih ya bang Coding abang sangat membantu. 🙏🙏🙏
gimana gimana? bisa dishare pak?
Sudah bisa bang pakai axios Terimakasih ya bang Coding abang sangat membantu. 🙏🙏🙏
mohon share gimana cara 🙏
bisakah untuk kirim file atau yang lainnya gan.?