Pular para o conteúdo principal

Documentation Index

Fetch the complete documentation index at: https://whiskeysockets-docs-jids-socket-config-ptbr.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

Toda mensagem no Baileys passa por um único método: sock.sendMessage(jid, content, options?).
sock.sendMessage(jid, content, options)
Veja a lista completa de tipos no type alias AnyMessageContent e todas as opções em MiscMessageGenerationOptions.

Mensagens não-mídia

Mensagem de texto

await sock.sendMessage(jid, { text: 'hello word' })

Citação / resposta

await sock.sendMessage(jid, { text: 'hello word' }, { quoted: message })

Mencionar um usuário

await sock.sendMessage(
    jid,
    {
        text: '@12345678901',
        mentions: ['12345678901@s.whatsapp.net']
    }
)

Encaminhar uma mensagem

const msg = getMessageFromStore()
await sock.sendMessage(jid, { forward: msg })

Localização

await sock.sendMessage(
    jid,
    {
        location: {
            degreesLatitude: 24.121231,
            degreesLongitude: 55.1121221
        }
    }
)

Contato (vCard)

const vcard = 'BEGIN:VCARD\n'
            + 'VERSION:3.0\n'
            + 'FN:Jeff Singh\n'
            + 'ORG:Ashoka Uni;\n'
            + 'TEL;type=CELL;type=VOICE;waid=911234567890:+91 12345 67890\n'
            + 'END:VCARD'

await sock.sendMessage(
    id,
    {
        contacts: {
            displayName: 'Jeff',
            contacts: [{ vcard }]
        }
    }
)

Reação

await sock.sendMessage(
    jid,
    {
        react: {
            text: '💖',
            key: message.key
        }
    }
)

Fixar mensagem

DuraçãoSegundos
24 horas86400
7 dias604800
30 dias2592000
await sock.sendMessage(
    jid,
    {
        pin: {
            type: 1,
            time: 86400,
            key: message.key
        }
    }
)

Enquete

await sock.sendMessage(
    jid,
    {
        poll: {
            name: 'My Poll',
            values: ['Option 1', 'Option 2'],
            selectableCount: 1,
            toAnnouncementGroup: false
        }
    }
)
Votos são cifrados. Para lê-los, escute messages.update e use getAggregateVotesInPollMessage.
yarn add link-preview-js
await sock.sendMessage(
    jid,
    {
        text: 'Hi, this was sent using https://github.com/whiskeysockets/baileys'
    }
)

Mensagens que desaparecem

DuraçãoSegundos
Remover0
24 horas86400
7 dias604800
90 dias7776000
1

Habilitar mensagens que desaparecem na conversa

await sock.sendMessage(
    jid,
    { disappearingMessagesInChat: WA_DEFAULT_EPHEMERAL }
)
2

Enviar uma única mensagem efêmera

await sock.sendMessage(jid, { text: 'hello' }, { ephemeralExpiration: WA_DEFAULT_EPHEMERAL })
3

Desabilitar mensagens que desaparecem na conversa

await sock.sendMessage(
    jid,
    { disappearingMessagesInChat: false }
)