Skip to content

Message Functions

Edit Message

Edit messages sent in chats

javascript
const options = {
  msgId: "3EB01A690E67", // id message
  content: `{
    "session": "1",
    "device": "556183602797",
    "status": 200,
    "type": "text",
    "isMedia": false,
    "fromMe": true,
    "id": "KIZAKIXDF88539C9CD2F",
    "remoteJid": "5513997939260@s.whatsapp.net",
    "to": "5513997939260",
    "content": {
        "extendedTextMessage": {
            "text": "Teste https://orkestral.io",
            "matchedText": "https://orkestral.io",
            "canonicalUrl": "https://orkestral.io/",
            "description": "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\nSuperchats is a premium version of Venom, with exclusive features and support for companies and developers worldwide",
            "title": "SuperChats - premium library that control Whatsapp",
            "previewType": "NONE",
            "jpegThumbnail": "",
            "thumbnailDirectPath": "/o1/v/t62.7118-24/f1/m238/up-oil-image-de11320c-4536-477c-b138-c193b3b728ac?ccb=9-4&oh=01_Q5AaICbt0Kmc8dAEoxRlDivYt-u03tsgj1ncPtpF6wvIjrZv&oe=6701BBB1&_nc_sid=000000",
            "thumbnailSha256": "UqQDp7+E/OtwcFvoO5dxSKq4DxROBIjM21Xa55lQBnY=",
            "thumbnailEncSha256": "n92VMsO9yjp9jn9VIc3x/R0a7twSJmO40SBY4cEKKck=",
            "mediaKey": "E3wDc4jAc1VU/bhtb+blClKC+kuueRPa3v5dx74u5QY=",
            "mediaKeyTimestamp": "1725588896",
            "thumbnailHeight": 0,
            "thumbnailWidth": 0
        }
    },
    "isgroup": false,
    "timestamp": 1725588896
}` // return the message you want to reply no lugar do reply param
};

// chatId, text, options
let response = await client.editMessage("5561981590153", 'new text', options)

Delete Message

Delete messages in chats for just you or everyone

Delete message just for you

javascript
// chatId, msgId
let response = await client.deleteMessageMe("5561981590153", "3EB071B7776A")

Delete message for everyone in chat

javascript
// chatId, msgId
let response = await client.deleteMessageAll("5561981590153", "3EB071B7776A")

Successful return

javascript
{ 
 session: 'Marketing',
  device: "551152204957",
 status: 200 
 type: 'delete-chat-me'
}

Error return

javascript
{
  session: 'Marketing',
  device: "551152204957",
  status: 404,
  type: 'delete-chat-me',
  message: 'message of erro'
}

Forward Message

Forward messages to any contact

javascript
const options = {
  msgId: "3EB01A690E67", // id message
  content: `{
    "session": "1",
    "device": "556183602797",
    "status": 200,
    "type": "text",
    "isMedia": false,
    "fromMe": true,
    "id": "KIZAKIXDF88539C9CD2F",
    "remoteJid": "5513997939260@s.whatsapp.net",
    "to": "5513997939260",
    "content": {
        "extendedTextMessage": {
            "text": "Teste https://orkestral.io",
            "matchedText": "https://orkestral.io",
            "canonicalUrl": "https://orkestral.io/",
            "description": "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\nSuperchats is a premium version of Venom, with exclusive features and support for companies and developers worldwide",
            "title": "SuperChats - premium library that control Whatsapp",
            "previewType": "NONE",
            "jpegThumbnail": "",
            "thumbnailDirectPath": "/o1/v/t62.7118-24/f1/m238/up-oil-image-de11320c-4536-477c-b138-c193b3b728ac?ccb=9-4&oh=01_Q5AaICbt0Kmc8dAEoxRlDivYt-u03tsgj1ncPtpF6wvIjrZv&oe=6701BBB1&_nc_sid=000000",
            "thumbnailSha256": "UqQDp7+E/OtwcFvoO5dxSKq4DxROBIjM21Xa55lQBnY=",
            "thumbnailEncSha256": "n92VMsO9yjp9jn9VIc3x/R0a7twSJmO40SBY4cEKKck=",
            "mediaKey": "E3wDc4jAc1VU/bhtb+blClKC+kuueRPa3v5dx74u5QY=",
            "mediaKeyTimestamp": "1725588896",
            "thumbnailHeight": 0,
            "thumbnailWidth": 0
        }
    },
    "isgroup": false,
    "timestamp": 1725588896
}` // return the message you want to reply no lugar do reply param
};

// chatId, options
let response = await client.forwardMessage("5561981590153", options)

Return with success

javascript
{
  session: 'Marketing',
  device: "551152204957",
  status: 200,
  type: 'forwarding',
  subtype: 'text',
  id: '3EB042FA6555',
  from: '15815954040',
  text: 'oi',
  isgroup: false,
  reply: { id: undefined },
  participant: '',
  timestamp: 1633147282
}

Return with erro

javascript
{
  session: 'Marketing',
  device: "551152204957",
  status: 404,
  type: 'forwarding',
  message: 'message of erro'
}

Temporary Messages

Sets the next chat messages as temporary ones that have disappeared according to the past value of time

javascript
// chatOd, time (0 = desactive, 24 = 24 hour, 7 = 7 days, 90 = 90 days)
let response = await client.messageTemporary("5561981590153", "24");

Return with success

javascript
{
  session: 'Marketing',
  device: "551152204957",
  status: 200,
  type: 'message-temporary',
}

Return with erro

javascript
{
  session: 'Marketing',
  device: "551152204957",
  status: 404,
  type: 'message-temporary',
  message: 'message of erro'
}

Chat Messaging Functions

Learn about the types of functions to retrieve chat messages

Search Message by ID

javascript
// chatId, msgId
let response = await client.getMessageById('556181590153', '3EB042FA6555');

List Messages by Quantity

javascript
// chatId, Qt
let response = await client.getChatMessages('556181590153', 10)

List All Messages

javascript
// chatId
let response = await client.getChatAllMessages('556181590153')

All rights reserved to Orkestral LLC