to
can be <phone Number>@c.us
, <phone Number>-<groupId>@g.us
, or <phone Number><groupId>@g.us
.To use these functions, it is necessary to initialize the bot.
Click here to learn more.
Send messages separately
Sends a text message to given chat
await client.sendText("0000000000@c.us", "A message sent by hydra-bot")
.then((result) => {
console.log(result); // message result
}).catch((error) => {
console.log(error); // message error
});
Sends file from path
await client.sendFile("0000000000@c.us", './file.pdf', { filename: 'filename' })
.then((result) => {
console.log(result); // message result
}).catch((error) => {
console.log(error); // message error
});
Send audio file
await client.sendAudio("0000000000@c.us", './file.mp3')
.then((result) => {
console.log(result); // message result
}).catch((error) => {
console.log(error); // message error
});
Send audio base64
await client.sendAudioBase64("0000000000@c.us", base64MP3)
.then((result) => {
console.log(result); // message result
}).catch((error) => {
console.log(error); // message error
});
Send image message
await client.sendImage("0000000000@c.us", './file.jpg', { caption: 'image text' })
.then((result) => {
console.log(result); // message result
}).catch((error) => {
console.log(error); // message error
});
Send image base64
await client.sendImageFromBase64("0000000000@c.us", base64IMG, { caption: 'image text' })
.then((result) => {
console.log(result); // message result
}).catch((error) => {
console.log(error); // message error
});
Generated using TypeDoc