venom
Venom is a high-performance system developed with JavaScript to create a bot for WhatsApp, support for creating any interaction, such as customer service, media sending, sentence recognition based on artificial intelligence and all types of design architecture for WhatsApp.
Stars: 5704
Venom is a high-performance system developed with JavaScript to create a bot for WhatsApp, support for creating any interaction, such as customer service, media sending, sentence recognition based on artificial intelligence and all types of design architecture for WhatsApp.
README:
Venom is a high-performance system developed with JavaScript to create a bot for WhatsApp, support for creating any interaction, such as customer service, media sending, sentence recognition based on artificial intelligence and all types of design architecture for WhatsApp.
It's a high-performance alternative API to whatzapp, you can send, text messages, files, images, videos and more.
Remember, the API was developed on a platform called RESTful Web services, providing interoperability between computer systems on the Internet.
It uses a set of well-defined operations that apply to all information resources: HTTP itself defines a small set of operations, the most important being POST, GET, PUT and DELETE.
Use it in your favorite language like PHP, Python, C# and others. as long as your language is supported with the HTTP protocol, you will save time and money. you don't need to know how Venom works, we have the complete API documentation, in a professional way!
SuperChats is a premium library with unique features that control Whatsapp functions with socket. With Superchats you can build service bots, multiservice chats or any system that uses Whatsapp
Superchats is a premium version of Venom, with exclusive features and support for companies and developers worldwide
https://github.com/orkestral/superchats
The value of the license is $50 monthly dollars, to acquire contact in whatsapp by clicking on the image below !!
π» Automatic QR Refresh | β |
π Send text, image, video, audio and docs | β |
π₯ Get contacts, chats, groups, group members, Block List | β |
π Send contacts | β |
Send Buttons | β |
Send stickers | β |
Send stickers GIF | β |
Multiple Sessions | β |
β© Forward Messages | β |
π₯ Receive message | β |
π€ insert user section | β |
π Send location!! | β |
πΈπΈ and much more | β |
Documentation at https://orkestral.github.io/venom/index.html
> npm i --save venom-bot
or for Nightly releases:
> npm i --save https://github.com/orkestral/venom/releases/download/nightly/venom-bot-nightly.tgz
Installing the current repository "you can download the beta version from the current repository!"
> npm i github:orkestral/venom
// Supports ES6
// import { create, Whatsapp } from 'venom-bot';
const venom = require('venom-bot');
venom
.create({
session: 'session-name' //name of session
})
.then((client) => start(client))
.catch((erro) => {
console.log(erro);
});
function start(client) {
client.onMessage((message) => {
if (message.body === 'Hi' && message.isGroupMsg === false) {
client
.sendText(message.from, 'Welcome Venom π·')
.then((result) => {
console.log('Result: ', result); //return object success
})
.catch((erro) => {
console.error('Error when sending: ', erro); //return object error
});
}
});
}
After executing create()
function, venom will create an instance of whatsapp web. If you are not logged in, it will print a QR code in the terminal. Scan it with your phone and you are ready to go!
// Init sales whatsapp bot
venom.create('sales').then((salesClient) => {...});
// Init support whatsapp bot
venom.create('support').then((supportClient) => {...});
Venom create()
method third parameter can have the following optional parameters:
If you are using the Linux
server do not forget to pass the args --user-agent
Original parameters in browserArgs
const venom = require('venom-bot');
venom
.create(
//session
'sessionName', //Pass the name of the client you want to start the bot
//catchQR
(base64Qrimg, asciiQR, attempts, urlCode) => {
console.log('Number of attempts to read the qrcode: ', attempts);
console.log('Terminal qrcode: ', asciiQR);
console.log('base64 image string qrcode: ', base64Qrimg);
console.log('urlCode (data-ref): ', urlCode);
},
// statusFind
(statusSession, session) => {
console.log('Status Session: ', statusSession); //return isLogged || notLogged || browserClose || qrReadSuccess || qrReadFail || autocloseCalled || desconnectedMobile || deleteToken || chatsAvailable || deviceNotConnected || serverWssNotConnected || noOpenBrowser || initBrowser || openBrowser || connectBrowserWs || initWhatsapp || erroPageWhatsapp || successPageWhatsapp || waitForLogin || waitChat || successChat
//Create session wss return "serverClose" case server for close
console.log('Session name: ', session);
},
// options
{
browserPathExecutable: '', // browser executable path
folderNameToken: 'tokens', //folder name when saving tokens
mkdirFolderToken: '', //folder directory tokens, just inside the venom folder, example: { mkdirFolderToken: '/node_modules', } //will save the tokens folder in the node_modules directory
headless: 'new', // you should no longer use boolean false or true, now use false, true or 'new' learn more https://developer.chrome.com/articles/new-headless/
devtools: false, // Open devtools by default
debug: false, // Opens a debug session
logQR: true, // Logs QR automatically in terminal
browserWS: '', // If u want to use browserWSEndpoint
browserArgs: [''], // Original parameters ---Parameters to be added into the chrome browser instance
addBrowserArgs: [''], // Add broserArgs without overwriting the project's original
puppeteerOptions: {}, // Will be passed to puppeteer.launch
disableSpins: true, // Will disable Spinnies animation, useful for containers (docker) for a better log
disableWelcome: true, // Will disable the welcoming message which appears in the beginning
updatesLog: true, // Logs info updates automatically in terminal
autoClose: 60000, // Automatically closes the venom-bot only when scanning the QR code (default 60 seconds, if you want to turn it off, assign 0 or false)
createPathFileToken: false, // creates a folder when inserting an object in the client's browser, to work it is necessary to pass the parameters in the function create browserSessionToken
addProxy: [''], // Add proxy server exemple : [e1.p.webshare.io:01, e1.p.webshare.io:01]
userProxy: '', // Proxy login username
userPass: '' // Proxy password
},
// BrowserInstance
(browser, waPage) => {
console.log('Browser PID:', browser.process().pid);
waPage.screenshot({ path: 'screenshot.png' });
}
)
.then((client) => {
start(client);
})
.catch((erro) => {
console.log(erro);
});
Gets the return if the session is isLogged
or notLogged
or browserClose
or qrReadSuccess
or qrReadFail
or autocloseCalled
or desconnectedMobile
or deleteToken
or chatsAvailable
or deviceNotConnected
or serverWssNotConnected
or noOpenBrowser
or initBrowser
or openBrowser
or connectBrowserWs
or initWhatsapp
or erroPageWhatsapp
or successPageWhatsapp
or waitForLogin
or waitChat
or successChat
or Create session wss return "serverClose" case server for close
Status | Condition |
---|---|
isLogged |
When the user is already logged in to the browser |
notLogged |
When the user is not connected to the browser, it is necessary to scan the QR code through the cell phone in the option WhatsApp Web |
browserClose |
If the browser is closed this parameter is returned |
qrReadSuccess |
If the user is not logged in, the QR code is passed on the terminal a callback is returned. After the correct reading by cell phone this parameter is returned |
qrReadFail |
If the browser stops when the QR code scan is in progress, this parameter is returned |
autocloseCalled |
The browser was closed using the autoClose command |
desconnectedMobile |
Client has desconnected in to mobile |
serverClose |
Client has desconnected in to wss |
deleteToken |
If you pass true within the function |
chatsAvailable |
When Venom is connected to the chat list |
deviceNotConnected |
Chat not available because the phone is disconnected (Trying to connect to the phone)
|
serverWssNotConnected |
The address wss was not found! |
noOpenBrowser |
It was not found in the browser, or some command is missing in args |
initBrowser |
Starting the browser |
openBrowser |
The browser has been successfully opened! |
connectBrowserWs |
Connection with BrowserWs successfully done! |
initWhatsapp |
Starting whatsapp! |
erroPageWhatsapp |
Error accessing whatsapp page |
successPageWhatsapp |
Page Whatsapp successfully accessed |
waitForLogin |
Waiting for login verification! |
waitChat |
Waiting for the chat to load |
successChat |
Chat successfully loaded! |
const venom = require('venom-bot');
venom
.create('sessionName', undefined, (statusSession, session) => {
console.log('Status Session: ', statusSession);
//return isLogged || notLogged || browserClose || qrReadSuccess || qrReadFail || autocloseCalled || desconnectedMobile || deleteToken || chatsAvailable || deviceNotConnected || serverWssNotConnected || noOpenBrowser || initBrowser || openBrowser || connectBrowserWs || initWhatsapp || erroPageWhatsapp || successPageWhatsapp || waitForLogin || waitChat || successChat
//Create session wss return "serverClose" case server for close
console.log('Session name: ', session);
})
.then((client) => {
start(client);
})
.catch((erro) => {
console.log(erro);
});
By default QR code will appear on the terminal. If you need to pass the QR somewhere else heres how:
const fs = require('fs');
const venom = require('venom-bot');
venom
.create(
'sessionName',
(base64Qr, asciiQR, attempts, urlCode) => {
console.log(asciiQR); // Optional to log the QR in the terminal
var matches = base64Qr.match(/^data:([A-Za-z-+\/]+);base64,(.+)$/),
response = {};
if (matches.length !== 3) {
return new Error('Invalid input string');
}
response.type = matches[1];
response.data = new Buffer.from(matches[2], 'base64');
var imageBuffer = response;
require('fs').writeFile(
'out.png',
imageBuffer['data'],
'binary',
function (err) {
if (err != null) {
console.log(err);
}
}
);
},
undefined,
{ logQR: false }
)
.then((client) => {
start(client);
})
.catch((erro) => {
console.log(erro);
});
Puppeteer takes care of the file downloading. The decryption is being done as fast as possible (outruns native methods). Supports big files!
import fs = require('fs');
import mime = require('mime-types');
client.onMessage( async (message) => {
if (message.isMedia === true || message.isMMS === true) {
const buffer = await client.decryptFile(message);
// At this point you can do whatever you want with the buffer
// Most likely you want to write it into a file
const fileName = `some-file-name.${mime.extension(message.mimetype)}`;
fs.writeFile(fileName, buffer, (err) => {
...
});
}
});
Not every available function is listed, for further look, every function available can be found in here and here
// Send Poll
const poll = {
name: 'new poll',
options: [
{
name: 'option 1'
},
{
name: 'option 2'
}
],
selectableOptionsCount: 1
};
await client.sendPollCreation('[email protected]', poll)
.then((result) => {
console.log('Result: ', result); //return object success
})
.catch((erro) => {
console.error('Error when sending: ', erro); //return object error
});
// Send List menu
const list = [
{
title: "Pasta",
rows: [
{
title: "Ravioli Lasagna",
description: "Made with layers of frozen cheese",
}
]
},
{
title: "Dessert",
rows: [
{
title: "Baked Ricotta Cake",
description: "Sweets pecan baklava rolls",
},
{
title: "Lemon Meringue Pie",
description: "Pastry filled with lemonand meringue.",
}
]
}
];
await client.sendListMenu('[email protected]', 'Title', 'subTitle', 'Description', 'menu', list)
.then((result) => {
console.log('Result: ', result); //return object success
})
.catch((erro) => {
console.error('Error when sending: ', erro); //return object error
});
// Send Messages with Buttons Reply
const buttons = [
{
"buttonText": {
"displayText": "Text of Button 1"
}
},
{
"buttonText": {
"displayText": "Text of Button 2"
}
}
]
await client.sendButtons('[email protected]', 'Title', 'Description', buttons)
.then((result) => {
console.log('Result: ', result); //return object success
})
.catch((erro) => {
console.error('Error when sending: ', erro); //return object error
});
// Send audio file MP3
await client.sendVoice('[email protected]', './audio.mp3').then((result) => {
console.log('Result: ', result); //return object success
})
.catch((erro) => {
console.error('Error when sending: ', erro); //return object error
});
// Send audio file base64
await client.sendVoiceBase64('[email protected]', base64MP3)
.then((result) => {
console.log('Result: ', result); //return object success
})
.catch((erro) => {
console.error('Error when sending: ', erro); //return object error
});
// Send contact
await client
.sendContactVcard('[email protected]', '[email protected]', 'Name of contact')
.then((result) => {
console.log('Result: ', result); //return object success
})
.catch((erro) => {
console.error('Error when sending: ', erro); //return object error
});
// Send a list of contact cards
await client
.sendContactVcardList('[email protected]', [
'[email protected]',
'[email protected]',
])
.then((result) => {
console.log('Result: ', result); //return object success
})
.catch((erro) => {
console.error('Error when sending: ', erro); //return object error
});
// Send basic text
await client
.sendText('[email protected]', 'π Hello from venom!')
.then((result) => {
console.log('Result: ', result); //return object success
})
.catch((erro) => {
console.error('Error when sending: ', erro); //return object error
});
// Send text message by injecting keystrokes into WhatsApp, thus maintaining the typing indicator
let success = await client.sendTextViaTyping('[email protected]', 'π Hello from venom!');
// Send photo or video by injecting keystrokes
let success = await client.sendPhotoVideoViaTyping('[email protected]', 'path/to/file.jpg', 'Pretty sunset');
// Send location
await client
.sendLocation('[email protected]', '-13.6561589', '-69.7309264', 'Brasil')
.then((result) => {
console.log('Result: ', result); //return object success
})
.catch((erro) => {
console.error('Error when sending: ', erro); //return object error
});
// Automatically sends a link with the auto generated link preview. You can also add a custom message to be added.
await client
.sendLinkPreview(
'[email protected]',
'https://www.youtube.com/watch?v=V1bFr2SWP1I',
'Kamakawiwo ole'
)
.then((result) => {
console.log('Result: ', result); //return object success
})
.catch((erro) => {
console.error('Error when sending: ', erro); //return object error
});
// Send image (you can also upload an image using a valid HTTP protocol)
await client
.sendImage(
'[email protected]',
'path/to/img.jpg',
'image-name',
'Caption text'
)
.then((result) => {
console.log('Result: ', result); //return object success
})
.catch((erro) => {
console.error('Error when sending: ', erro); //return object error
});
// Send image file base64
await client.sendImageFromBase64('[email protected]', base64Image, "name file")
.then((result) => {
console.log('Result: ', result); //return object success
})
.catch((erro) => {
console.error('Error when sending: ', erro); //return object error
});
// Send file (venom will take care of mime types, just need the path)
// you can also upload an image using a valid HTTP protocol
await client
.sendFile(
'[email protected]',
'path/to/file.pdf',
'file_name',
'See my file in pdf'
)
.then((result) => {
console.log('Result: ', result); //return object success
})
.catch((erro) => {
console.error('Error when sending: ', erro); //return object error
});
// Sends file
// base64 parameter should have mime type already defined
await client
.sendFileFromBase64(
'[email protected]',
base64PDF,
'file_name.pdf',
'See my file in pdf'
)
.then((result) => {
console.log('Result: ', result); //return object success
})
.catch((erro) => {
console.error('Error when sending: ', erro); //return object error
});
// Generates sticker from the provided animated gif image and sends it (Send image as animated sticker)
// image path imageBase64 A valid gif and webp image is required. You can also send via http/https (http://www.website.com/img.gif)
await client
.sendImageAsStickerGif('[email protected]', './image.gif')
.then((result) => {
console.log('Result: ', result); //return object success
})
.catch((erro) => {
console.error('Error when sending: ', erro); //return object error
});
// Generates sticker from given image and sends it (Send Image As Sticker)
// image path imageBase64 A valid png, jpg and webp image is required. You can also send via http/https (http://www.website.com/img.jpg)
await client
.sendImageAsSticker('[email protected]', './image.jpg')
.then((result) => {
console.log('Result: ', result); //return object success
})
.catch((erro) => {
console.error('Error when sending: ', erro); //return object error
});
// Forwards messages
await client.forwardMessages(
'[email protected]',
['[email protected]_B70847EE89E22D20FB86ECA0C1B11609','[email protected]_B70847EE89E22D20FB86ECA0C1B11777']
).then((result) => {
console.log('Result: ', result); //return object success
})
.catch((erro) => {
console.error('Error when sending: ', erro); //return object error
});
// Send @tagged message
await client.sendMentioned(
'[email protected]',
'Hello @5218113130740 and @5218243160777!',
['5218113130740', '5218243160777']
);
// Reply to a message
await client.reply(
'[email protected]',
'This is a reply!',
'[email protected]_7C22WHCB6DKYHJKQIEN9'
).then((result) => {
console.log('Result: ', result); //return object success
}).catch((erro) => {
console.error('Error when sending: ', erro); //return object error
});
// Send message with options
await client.
.sendMessageOptions(
'[email protected]',
'This is a reply!',
{
quotedMessageId: reply,
}
)
.then((retorno) => {
resp = retorno;
})
.catch((e) => {
console.log(e);
});
// Send gif
await client.sendVideoAsGif(
'[email protected]',
'path/to/video.mp4',
'video.gif',
'Gif image file'
);
//checks and returns whether a message and a reply
// exemple:
// await client.onMessage(async (message) => {
// console.log(await client.returnReply(message)); // replicated message
// console.log(message.body ); //customer message
// })
checkReply = await client.returnReply(messagem);
// Send seen βοΈβοΈ
await client.sendSeen('[email protected]');
// Start typing...
await client.startTyping('[email protected]');
// Set chat state (0: Typing, 1: Recording, 2: Paused)
await client.setChatState('[email protected]', 0 | 1 | 2);
// Retrieve all chats
const chats = await client.getAllChats();
//Retrieves all chats new messages
const chatsAllNew = getAllChatsNewMsg();
//Retrieves all chats Contacts
const contacts = await client.getAllChatsContacts();
//Retrieve all contacts new messages
const contactNewMsg = await client.getChatContactNewMsg();
// Retrieve all groups
// you can pass the group id optional use, exemple: client.getAllChatsGroups('[email protected]')
const chats = await client.getAllChatsGroups();
//Retrieve all groups new messages
const groupNewMsg = await client.getChatGroupNewMsg();
//Retrieves all chats Transmission list
const transmission = await client.getAllChatsTransmission();
// Retrieve contacts
const contacts = await client.getAllContacts();
// Returns a list of mute and non-mute users
// "all" List all mutes
// "toMute" List all silent chats
// "noMute" List all chats without silence
const listMute = await client.getListMute('all');
// Calls your list of blocked contacts (returns an array)
const getBlockList = await client.getBlockList();
// Retrieve messages in chat
//chatID chat id
//includeMe will be by default true, if you do not want to pass false
//includeNotifications will be by default true, if you do not want to pass false
//const Messages = await client.getAllMessagesInChat(chatID, includeMe, includeNotifications)
const Messages = await client.getAllMessagesInChat('[email protected]');
// Retrieve more chat message
const moreMessages = await client.loadEarlierMessages('[email protected]');
// Retrieve all messages in chat
const allMessages = await client.loadAndGetAllMessagesInChat(
'[email protected]'
);
// Retrieve contact status
const status = await client.getStatus('[email protected]');
// Retrieve user profile
// Please note that this function does not currently work due to a bug in WhatsApp itself.
// There is no telling if or when this function might work again.
const user = await client.getNumberProfile('[email protected]');
// Retrieve all unread message
const messages = await client.getUnreadMessages();
// Retrieve profile fic (as url)
const url = await client.getProfilePicFromServer('[email protected]');
// Retrieve chat/conversation
const chat = await client.getChat('[email protected]');
// Check if the number exists
const chat = await client
.checkNumberStatus('[email protected]')
.then((result) => {
console.log('Result: ', result); //return object success
})
.catch((erro) => {
console.error('Error when sending: ', erro); //return object error
});
// groupId or chatId: leaveGroup [email protected]
//change group description
await client
.setGroupDescription('[email protected]', 'group description')
.then((result) => {
console.log('Result: ', result); //return object success
})
.catch((erro) => {
console.error('Error when sending: ', erro); //return object error
});
// Leave group
await client.leaveGroup('[email protected]');
// Get group members
await client.getGroupMembers('[email protected]');
// Get group members ids
await client.getGroupMembersIds('[email protected]');
// Generate group invite url link
await client.getGroupInviteLink('[email protected]');
// Create group (title, participants to add)
await client.createGroup('Group name', [
'[email protected]',
'[email protected]'
]);
// Remove participant
await client.removeParticipant('[email protected]', '[email protected]');
// Add participant
await client.addParticipant('[email protected]', '[email protected]');
// Promote participant (Give admin privileges)
await client.promoteParticipant('[email protected]', '[email protected]');
// Demote particiapnt (Revoke admin privileges)
await client.demoteParticipant('[email protected]', '[email protected]');
// Get group admins
await client.getGroupAdmins('[email protected]');
// Return the group status, jid, description from it's invite link
await client.getGroupInfoFromInviteLink(InviteCode);
// Join a group using the group invite code
await client.joinGroup(InviteCode);
// Set client status
await client.setProfileStatus('On vacations! βοΈ');
// Set client profile name
await client.setProfileName('Venom bot');
// Set client profile photo
await client.setProfilePic('path/to/image.jpg');
// Get device info
await client.getHostDevice();
// Disconnect from service
await client.logout();
// Delete the Service Worker
await client.killServiceWorker();
// Load the service again
await client.restartService();
// Get connection state
await client.getConnectionState();
// Get battery level
await client.getBatteryLevel();
// Is connected
await client.isConnected();
// Get whatsapp web version
await client.getWAVersion();
//Listens to all new messages
//To receiver or recipient
client.onAnyMessage(message => {
...
};
// Listen to messages
client.onMessage(message => {
...
})
// Listen to state changes
client.onStateChange(state => {
...
});
// Listen to ack's
// See the status of the message when sent.
// When receiving the confirmation object, "ack" may return a number, look {@link AckType} for details:
// -7 = MD_DOWNGRADE,
// -6 = INACTIVE,
// -5 = CONTENT_UNUPLOADABLE,
// -4 = CONTENT_TOO_BIG,
// -3 = CONTENT_GONE,
// -2 = EXPIRED,
// -1 = FAILED,
// 0 = CLOCK,
// 1 = SENT,
// 2 = RECEIVED,
// 3 = READ,
// 4 = PLAYED =
client.onAck(ack => {
...
});
// Listen to live location
// chatId: '[email protected]'
client.onLiveLocation("[email protected]", (liveLocation) => {
...
});
// chatId looks like this: '[email protected]'
// Event interface is in here: https://github.com/s2click/venom/blob/master/src/api/model/participant-event.ts
client.onParticipantsChanged("[email protected]", (event) => {
...
});
// Listen when client has been added to a group
client.onAddedToGroup(chatEvent => {
...
});
//Check if there is chat
await client
.checkChat(chatId)
.then((result) => {
console.log('Result: ', result); //return object success
})
.catch((erro) => {
console.error('Error when sending: ', erro); //return object error
});
// Pin chat and Unpin chat messages with true or false
// Pin chat, non-existent (optional)
await client
.pinChat(chatId, true, false)
.then((result) => {
console.log('Result: ', result); //return object success
})
.catch((erro) => {
console.error('Error when sending: ', erro); //return object error
});
///mute a contact
await client
.sendMute(
'[email protected]', //contact mute
30, //duration of silence, example: 30 minutes
'minutes' ///kind of silence "hours" "minutes" "year"
)
.then((result) => {
console.log('Result: ', result); //return object success
})
.catch((erro) => {
console.error('Error when sending: ', erro); //return object error
});
///unmute contact
await client
.sendMute(
'[email protected]' //contact unmute
)
.then((result) => {
console.log('Result: ', result); //return object success
})
.catch((erro) => {
console.error('Error when sending: ', erro); //return object error
});
// Change the theme
// string types "dark" or "light"
await client.setTheme('dark');
// Receive the current theme
// returns string light or dark
await client.getTheme();
// Delete chat
await client.deleteChat('[email protected]');
// Clear chat messages
await client.clearChatMessages('[email protected]');
// Archive and unarchive chat messages with true or false
await client.archiveChat(chatId, true);
// Delete message (last parameter: delete only locally)
await client
.deleteMessage('[email protected]', [
'[email protected]_B70847EE89E22D20FB86ECA0C1B11609',
'[email protected]_B70847EE89E22D20FB86ECA0C1B11777'
])
.then((result) => {
console.log('Result: ', result); //return object success
})
.catch((erro) => {
console.error('Error when sending: ', erro); //return object error
});
// Mark chat as not seen (returns true if it works)
await client.markUnseenMessage('[email protected]');
// Blocks a user (returns true if it works)
await client.blockContact('[email protected]');
// Unlocks contacts (returns true if it works)
await client.unblockContact('[email protected]');
There are some tricks for a better usage of venom.
// function to detect conflits and change status
// Force it to keep the current session
// Possible state values:
// CONFLICT
// CONNECTED
// DEPRECATED_VERSION
// OPENING
// PAIRING
// PROXYBLOCK
// SMB_TOS_BLOCK
// TIMEOUT
// TOS_BLOCK
// UNLAUNCHED
// UNPAIRED
// UNPAIRED_IDLE
client.onStateChange((state) => {
console.log('State changed: ', state);
// force whatsapp take over
if ('CONFLICT'.includes(state)) client.useHere();
// detect disconnect on whatsapp
if ('UNPAIRED'.includes(state)) console.log('logout');
});
// DISCONNECTED
// SYNCING
// RESUMING
// CONNECTED
let time = 0;
client.onStreamChange((state) => {
console.log('State Connection Stream: ' + state);
clearTimeout(time);
if (state === 'DISCONNECTED' || state === 'SYNCING') {
time = setTimeout(() => {
client.close();
}, 80000);
}
});
// function to detect incoming call
client.onIncomingCall(async (call) => {
console.log(call);
client.sendText(call.peerJid, "Sorry, I still can't answer calls");
});
Close the session properly to ensure the session is saved for the next time you log in (So it won't ask for QR scan again). So instead of CTRL+C,
// Catch ctrl+C
process.on('SIGINT', function() {
client.close();
});
// Try-catch close
try {
...
} catch (error) {
client.close();
}
The auto close is enabled by default and the timeout is set to 60 sec. Receives the time in milliseconds to countdown until paired.
Use "autoClose: 0 | false" to disable auto closing.
You can use cached versions of WhatsApp Web by passing the webVersion
arguments as part of your venom options:
venom.create({
session: 'sessionname', //name of session
headless: false,
logQR: true,
webVersion: '2.2402.5'
})
.then((client) => {
start(client);
});
This feature can use any version available in the list at https://github.com/wppconnect-team/wa-version/tree/main/html
Building venom is really simple altough it contains 3 main projects inside
- Wapi project
> npm run build:wapi
- Middleware
> npm run build:middleware
> npm run build:jsQR
- Venom
> npm run build:venom
To build the entire project just run
> npm run build
Maintainers are needed, I cannot keep with all the updates by myself. If you are interested please open a Pull Request.
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
For Tasks:
Click tags to check more tools for each tasksFor Jobs:
Alternative AI tools for venom
Similar Open Source Tools
venom
Venom is a high-performance system developed with JavaScript to create a bot for WhatsApp, support for creating any interaction, such as customer service, media sending, sentence recognition based on artificial intelligence and all types of design architecture for WhatsApp.
orch
orch is a library for building language model powered applications and agents for the Rust programming language. It can be used for tasks such as text generation, streaming text generation, structured data generation, and embedding generation. The library provides functionalities for executing various language model tasks and can be integrated into different applications and contexts. It offers flexibility for developers to create language model-powered features and applications in Rust.
aiotdlib
aiotdlib is a Python asyncio Telegram client based on TDLib. It provides automatic generation of types and functions from tl schema, validation, good IDE type hinting, and high-level API methods for simpler work with tdlib. The package includes prebuilt TDLib binaries for macOS (arm64) and Debian Bullseye (amd64). Users can use their own binary by passing `library_path` argument to `Client` class constructor. Compatibility with other versions of the library is not guaranteed. The tool requires Python 3.9+ and users need to get their `api_id` and `api_hash` from Telegram docs for installation and usage.
amadeus-node
Amadeus Node SDK provides a rich set of APIs for the travel industry. It allows developers to interact with various endpoints related to flights, hotels, activities, and more. The SDK simplifies making API calls, handling promises, pagination, logging, and debugging. It supports a wide range of functionalities such as flight search, booking, seat maps, flight status, points of interest, hotel search, sentiment analysis, trip predictions, and more. Developers can easily integrate the SDK into their Node.js applications to access Amadeus APIs and build travel-related applications.
ax
Ax is a Typescript library that allows users to build intelligent agents inspired by agentic workflows and the Stanford DSP paper. It seamlessly integrates with multiple Large Language Models (LLMs) and VectorDBs to create RAG pipelines or collaborative agents capable of solving complex problems. The library offers advanced features such as streaming validation, multi-modal DSP, and automatic prompt tuning using optimizers. Users can easily convert documents of any format to text, perform smart chunking, embedding, and querying, and ensure output validation while streaming. Ax is production-ready, written in Typescript, and has zero dependencies.
com.openai.unity
com.openai.unity is an OpenAI package for Unity that allows users to interact with OpenAI's API through RESTful requests. It is independently developed and not an official library affiliated with OpenAI. Users can fine-tune models, create assistants, chat completions, and more. The package requires Unity 2021.3 LTS or higher and can be installed via Unity Package Manager or Git URL. Various features like authentication, Azure OpenAI integration, model management, thread creation, chat completions, audio processing, image generation, file management, fine-tuning, batch processing, embeddings, and content moderation are available.
chrome-ai
Chrome AI is a Vercel AI provider for Chrome's built-in model (Gemini Nano). It allows users to create language models using Chrome's AI capabilities. The tool is under development and may contain errors and frequent changes. Users can install the ChromeAI provider module and use it to generate text, stream text, and generate objects. To enable AI in Chrome, users need to have Chrome version 127 or greater and turn on specific flags. The tool is designed for developers and researchers interested in experimenting with Chrome's built-in AI features.
dashscope-sdk
DashScope SDK for .NET is an unofficial SDK maintained by Cnblogs, providing various APIs for text embedding, generation, multimodal generation, image synthesis, and more. Users can interact with the SDK to perform tasks such as text completion, chat generation, function calls, file operations, and more. The project is under active development, and users are advised to check the Release Notes before upgrading.
rust-genai
genai is a multi-AI providers library for Rust that aims to provide a common and ergonomic single API to various generative AI providers such as OpenAI, Anthropic, Cohere, Ollama, and Gemini. It focuses on standardizing chat completion APIs across major AI services, prioritizing ergonomics and commonality. The library initially focuses on text chat APIs and plans to expand to support images, function calling, and more in the future versions. Version 0.1.x will have breaking changes in patches, while version 0.2.x will follow semver more strictly. genai does not provide a full representation of a given AI provider but aims to simplify the differences at a lower layer for ease of use.
nb_utils
nb_utils is a Flutter package that provides a collection of useful methods, extensions, widgets, and utilities to simplify Flutter app development. It includes features like shared preferences, text styles, decorations, widgets, extensions for strings, colors, build context, date time, device, numbers, lists, scroll controllers, system methods, network utils, JWT decoding, and custom dialogs. The package aims to enhance productivity and streamline common tasks in Flutter development.
aiocryptopay
The aiocryptopay repository is an asynchronous API wrapper for interacting with the @cryptobot and @CryptoTestnetBot APIs. It provides methods for creating, getting, and deleting invoices and checks, as well as handling webhooks for invoice payments. Users can easily integrate this tool into their applications to manage cryptocurrency payments and transactions.
langchain-rust
LangChain Rust is a library for building applications with Large Language Models (LLMs) through composability. It provides a set of tools and components that can be used to create conversational agents, document loaders, and other applications that leverage LLMs. LangChain Rust supports a variety of LLMs, including OpenAI, Azure OpenAI, Ollama, and Anthropic Claude. It also supports a variety of embeddings, vector stores, and document loaders. LangChain Rust is designed to be easy to use and extensible, making it a great choice for developers who want to build applications with LLMs.
mediapipe-rs
MediaPipe-rs is a Rust library designed for MediaPipe tasks on WasmEdge WASI-NN. It offers easy-to-use low-code APIs similar to mediapipe-python, with low overhead and flexibility for custom media input. The library supports various tasks like object detection, image classification, gesture recognition, and more, including TfLite models, TF Hub models, and custom models. Users can create task instances, run sessions for pre-processing, inference, and post-processing, and speed up processing by reusing sessions. The library also provides support for audio tasks using audio data from symphonia, ffmpeg, or raw audio. Users can choose between CPU, GPU, or TPU devices for processing.
aioaws
Aioaws is an asyncio SDK for some AWS services, providing clean, secure, and easily debuggable access to services like S3, SES, and SNS. It is written from scratch without dependencies on boto or boto3, formatted with black, and includes complete type hints. The library supports various functionalities such as listing, deleting, and generating signed URLs for S3 files, sending emails with attachments and multipart content via SES, and receiving notifications about mail delivery from SES. It also offers AWS Signature Version 4 authentication and has minimal dependencies like aiofiles, cryptography, httpx, and pydantic.
island-ai
island-ai is a TypeScript toolkit tailored for developers engaging with structured outputs from Large Language Models. It offers streamlined processes for handling, parsing, streaming, and leveraging AI-generated data across various applications. The toolkit includes packages like zod-stream for interfacing with LLM streams, stream-hooks for integrating streaming JSON data into React applications, and schema-stream for JSON streaming parsing based on Zod schemas. Additionally, related packages like @instructor-ai/instructor-js focus on data validation and retry mechanisms, enhancing the reliability of data processing workflows.
ElevenLabs-DotNet
ElevenLabs-DotNet is a non-official Eleven Labs voice synthesis RESTful client that allows users to convert text to speech. The library targets .NET 8.0 and above, working across various platforms like console apps, winforms, wpf, and asp.net, and across Windows, Linux, and Mac. Users can authenticate using API keys directly, from a configuration file, or system environment variables. The tool provides functionalities for text to speech conversion, streaming text to speech, accessing voices, dubbing audio or video files, generating sound effects, managing history of synthesized audio clips, and accessing user information and subscription status.
For similar tasks
venom
Venom is a high-performance system developed with JavaScript to create a bot for WhatsApp, support for creating any interaction, such as customer service, media sending, sentence recognition based on artificial intelligence and all types of design architecture for WhatsApp.
IBRAHIM-AI-10.10
BMW MD is a simple WhatsApp user BOT created by Ibrahim Tech. It allows users to scan pairing codes or QR codes to connect to WhatsApp and deploy the bot on Heroku. The bot can be used to perform various tasks such as sending messages, receiving messages, and managing contacts. It is released under the MIT License and contributions are welcome.
wppconnect
WPPConnect is an open source project developed by the JavaScript community with the aim of exporting functions from WhatsApp Web to the node, which can be used to support the creation of any interaction, such as customer service, media sending, intelligence recognition based on phrases artificial and many other things.
aio-pika
Aio-pika is a wrapper around aiormq for asyncio and humans. It provides a completely asynchronous API, object-oriented API, transparent auto-reconnects with complete state recovery, Python 3.7+ compatibility, transparent publisher confirms support, transactions support, and complete type-hints coverage.
AIS-catcher-for-Android
AIS-catcher for Android is a multi-platform AIS receiver app that transforms your Android device into a dual channel AIS receiver. It directly accesses a Software Defined Radio USB device to pick up AIS signals from nearby vessels, visualizing them on a built-in map or sending messages via UDP to plotting apps. The app requires a RTL-SDR dongle or an AirSpy device, a simple antenna, an Android device with USB connector, and an OTG cable. It is designed for research and educational purposes under the GPL license, with no warranty. Users are responsible for prudent use and compliance with local regulations. The app is not intended for navigation or safety purposes.
aiomqtt
aiomqtt is an idiomatic asyncio MQTT client that allows users to interact with MQTT brokers using asyncio in Python. It eliminates the need for callbacks and return codes, providing a more streamlined experience. The tool supports MQTT versions 5.0, 3.1.1, and 3.1, and offers graceful disconnection handling. It is fully type-hinted, making it easier to work with. Users can publish and subscribe to MQTT topics with ease, making it a versatile tool for MQTT communication in Python.
aituber-server
AITuberKit server-side is a tool that allows users to receive messages via WebSocket and obtain responses from Open Interpreter. Users can also send files to the server for storage and issue commands to Open Interpreter. The tool is designed for WebSocket operation and provides a default connection URL of `ws://127.0.0.1:8000/ws`. It supports debugging in VSCode with DEBUG_MODE=1. The tool is licensed under KillianLucas/open-interpreter and includes a guide on how to use Open Interpreter.
uAgents
uAgents is a Python library developed by Fetch.ai that allows for the creation of autonomous AI agents. These agents can perform various tasks on a schedule or take action on various events. uAgents are easy to create and manage, and they are connected to a fast-growing network of other uAgents. They are also secure, with cryptographically secured messages and wallets.
For similar jobs
LLMStack
LLMStack is a no-code platform for building generative AI agents, workflows, and chatbots. It allows users to connect their own data, internal tools, and GPT-powered models without any coding experience. LLMStack can be deployed to the cloud or on-premise and can be accessed via HTTP API or triggered from Slack or Discord.
daily-poetry-image
Daily Chinese ancient poetry and AI-generated images powered by Bing DALL-E-3. GitHub Action triggers the process automatically. Poetry is provided by Today's Poem API. The website is built with Astro.
exif-photo-blog
EXIF Photo Blog is a full-stack photo blog application built with Next.js, Vercel, and Postgres. It features built-in authentication, photo upload with EXIF extraction, photo organization by tag, infinite scroll, light/dark mode, automatic OG image generation, a CMD-K menu with photo search, experimental support for AI-generated descriptions, and support for Fujifilm simulations. The application is easy to deploy to Vercel with just a few clicks and can be customized with a variety of environment variables.
SillyTavern
SillyTavern is a user interface you can install on your computer (and Android phones) that allows you to interact with text generation AIs and chat/roleplay with characters you or the community create. SillyTavern is a fork of TavernAI 1.2.8 which is under more active development and has added many major features. At this point, they can be thought of as completely independent programs.
Twitter-Insight-LLM
This project enables you to fetch liked tweets from Twitter (using Selenium), save it to JSON and Excel files, and perform initial data analysis and image captions. This is part of the initial steps for a larger personal project involving Large Language Models (LLMs).
AISuperDomain
Aila Desktop Application is a powerful tool that integrates multiple leading AI models into a single desktop application. It allows users to interact with various AI models simultaneously, providing diverse responses and insights to their inquiries. With its user-friendly interface and customizable features, Aila empowers users to engage with AI seamlessly and efficiently. Whether you're a researcher, student, or professional, Aila can enhance your AI interactions and streamline your workflow.
ChatGPT-On-CS
This project is an intelligent dialogue customer service tool based on a large model, which supports access to platforms such as WeChat, Qianniu, Bilibili, Douyin Enterprise, Douyin, Doudian, Weibo chat, Xiaohongshu professional account operation, Xiaohongshu, Zhihu, etc. You can choose GPT3.5/GPT4.0/ Lazy Treasure Box (more platforms will be supported in the future), which can process text, voice and pictures, and access external resources such as operating systems and the Internet through plug-ins, and support enterprise AI applications customized based on their own knowledge base.
obs-localvocal
LocalVocal is a live-streaming AI assistant plugin for OBS that allows you to transcribe audio speech into text and perform various language processing functions on the text using AI / LLMs (Large Language Models). It's privacy-first, with all data staying on your machine, and requires no GPU, cloud costs, network, or downtime.