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

kirim file dll #23

Open
Nawkhi opened this issue Aug 12, 2023 · 8 comments
Open

kirim file dll #23

Nawkhi opened this issue Aug 12, 2023 · 8 comments
Labels
request Feature Request

Comments

@Nawkhi
Copy link

Nawkhi commented Aug 12, 2023

bisakah untuk kirim file atau yang lainnya gan.?

@mimamch
Copy link
Owner

mimamch commented Aug 12, 2023

next update yap

@mimamch mimamch added the request Feature Request label Aug 12, 2023
@Nawkhi
Copy link
Author

Nawkhi commented Aug 14, 2023

ok bang di tunggu

@Nawkhi
Copy link
Author

Nawkhi commented Aug 20, 2023

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);
}
};

@Nawkhi
Copy link
Author

Nawkhi commented Aug 20, 2023

medianya lewat url bagaimana bang.??

@mimamch
Copy link
Owner

mimamch commented Aug 21, 2023

Untuk File baru bisa via Buffer, untuk url baru bisa image dan video

@Nawkhi
Copy link
Author

Nawkhi commented Aug 21, 2023

Sudah bisa bang pakai axios
Terimakasih ya bang
Coding abang sangat membantu. 🙏🙏🙏

@mdestafadilah
Copy link
Contributor

Sudah bisa bang pakai axios Terimakasih ya bang Coding abang sangat membantu. 🙏🙏🙏

gimana gimana? bisa dishare pak?

@mrnoobnoobies
Copy link

mrnoobnoobies commented Nov 7, 2024

Sudah bisa bang pakai axios Terimakasih ya bang Coding abang sangat membantu. 🙏🙏🙏

mohon share gimana cara 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
request Feature Request
Projects
None yet
Development

No branches or pull requests

4 participants