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)
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ção | Segundos |
|---|
| 24 horas | 86400 |
| 7 dias | 604800 |
| 30 dias | 2592000 |
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.
Pré-visualização de links
await sock.sendMessage(
jid,
{
text: 'Hi, this was sent using https://github.com/whiskeysockets/baileys'
}
)
Mensagens que desaparecem
| Duração | Segundos |
|---|
| Remover | 0 |
| 24 horas | 86400 |
| 7 dias | 604800 |
| 90 dias | 7776000 |
Habilitar mensagens que desaparecem na conversa
await sock.sendMessage(
jid,
{ disappearingMessagesInChat: WA_DEFAULT_EPHEMERAL }
)
Enviar uma única mensagem efêmera
await sock.sendMessage(jid, { text: 'hello' }, { ephemeralExpiration: WA_DEFAULT_EPHEMERAL })
Desabilitar mensagens que desaparecem na conversa
await sock.sendMessage(
jid,
{ disappearingMessagesInChat: false }
)