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
The value of the license is $50 monthly dollars, to acquire contact in whatsapp by clicking on the image below !!
Run the following command to ensure you have SuperChats installed:
$ npm install superchats
or using yarn:
$ yarn add superchats
- Getting Started
- Multiples Sessions
- Optional Parameters
- Download and Save Files
- Disconnect Functions
- Message Sending Functions
- Get All Contacts
- Delete Message
- Forwarding Message
- Mute Chat
- Get Chats
- Read Chat Messages
- Get Block List
- Archive Chat
- Delete Chat
- Pin Chat
- Block Contact
- Get Profile Status
- Get Picture
- Set Picture
- Get Number Profile
- Groups Functions
- Get Host Device
- Chat Messages Functions
- Update Presence
- Send Messages for Status
- Observation Events
const superchats = require("superchats");
async function start(){
let client = await superchats.create({
session: "Marketing",
license: "asjdh-efddff734-sdsdf834-233272",
nodata: true,
logQr: false,
qr: true,
code: false,
statusFind: async (status) => {
console.log(status)
},
qrcode: async (session, base64Img, asciiQR, urlCode) => {
console.log(asciiQR)
},
onMessage: async (message) => {
if ((message.type == "text" || message.subtype == 'text') && message.content == "hi") {
await client.sendText(message.from, "Let's GO Superchats");
}
} // Receive an event all the time you receive a message from some contact
})
return client;
}
(async function(){
let client = await start();
let response = await client.sendText('0000000000000', 'Thanks for using Superchats!!!')
console.log(response)
})()
After executing create() function, Superchats will create an instance of whatsapp. 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! Superchats will remember the session so there is no need to authenticate everytime. Multiples sessions can be created at the same time by pasing a session name to create() function:
// Init sales whatsapp bot
superchats.create({session:'sales', license: "asjdh-efddff734-sdsdf834-233272"}).then((salesClient) => {...});
// Init support whatsapp bot
ssuperchats.create({session:'support', license: "asjdh-efddff734-sdsdf834-233272"}).then((supportClient) => {...});
Optional parameters are started along with the connection as events of QRCODE and CONNECTION STATUS, plus extra options
const superchats = require("superchats");
superchats.create({
session: "Marketing",
license: "asjdh-efddff734-sdsdf834-233272", // Valid license to use Superchats
welcomeScreen: true, // Show or hide welcome in terminal
retries: 3, // Number of connection attempts,
nodata true, // It doesn't get the entire history of the device (default = true)
logQr: true, // (Default is true) Logs QR automatically in terminal
qr: true, // If marked true uses the QR code instead of the pairing code
code: false, // if marked true, uses the pairing code instead of the QR
phoneNumber: "556185290357", // Number for pairing with WhatsApp alternative to QR
qrcode: (sessionId, base64QR, asciiQR, urlCode) => {
console.log("sessionId: " + sessionId)
console.log("base64 image of qrcode: " + base64QR);
console.log("Terminal image of qrcode in caracter ascii: " + asciiQR);
console.log("Terminal string hash of qrcode: " + urlCode);
},
pairing: (sessionId, code){
console.log("Session name: " + sessionId)
console.log("Pairing code: " + code)
},
statusFind: (statusSession) => {
console.log("Status Session: ", statusSession);
},
onMessage: (event) => { // Receive an event all the time you receive a message from some contact
console.log(event)
},
onMessageFull: (event) => { // Receive an event all the time you receive a message complete no filters direct of socket do whatsapp
console.log(event)
},
onAck: (event) => { // Receive an event every time you send a message to some contact with the States of: failed, pending, sent, received or read
console.log(event)
},
onPresence: (event) => { // Receive an event every time a contact is: typing, recording, online or offline with you
console.log(event)
},
onGroups: (event) => { // Receive events all time the name of a group, configurations are changed
console.log(event)
},
onParticipants: (event) => { // Receive events about group participants
console.log(event)
},
onDelete: (event) => { // Receive events every time a message is deleted
console.log(event)
}
})
Get connection feedback by following codes:
Status | Condition |
---|---|
isLogged |
When the client already has a valid token and will not need to read the qrcode again |
notLogged |
When the client does not have a valid token and needs to read the qr code again |
isDisconnected |
The client has disconnected or has been disconnected |
isLogout |
The client has disconnected and removed the token from the device |
isConnected |
The client has successfully connected list |
serverDisconnected |
Disconnected for whatsapp socket server |
isReconnected |
notifies that it is connected so that you can check if it has been successfully connected |
Download and save any message file with the functions below
let client = await superchats.create({
session: "Marketing",
license: "asjdh-efddff734-sdsdf834-233272",
onMessage: async (message) => {
if (message.isMedia === true) {
//retrieve the file buffer for a given message
// Attention, use a delay of at least 2 seconds
const buffer = await client.decryptByIdFile(message.from, message.id);
// Save the message file in the project's root or in a directory: './diretory/filename' don't forget to create the directory
// Attention, use a delay of at least 2 seconds
const saveFile = await client.decryptByIdFileSave(message.from, message.id, filename);
}
} // Receive an event all the time you receive a message from some contact
})
{
session: 'Marketing',
status: 200,
type: "decrypt-by-id-file",
buffer: {
type: "Buffer",
data: [137,80,78,71,13,10,26,10,0,0,0,13,73,72,68]
}
}
{
session: 'Marketing',
status: 404,
type: "decrypt-by-id-file-save",
response: "./files/teste4.mp4"
}
Disconnect Functions
client.close()
client.logout()
We created the easiest way to send messages with Superchats
Sending messages can be sent to the contact's number, example: 5561981590153 or to a group ID, example: 15815954040-1631239154
let response = await client.sendText("5561981590153", "Thanks for using Superchats!!!");
To reply to a message, use the id of the message you want to reply to in the last parameter, which is optional.
let response = await client.sendText("5561981590153", "Reply Message!!!", '3EB01A690E67');
{
session: 'Marketing',
status: 200,
type: 'text',
id: '3EB01A690E67',
to: '556181590153',
content: 'Thanks for using Superchats!!!',
isgroup: false,
timestamp: 1633101992
}
{
session: 'Marketing',
status: 404,
type: 'text',
message: 'message of erro'
}
For image submission, you can use URL or the local file path
let response = await client.sendImage("5561981590153", "https://github.com/orkestral/superchats/raw/main/img/superchats.png", "Text optional");
To reply to a message with image, use the id of the message you want to reply to in the last parameter, which is optional.
let response = await client.sendImage("5561981590153", "https://github.com/orkestral/superchats/raw/main/img/superchats.png", "Reply with image", '3EB01A690E67');
{
session: 'Marketing',
status: 200,
type: 'image',
id: '3EB0FF4E2532',
to: '556181590153',
isgroup: false,
file: {
url: 'https://mmg.whatsapp.net/d/f/AmkmMjj4ZqieB6bDxS-Trox10ldAe5aIUZ5uQLutyKL8.enc',
caption: 'Text optional',
mimetype: 'image/jpeg',
fileSha256: <Buffer 11 ed 0d 21 f2 59 96 9a 65 cf 7e fa c1 57 a1 ee a2 c9 50 b4 0d 09 df df a8 9f e1 44 dd cf a6 a5>,
fileLength: Long { low: 15183, high: 0, unsigned: true },
height: 0,
width: 0,
mediaKey: <Buffer 17 0e ba 4b e6 81 69 eb 2b 30 28 59 5f a1 f4 42 7d fa 18 61 8a de 74 28 09 fc 92 79 7e 3d cc d4>,
fileEncSha256: <Buffer fe 62 a7 a4 d9 c3 ca 84 44 51 26 08 4c 7f fe 0a b1 13 f0 ad b9 9a ba 7e de a4 83 35 07 b0 5a 3e>,
directPath: '',
thumbnail: <Buffer >
},
participant: '',
timestamp: 1633106913
}
{
session: 'Marketing',
status: 404,
type: 'image',
message: 'message of erro'
}
For image sticker submission, you can use URL or the local file path
let response = await client.sendSticker("5561981590153", "https://static-00.iconduck.com/assets.00/node-js-icon-454x512-nztofx17.png");
To reply to a message with image sticker, use the id of the message you want to reply to in the last parameter, which is optional.
let response = await client.sendSticker("5561981590153", "https://static-00.iconduck.com/assets.00/node-js-icon-454x512-nztofx17.png", '3EB01A690E67');
{
session: 'Marketing',
status: 200,
type: 'sticker',
id: '3EB07B2F281B',
to: '556181590153',
isgroup: false,
file: {
url: 'https://mmg.whatsapp.net/d/f/Ak39fUdprDRnKalZbWWyepoMbvNBlEOgIqZzY7GLEBil.enc',
mimetype: 'image/webp',
fileSha256: <Buffer ac b2 5f f4 af a4 2e 6d 9e 15 4a e7 58 c0 b3 0f df b6 0b 3f 27 cb 6c d9 55 dd 90 7f e8 92 b8 f7>,
fileLength: Long { low: 23001, high: 0, unsigned: true },
mediaKey: <Buffer 6e 96 87 f9 90 1e f5 ae cb 8a c6 9d 95 92 86 ca d3 1a 2a e1 d6 f1 1f f6 5e c3 56 1f 8f 14 1b 08>,
fileEncSha256: <Buffer 69 88 d6 36 1c 8b 5f 02 a1 8f e1 6b b2 41 3d da 68 77 b8 8b fd df f0 d0 73 5b bf 2c 84 ee 7e b4>,
directPath: ''
},
participant: '',
timestamp: 1633129024
}
{
session: 'Marketing',
status: 404,
type: 'sticker',
message: 'message of erro'
}
For video submission, you can use URL or the local file path
let response = await client.sendVideo("5561981590153", "https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerMeltdowns.mp4", "Text optional");
To reply to a message with video, use the id of the message you want to reply to in the last parameter, which is optional.
let response = await client.sendVideo("5561981590153", "https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerMeltdowns.mp4", "Reply with video", '3EB01A690E67');
{
session: 'Marketing',
status: 200,
type: 'video',
id: '3EB0612BED9B',
to: '556181590153',
isgroup: false,
file: {
url: 'https://mmg.whatsapp.net/d/f/AnrExTInFHkr446WcJoVnbHhhb1Tdmg8ort6g1SweEvS.enc',
caption: 'Text optional',
mimetype: 'video/mp4',
fileSha256: <Buffer 75 de 47 ac c8 b9 b5 c6 ef 56 56 6e eb 50 72 af c3 bd e0 a4 ff 4f f4 09 62 a4 b5 33 c1 26 db 46>,
fileLength: Long { low: 2252313, high: 0, unsigned: true },
mediaKey: <Buffer f7 91 19 c6 62 30 93 cc cb 83 b0 5a 20 f7 1c 5b 62 a6 36 fc 93 53 87 df 14 69 a6 14 db 9c ff 5e>,
fileEncSha256: <Buffer 49 d9 c9 e4 61 96 36 fc 7e ae 83 a4 da a1 70 5e d2 d5 f4 f1 74 15 52 26 84 8f f1 cb f4 54 82 3f>,
directPath: '',
thumbnail: <Buffer >
},
participant: '',
timestamp: 1633108332
}
{
session: 'Marketing',
status: 404,
type: 'video',
message: 'message of erro'
}
For audio submission, you can use URL or the local file path
let response = await client.sendAudio("5561981590153", "https://file-examples-com.github.io/uploads/2017/11/file_example_MP3_700KB.mp3");
To reply to a message with audio, use the id of the message you want to reply to in the last parameter, which is optional.
let response = await client.sendAudio("5561981590153", "https://file-examples-com.github.io/uploads/2017/11/file_example_MP3_700KB.mp3", '3EB01A690E67');
{
session: 'Marketing',
status: 200,
type: 'audio',
id: '3EB072B039F6',
to: '556181590153',
content: '',
isgroup: false,
file: {
url: 'https://mmg.whatsapp.net/d/f/AjwRfBCBZ1XgeSLtdVTr96lMJO5CtZtjCi0HpNjEctDW.enc',
mimetype: 'audio/ogg; codecs=opus',
fileSha256: <Buffer fa 28 20 25 6f 2c d3 f2 df 03 fa 24 7d 7b 01 e7 9d 3f e7 94 34 4a ad ce a0 8c ee 06 bc ce 3c 94>,
fileLength: Long { low: 764176, high: 0, unsigned: true },
seconds: 27,
mediaKey: <Buffer ad f9 19 91 76 08 28 59 63 b2 be 43 13 8d 68 5b d3 90 e7 93 6d 32 29 5e e8 b5 b9 cb 37 76 d6 27>,
fileEncSha256: <Buffer ab d4 0e 48 ca 4c 1e 47 86 02 50 3f 0d 87 aa 7f a7 82 ac ff eb 8d 1f ac f1 f8 6d da 36 1e ba e4>,
directPath: ''
},
participant: '',
timestamp: 1633111077
}
{
session: 'Marketing',
status: 404,
type: 'audio',
message: 'message of erro'
}
For audio voice submission, you can use URL or the local file path
let response = await client.sendVoice("5561981590153", "https://file-examples-com.github.io/uploads/2017/11/file_example_MP3_700KB.mp3");
To reply to a message with audio voice, use the id of the message you want to reply to in the last parameter, which is optional.
let response = await client.sendVoice("5561981590153", "https://file-examples-com.github.io/uploads/2017/11/file_example_MP3_700KB.mp3", '3EB01A690E67');
{
session: 'Marketing',
status: 200,
type: 'voice',
id: '3EB072B039F6',
to: '556181590153',
content: '',
isgroup: false,
file: {
url: 'https://mmg.whatsapp.net/d/f/AjwRfBCBZ1XgeSLtdVTr96lMJO5CtZtjCi0HpNjEctDW.enc',
mimetype: 'audio/ogg; codecs=opus',
fileSha256: <Buffer fa 28 20 25 6f 2c d3 f2 df 03 fa 24 7d 7b 01 e7 9d 3f e7 94 34 4a ad ce a0 8c ee 06 bc ce 3c 94>,
fileLength: Long { low: 764176, high: 0, unsigned: true },
seconds: 27,
mediaKey: <Buffer ad f9 19 91 76 08 28 59 63 b2 be 43 13 8d 68 5b d3 90 e7 93 6d 32 29 5e e8 b5 b9 cb 37 76 d6 27>,
fileEncSha256: <Buffer ab d4 0e 48 ca 4c 1e 47 86 02 50 3f 0d 87 aa 7f a7 82 ac ff eb 8d 1f ac f1 f8 6d da 36 1e ba e4>,
directPath: ''
},
participant: '',
timestamp: 1633111077
}
{
session: 'Marketing',
status: 404,
type: 'voice',
message: 'message of erro'
}
For document submission, you can use URL or the local file path
let response = await client.sendDocument("5561981590153", "https://www.orimi.com/pdf-test.pdf", "Filename Optional");
To reply to a message with document, use the id of the message you want to reply to in the last parameter, which is optional.
let response = await client.sendDocument("5561981590153", "https://www.orimi.com/pdf-test.pdf", "Filename Optional", '3EB01A690E67');
{
session: 'Marketing',
status: 200,
type: 'document',
id: '3EB07C8C333C',
to: '556181590153',
isgroup: false,
file: {
url: 'https://mmg.whatsapp.net/d/f/ArJfVUhnzdW7qcBk8-T-mzRWsfMN6k_WOS81td_xJs6E.enc',
mimetype: 'application/pdf',
filename: 'Filename Optional',
fileSha256: <Buffer f6 ed cd 8a 1b 4f 7c b8 54 86 d0 c6 77 7f 91 74 ea db c4 d1 d0 d9 e5 ae ba 71 32 f3 0b 34 bc 3e>,
fileLength: Long { low: 20597, high: 0, unsigned: true },
mediaKey: <Buffer 1b 7d 59 ce fa 4b 3f 35 14 ca 36 1b bd ba f7 c7 ed 6a f7 3d ea c1 04 b0 7c a1 6b d4 4a ab 33 40>,
fileEncSha256: <Buffer 37 db ac 7a aa f5 c2 aa 13 c6 ec 18 9f 32 d7 5b 8a b3 0d fc 50 4f 9c ea aa 2f 8c ed 20 c9 f5 b0>,
directPath: '',
thumbnail: <Buffer >
},
participant: '',
timestamp: 1633121433
}
{
session: 'Marketing',
status: 404,
type: 'document',
message: 'message of erro'
}
let response = await client.sendLocation("5561981590153", -15.8413105, -48.0270346, 'title optional', 'address optional');
To reply to a message with location, use the id of the message you want to reply to in the last parameter, which is optional.
let response = await client.sendLocation("5561981590153", -15.8413105, -48.0270346, 'title optional', 'address optional', '3EB01A690E67');
{
session: 'Marketing',
status: 200,
type: 'location',
id: '3EB01A3D9A34',
to: '556181590153',
name: 'title optional',
address: 'address optional',
url: '',
thumbnail: <Buffer >,
latitude: -15.8413105,
longitude: -48.0270346,
isgroup: false,
participant: '',
timestamp: 1633122748
}
{
session: 'Marketing',
status: 404,
type: 'location',
message: 'message of erro'
}
let response = await client.sendContact("5561981590153",'Name of Contact', '15815954040');
To reply to a message with contact, use the id of the message you want to reply to in the last parameter, which is optional.
let response = await client.sendContact("5561981590153",'Name of Contact', '15815954040', '3EB01A690E67');
{
session: 'Marketing',
status: 200,
type: 'contact',
id: '3EB00AFB1F60',
to: '556181590153',
display: 'Name of Contact',
vcard: 'BEGIN:VCARD\n' +
'VERSION:3.0\n' +
'FN:Name of Contact\n' +
'TEL;type=CELL;type=VOICE;waid=15815954040:+15815954040\n' +
'END:VCARD',
isgroup: false,
timestamp: 1633128149
}
{
session: 'Marketing',
status: 404,
type: 'contact',
message: 'message of erro'
}
let response = await client.sendLink("5561981590153", "https://music.youtube.com/watch?v=mqA5iMLsME8&feature=share", 'Description optional');
To reply to a message with link, use the id of the message you want to reply to in the last parameter, which is optional.
let response = await client.sendLink("5561981590153", "https://music.youtube.com/watch?v=mqA5iMLsME8&feature=share", 'Description optional', '3EB01A690E67');
{
session: 'Marketing',
status: 200,
type: 'link',
id: '3EB0746BE9A9',
to: '556181590153',
content: 'https://music.youtube.com/watch?v=mqA5iMLsME8&feature=share\n' +
'Description optional',
isgroup: false,
timestamp: 1633130029
}
{
session: 'Marketing',
status: 404,
type: 'link',
message: 'message of erro'
}
Attention! This function does not work if connected to a WhatsApp Business account
const sections = [
{
title: "Bovina",
rows: [
{ title: "Fraudinha", rowId: "carnes1" },
{ title: "Alcatra", rowId: "carnes2", description: "Carne boa" },
],
},
{
title: "Suina",
rows: [
{ title: "Costelinha", rowId: "carnes3" },
{
title: "Picanha Suina",
rowId: "carnes4",
description: "Carne boa",
},
],
},
];
//number of contact, name of button, sections array, title, description: optional, footer: optional
let response = await const response = await client.sendList(
"5561981590153",
"Escolha a Carne",
sections,
"Escolha 1 tipo de carne",
"", //Description opcional
"Qual o tipo de carne vai na sua refeição?"
);
To reply to a message with buttons, use the id of the message you want to reply to in the last parameter, which is optional.
//number of contact, name of button, sections array, title, description: optional, footer: optional, id message for reply
let response = await const response = await client.sendList(
"5561981590153",
"Escolha a Carne",
sections,
"Escolha 1 tipo de carne",
"", //Description opcional
"Qual o tipo de carne vai na sua refeição?",
"3EB01A690E67"
);
{
session: 'Marketing',
status: 200,
type: 'list',
id: '3EB0F92B3F1D',
to: '556181590153',
description: 'Description optional',
btnName: 'Name of Button',
sections: [ Section { rows: [Array], title: 'Name of section' } ],
isgroup: false,
timestamp: 1633143340
}
{
session: 'Marketing',
status: 404,
type: 'list',
message: 'message of erro'
}
Delete messages in chats only for you or for all
Delete message only for you
//number of chat, id of message
let response = await client.deleteMessageMe("5561981590153", "3EB071B7776A")
Delete Message to everyone on chat
//number of chat, id of message
let response = await client.deleteMessageAll("5561981590153", "3EB071B7776A")
Return with success
{
session: 'Marketing',
status: 200
type: 'delete-chat-me'
}
Return with erro
{
session: 'Marketing',
status: 404,
type: 'delete-chat-me',
message: 'message of erro'
}
Message forwarding for any contact
//number of chat, id of message, number chat for send
let response = await client.forwardMessage("5561981590153", "3EB042FA6555", "15815954040")
Return with success
{
session: 'Marketing',
status: 200,
type: 'forwarding',
subtype: 'text',
id: '3EB042FA6555',
from: '15815954040',
text: 'oi',
isgroup: false,
reply: { id: undefined },
participant: '',
timestamp: 1633147282
}
Return with erro
{
session: 'Marketing',
status: 404,
type: 'forwarding',
message: 'message of erro'
}
List All Chats of Conversations
let response = await client.getChats()
Return with success
{
session: 'Marketing',
type: 'get-chats',
chats: [
{ id: '556181590153', name: 'Joe Dutra', mute: '0', spam: 'false' },
{
id: '5511982743910-1596072761',
name: 'Venom Support',
mute: '0',
spam: 'false'
}
]
}
Return with erro
{
session: 'Marketing',
status: 404,
type: 'get-chats',
message: 'message of erro'
}
Read all messages from a chat
let response = await client.markReadAll('5561981590153')
Read message from a chat
let response = await client.markRead('5561981590153', '3EB01A690E67') // params: Number, MessageID
Return with success
{
session: 'Marketing',
status: 200,
type: "mark-read"
}
Return with erro
{
session: 'Marketing',
status: 404,
type: 'mark-read',
message: 'message of erro'
}
List All Contacts
let response = await client.getAllContacts()
Return with success
{
session: 'Marketing',
type: 'get-all-contacts',
qt: 2,
contacts: [
{
id: '552123919428',
name: 'Alenii Venom',
short: ''
},
{
id: '556181590153',
name: 'Joe Dutra',
short: ''
}
]
}
Return with erro
{
session: 'Marketing',
status: 404,
type: 'get-all-contacts',
message: 'message of erro'
}
List All Contacts Blocking
let response = await client.getBlockList()
Return with success
{
session: 'Marketing',
type: 'get-block-list',
list: [ '5561986268199', '5561998745252' ]
}
Return with erro
{
session: 'Marketing',
status: 404,
type: 'get-block-list',
message: 'message of erro'
}
Silence or remove the silence of a particular chat for a specific period
Mute
//number of chat, timer: ['hour', 'week', 'ever']
let response = await client.muteChat("5561981590153", "hour")
Unmute
//number of chat
let response = await client.unmuteChat("5561981590153")
Return with success
{
session: 'Marketing',
status: 200,
type: 'mute-chat',
}
Return with erro
{
session: 'Marketing',
status: 404,
type: 'mute-chat',
message: 'message of erro'
}
Archive or unarchive a specific chat
Archive
//number of chat, true
let response = await client.archiveChat("5561981590153", true)
Unarchive
//number of chat, false
let response = await client.archiveChat("5561981590153", false)
Return with success
{
session: 'Marketing',
status: 200,
type: 'archive-chat',
}
Return with erro
{
session: 'Marketing',
status: 404,
type: 'archive-chat',
message: 'message of erro'
}
Delete a specific chat or group
Archive
//number of chat or group
let response = await client.deleteChat("5561981590153")
Return with success
{
session: 'Marketing',
status: 200,
type: 'delete-chat',
}
Return with erro
{
session: 'Marketing',
status: 404,
type: 'delete-chat',
message: 'message of erro'
}
Pin or unpin a specific chat or group
Pin
//number of chat, true
let response = await client.pinChat("5561981590153", true)
Unpin
//number of chat, false
let response = await client.pinChat("5561981590153", false)
Return with success
{
session: 'Marketing',
status: 200,
type: 'pin-chat',
}
Return with erro
{
session: 'Marketing',
status: 404,
type: 'pin-chat',
message: 'message of erro'
}
Blocking or unblocking a specific contact
Block
//number of chat
let response = await client.blockContact("5561981590153")
Unblock
//number of chat
let response = await client.unblockContact("5561981590153")
Return with success
{
session: 'Marketing',
status: 200,
type: 'block-contact',
}
Return with erro
{
session: 'Marketing',
status: 404,
type: 'block-contact',
message: 'message of erro'
}
Displays the text of the status of a specific contact
//number of chat
let response = await client.getProfileStatus("5561981590153")
Return with success
{
session: 'Marketing',
type: 'get-profile-status',
status: 'Que Deus seja sempre louvado em nossas vidas'
}
Return with erro
{
session: 'Marketing',
status: 404,
type: 'get-profile-status',
message: 'message of erro'
}
Displays the image of a specific contact
//number of chat
let response = await client.getPicture("5561981590153")
Return with success
{
session: 'Marketing',
status: 200,
type: 'get-picture',
picture: 'https://pps.whatsapp.net/v/t61.24694-24/166060433_390988636021500_3494454124066997603_n.jpg?ccb=11-4&oh=453e672ddc35e64ca123439f7a89d7d2&oe=615EAAAF'
}
Return with erro
{
session: 'Marketing',
status: 404,
type: 'get-picture',
message: 'message of erro'
}
Set image for profile or group
//number of chat, file local path
let response = await client.setPicture("5561981590153", "./image-profile.png")
Return with success
{
session: 'Marketing',
status: 200,
type: 'set-picture'
}
Return with erro
{
session: 'Marketing',
status: 404,
type: 'set-picture',
message: 'message of erro'
}
Checks if a number exists in the WhastApp
//number of chat
let response = await client.getNumberProfile("5561981590153")
Return with success
{
session: 'Marketing',
type: 'get-number-profile',
id: '556181590153',
isBusiness: false,
exist: true
}
Return with erro
{
session: 'Marketing',
status: 404,
type: 'get-number-profile',
message: 'message of erro'
}
We created the easiest way to create groups with Superchats
Create a group with participants
//name of group, array with number of contacts
let response = await client.createGroup("Name Group", ["556181590153", "5561981819855"])
Return with success
{
session: 'Marketing',
status: 200,
type: 'create-group',
groupId: "15815954040-1631239154"
}
Return with erro
{
session: 'Marketing',
status: 404,
type: 'create-group',
message: 'message of erro'
}
Add participants in group
//id of group, array with number of contacts
let response = await client.addParticipantsGroup("15815954040-1631239154", ["556181590153", "5561981819855"])
Return with success
{
session: 'Marketing',
status: 200,
type: 'add-participants-group',
}
Return with erro
{
session: 'Marketing',
status: 404,
type: 'add-participants-group',
message: 'message of erro'
}
Add or Remove participants of group as admin
//id of group, array with number of contacts
let response = await client.addGroupAdmins("15815954040-1631239154", ["556181590153", "5561981819855"])
//id of group, array with number of contacts
let response = await client.removeGroupAdmins("15815954040-1631239154", ["556181590153", "5561981819855"])
Return with success
{
session: 'Marketing',
status: 200,
type: 'add-group-admins',
}
Return with erro
{
session: 'Marketing',
status: 404,
type: 'add-group-admins',
message: 'message of erro'
}
Change name of group
//id of group, name group
let response = await client.groupTitle("15815954040-1631239154", "new name of group")
Return with success
{
session: 'Marketing',
status: 200,
type: 'group-title',
}
Return with erro
{
session: 'Marketing',
status: 404,
type: 'group-title',
message: 'message of erro'
}
Change description of group
//id of group, name group
let response = await client.groupDescription("15815954040-1631239154", "description of group")
Return with success
{
session: 'Marketing',
status: 200,
type: 'group-description',
}
Return with erro
{
session: 'Marketing',
status: 404,
type: 'group-description',
message: 'message of erro'
}
Join a group specified
//id of group
let response = await client.joinGroup("15815954040-1631239154")
Return with success
{
session: 'Marketing',
status: 200,
type: 'join-group',
}
Return with erro
{
session: 'Marketing',
status: 404,
type: 'join-group',
message: 'message of erro'
}
Leaves a group specified
//id of group
let response = await client.leaveGroup("15815954040-1631239154")
Return with success
{
session: 'Marketing',
status: 200,
type: 'leave-group',
}
Return with erro
{
session: 'Marketing',
status: 404,
type: 'leave-group',
message: 'message of erro'
}
Revoke link from a specified group
//id of group
let response = await client.revokeGroupLink("15815954040-1631239154")
Return with success
{
session: 'Marketing',
status: 200,
type: 'revoke-group-link',
linkGroup: 'G3M81fQbuwDB2cuAdPIv0h'
}
Return with erro
{
session: 'Marketing',
status: 404,
type: 'revoke-group-link',
message: 'message of erro'
}
Get info from a specified group
//id of group
let response = await client.infoGroup("15815954040-1631239154")
Return with success
{
session: 'Marketing',
type: 'info-group',
status: 200,
id: '15795662985-1631581942',
owner: '[email protected]',
title: 'Teste Grupo Live',
create: 1631581942,
participants: [
{
id: '556181590153',
name: 'Joe Dutra',
short: 'Joe',
isAdmin: false,
isSuperAdmin: false
},
{
id: '5521991977392',
name: 'Israel - Fabrica de Sonhos',
short: 'Israel - Fabrica',
isAdmin: false,
isSuperAdmin: false
}
]
}
Return with erro
{
session: 'Marketing',
status: 404,
type: 'info-group',
message: 'message of erro'
}
Get info from a specified group
Set sending messages in group only for admins
//id of group, type, boolean
let response = await client.setGroupSettings("15815954040-1631239154", "message", true)
Set change settings in group only for admins
//id of group, type, boolean
let response = await client.setGroupSettings("15815954040-1631239154", "settings", true)
Return with success
{
session: 'Marketing',
status: 200,
type: 'set-group-settings',
}
Return with erro
{
session: 'Marketing',
status: 404,
type: 'set-group-settings',
message: 'message of erro'
}
Get all groups list
let response = await client.getGroups()
Return with success
{
session: 'Marketing',
status: 200,
type: 'get-groups',
chats: [
{ id: '5511982743910-1596072761', name: 'Venom Support' },
{ id: '556181590153-1625838636', name: 'Venom Business' }
]
}
Return with erro
{
session: 'Marketing',
status: 404,
type: 'get-groups',
message: 'message of erro'
}
Get info of device
let response = await client.getHostDevice()
Return with success
{
session: 'Marketing',
status: 200,
type: 'get-host-device',
phone: '556181590153',
image: "https://pps.whatsapp.net/v/t61.24694-24/254827313_500572874791871_6168181924916411415_n.jpg?stp=dst-jpg_s96x96&ccb=11-4&oh=5ee43eb4f1fe109b10ceba05292561aa&oe=622FF53D",
pushName: 'Joe Dutra'
}
Return with erro
{
session: 'Marketing',
status: 404,
type: 'get-host-device',
message: 'message of erro'
}
Know the types of functions to recover chat messages
Take the last 10 messages from a chat
//number of chat, Number
let response = await client.getChatMessages('556181590153', 10)
Take all messages from a chat
//number of chat
let response = await client.getChatAllMessages('556181590153')
Take all unread messages from all chats
let response = await client.getAllUnreadMessages()
Return with success
{
session: 'Marketing',
type: 'get-chat-messages',
messages: [
{
session: 'Marketing',
type: 'reply',
subtype: 'text',
id: '3EB082EFA70F',
from: '556181590153',
text: 'Oi',
isgroup: false,
reply: [Object],
participant: '',
timestamp: 1633407729
},
{
session: 'Marketing',
type: 'text',
id: '3EB0D91B1ECF',
from: '556181590153',
content: 'Oi',
isgroup: false,
participant: '',
timestamp: 1633408611
},
{
session: 'Marketing',
type: 'text',
id: '3EB0AD7A246F',
from: '556181590153',
content: 'Testando',
isgroup: false,
participant: '',
timestamp: 1633411173
},
{
session: 'Marketing',
type: 'text',
id: '46110924F9C202D3933AA4CBC2F209A3',
from: '556181590153',
content: 'Oi',
isgroup: false,
participant: '',
timestamp: 1633411357
},
{
session: 'Marketing',
type: 'text',
id: '3EB0EE5900AF',
from: '556181590153',
content: 'Testando',
isgroup: false,
participant: '',
timestamp: 1633411382
},
{
session: 'Marketing',
type: 'text',
id: '96033721D4426073C37802F407251F9A',
from: '556181590153',
content: 'Oi',
isgroup: false,
participant: '',
timestamp: 1633411396
},
{
session: 'Marketing',
type: 'text',
id: '3EB067D84A06',
from: '556181590153',
content: 'Testando',
isgroup: false,
participant: '',
timestamp: 1633411746
},
{
session: 'Marketing',
type: 'text',
id: '2CDF9BAF7E20E72BC74D602A339DA2C2',
from: '556181590153',
content: 'Oiiii',
isgroup: false,
participant: '',
timestamp: 1633411781
},
{
session: 'Marketing',
type: 'text',
id: '4DEBB46473A8E642E8764F6C70567089',
from: '556181590153',
content: 'Como vai???',
isgroup: false,
participant: '',
timestamp: 1633411792
},
{
session: 'Marketing',
type: 'text',
id: 'B536EAE6275FD6FF98F3E3326FE1682F',
from: '556181590153',
content: 'Top',
isgroup: false,
participant: '',
timestamp: 1633411811
}
]
}
Return with erro
{
session: 'Marketing',
status: 404,
type: 'get-chat-messages',
message: 'message of erro'
}
Update your presence for a certain contact
Types of state: a = available, c = composing, r = recording, p = paused
//chat number, state: a, c, r, p
let response = await client.setPresence('556181590153', 'c');
Return with success
{
session: 'Marketing',
status: 200,
type: 'set-presence'
}
Return with erro
{
session: 'Marketing',
status: 404,
type: 'set-presence',
message: 'message of erro'
}
Follow each event at the time that happen
Receive an event all the time you receive a message from some contact
//event:any
const client = await superchats.create({
session: "Marketing",
license: "asjdh-efddff734-sdsdf834-233272",
multidevice: true, // (default is false) for used whatsapp beta
onMessage: (event) => {
console.log(event)
})
Return of event onMessage
{
session: 'Marketing',
type: 'text',
id: '3EB07A5B9979E8CB453A',
from: '556181590153',
content: 'oiii',
isgroup: false,
participant: '',
timestamp: 1633414066
}
Receive an event every time you send a message to some contact with the States of: failed, pending, sent, received or read
//event:any
const client = await superchats.create({
session: "Marketing",
license: "asjdh-efddff734-sdsdf834-233272",
multidevice: true, // (default is false) for used whatsapp beta
onAck: (event) => {
console.log(event)
})
Return of event onAck
{
session: 'Marketing',
status: 'RECEIVED',
type: 'text',
id: '3EB02BC6217B',
to: '556181590153',
text: 'Hii',
isgroup: false,
timestamp: 1633414317
}
Receive an event every time a contact is: typing, recording, online or offline with you
Types of state: **available**, **composing**, **recording** and **paused**
//event:any
const client = await superchats.create({
session: "Marketing",
license: "asjdh-efddff734-sdsdf834-233272",
multidevice: true, // (default is false) for used whatsapp beta
onPresence: (event) => {
console.log(event)
})
Return of event onPresence
{
session: 'Marketing',
from: '556181590153',
status: 'composing',
pushname: 'Joe Dutra'
}
Receive events all time the name of a group, configurations are changed
Types of return: **change-name**, **change-messages-admin**, **change-settings-admin** and **paused**
//event:any
const client = await superchats.create({
session: "Marketing",
license: "asjdh-efddff734-sdsdf834-233272",
multidevice: true, // (default is false) for used whatsapp beta
onGroups: (event) => {
console.log(event)
})
Return of event onGroup
{
session: 'Marketing',
action: 'change-name',
changed: [ 'Grupo Live', 'Teste Grupo Live' ],
group: 'Grupo Live',
from: '15795662985-1631581942',
participant: '15795662985',
participants: 3
}
{
session: 'Marketing',
action: 'change-messages-admin',
changed: 'active',
group: 'Grupo Live',
from: '15795662985-1631581942',
participant: '15795662985',
participants: 3
}
{
session: 'Marketing',
action: 'change-settings-admin',
changed: 'active',
group: 'Grupo Live',
from: '15795662985-1631581942',
participant: '15795662985',
participants: 3
}
Receive events about group participants
Types of action: add, remove, promote and demote
//event:any
const client = await superchats.create({
session: "Marketing",
license: "asjdh-efddff734-sdsdf834-233272",
multidevice: true, // (default is false) for used whatsapp beta
onParticipants: (event) => {
console.log(event)
})
Return of event onParticipants
{
session: 'Marketing',
group: 'Grupo Live',
from: '15795662985-1631581942',
participant: '5521991977392',
action: 'add',
participants: 3
}
{
session: 'Marketing',
group: 'Grupo Live',
from: '15795662985-1631581942',
participant: '5521991977392',
action: 'remove',
participants: 2
}
{
session: 'Marketing',
group: 'Grupo Live',
from: '15795662985-1631581942',
participant: '5521991977392',
action: 'promote',
participants: 3
}
{
session: 'Marketing',
group: 'Grupo Live',
from: '15795662985-1631581942',
participant: '5521991977392',
action: 'demote',
participants: 3
}
Receive events every time a message is deleted
//event:any
const client = await superchats.create({
session: "Marketing",
license: "asjdh-efddff734-sdsdf834-233272",
multidevice: true, // (default is false) for used whatsapp beta
onDelete: (event) => {
console.log(event)
})
Return of event onDelete
{
session: 'Marketing',
type: 'message-delete',
from: '15795662985-1631581942',
id: '3EB07E88FDCF1C4EF887',
timestamp: 1633453902
}