We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
purpshell
Auties00
SheIITear
Learn more about funding links in repositories.
Report abuse
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
I have the following code for sending media for using base64 and direct URL
while only facing issue with the PDF on other doc files it's properly working for more ref I attached a screenshot
// if get media direact URL messageContent = { [mediaType]: { url: image, mimetype: mimeType, fileName: file_name, }, caption, }; // if get base64 messageContent = { [mediaType]: mediaBuffer, mimetype: mimeType, fileName: file_name, caption, }; } console.log("messageContent :>> ", messageContent); const sendResult = await wpClient.sendMessage( `${number}@c.us`, messageContent );
Reference Screenshot
The text was updated successfully, but these errors were encountered:
if i send pdf with base64 then it's send properly with PDF name or other doc name but I have direct file URL and file name
const sendMedia = async ( wpClient, number, URL, file_name, caption = "", mediaType = undefined )
// Convert to Base64 for URLs without extensions const base64Result = await convertUrlToBase64(image); if (base64Result.status === 1) { const { data: base64Data, mimeType } = base64Result; // Determine media type // Convert Base64 to Buffer const mediaBuffer = base64Data.includes("data:") ? Buffer.from(base64Data.split(",")[1], "base64") // Extract payload if data URL : Buffer.from(base64Data, "base64"); // Raw Base64 without data URLExtract payload const mediaType = mimeType.startsWith("image") ? "image" : mimeType.startsWith("video") ? "video" : mimeType.startsWith("audio") ? "audio" : "document"; // Default to document for other types messageContent = { [mediaType]: mediaBuffer, mimetype: mimeType, fileName: file_name, caption, }; } const sendResult = await wpClient .sendMessage( // `${number}@c.us`, `${number}@s.whatsapp.net`, messageContent ) .catch((err) => { return isMessageSend; }); console.log("sendResult :>> ", sendResult);
Sorry, something went wrong.
No branches or pull requests
I have the following code for sending media for using base64 and direct URL
while only facing issue with the PDF on other doc files it's properly working for more ref I attached a screenshot
Reference Screenshot

The text was updated successfully, but these errors were encountered: