-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
feat: newsletter support #820
Conversation
Thanks for your contribution. The next step is to wait for review and approval to merge it to main repository The community can help reacting with a thumb up (:thumbsup:) for approval and rocket (:rocket:) for who has tested it. To test this PR you can run the following command below:
|
any for function to send message, link preview, message and other ? cause i see only to manage channel only in this code |
Just sendMessage normally with newsletter id sock.sendMessage("13731837@newsletter", { text: "Hello" }) |
for this i was success send as plain text, |
I didn't see that you also did a PR on this |
how do you send other the message? does it use the sendMessage function? |
How to send files into channel?, it's not that whatsapp currently can't send files into channels, it can only send media such as voice, video and image, other than that it's just a poll, is it possible? |
error in followNewsletter(id) |
Cannot send media {documents, audio, video, photos, vn,sticker [only text]) using the sendFile function to the Group what's wrong, but when using a baileys npm:@whiskeysocket/baileys@latest it works (conn.sendFile = async (
jid,
path,
filename = "",
caption = "",
quoted,
ptt = false,
options = {},
) => {
let type = await conn.getFile(path, true);
let { res, data: file, filename: pathFile } = type;
if ((res && res.status !== 200) || file.length <= 65536) {
try {
throw { json: JSON.parse(file.toString()) };
} catch (e) {
if (e.json) throw e.json;
}
}
let opt = { filename };
if (quoted) opt.quoted = quoted;
if (!type) options.asDocument = true;
let mtype = "",
mimetype = type.mime,
convert;
if (
/webp/.test(type.mime) ||
(/image/.test(type.mime) && options.asSticker)
)
mtype = "sticker";
else if (
/image/.test(type.mime) ||
(/webp/.test(type.mime) && options.asImage)
)
mtype = "image";
else if (/video/.test(type.mime)) mtype = "video";
else if (/audio/.test(type.mime))
(convert = await (ptt ? toPTT : toAudio)(file, type.ext)),
(file = convert.data),
(pathFile = convert.filename),
(mtype = "audio"),
(mimetype = "audio/mpeg");
else mtype = "document";
if (options.asDocument) mtype = "document";
let message = {
...options,
caption,
ptt,
[mtype]: { url: pathFile },
mimetype,
};
let m;
try {
m = await conn.sendMessage(jid, message, { ...opt, ...options });
} catch (e) {
console.error(e);
m = null;
} finally {
if (!m)
m = await conn.sendMessage(
jid,
{ ...message, [mtype]: file },
{ ...opt, ...options },
);
return m;
}
}); |
@zennn08 I am able to send message on newsletter but messages can be seen only in web.whatsapp.com but not on mobile WhatsApp anything am I doing wrong? Web version output Mobile version output |
How can I list all newsletters? I just created one but I don’t know how I get your metadata. |
how to make it like that |
Summary:
Add support for newsletter
Changes:
getNewsletterInfo()
createNewsLetter()
getSubscribedNewsletters()
toggleMuteNewsletter()
followNewsletter()
unFollowNewsletter()
updateNewsletterName()
updateNewsletterDesc()
updateNewsletterPicture()
updateNewsletterReactionSetting()
removeNewsletterPicture()
newsletter
inMediaGenerationOptions
Note:
To send media to the newsletter, we have to upload the media to the WhatsApp server without encrypting it first.
Newsletter media works mostly the same way as normal media, with a few differences:
handle
that needs to be passed inadditionalAttributes
.