Skip to content

Funções de Mensagem

Editar Mensagem

Edite mensagens enviadas em chats

javascript
const options = {
  msgId: "3EB01A690E67", // id da mensagem
  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
}` // retorne a mensagem que você deseja responder no lugar do parâmetro reply
};
// número do chat, texto, opções
let response = await client.editMessage("5561981590153", 'novo texto', options)

Deletar Mensagem

Exclua mensagens em bate-papos apenas para você ou para todos

Excluir mensagem apenas para você

javascript
// número do chat, id da mensagem
let response = await client.deleteMessageMe("5561981590153", "3EB071B7776A")

Excluir mensagem para todos no chat

javascript
// número do chat, id da mensagem
let response = await client.deleteMessageAll("5561981590153", "3EB071B7776A")

Retorno de Sucesso

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

Retorno de Erro

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

Encaminhar Mensagem

Encaminhamento de mensagens para qualquer contato

javascript
const options = {
  msgId: "3EB01A690E67", // id da mensagem
  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
}` // retorne a mensagem que você deseja responder no lugar do parâmetro reply
};
// Número do chat, opções
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'
}

Mensagens Temporarias

Seta as proximas mensagens do chat como temporarias que desapareceram segundo o valor passado de tempo

javascript
// Número do chat, tempo (0 = desativa, 24 = 24 horas, 7 = 7 dias, 90 = 90 dias)
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'
}

Fuções de Mensagens de um Chat

Conheça os tipos de funções para recuperar mensagens de chat

Buscar Mensagem pelo ID

javascript
// Número do Chat, id da mensagem
let response = await client.getMessageById('556181590153', '3EB042FA6555');

Listar Mensagens por Quantidade

javascript
// Número do Chat, Quantidade
let response = await client.getChatMessages('556181590153', 10)

Listar Todas as Mensagens

javascript
// Número do Chat
let response = await client.getChatAllMessages('556181590153')

All rights reserved to Orkestral LLC