// You need the original message objectconst originalMessage: WAMessage = /* get from store or messages.upsert event */await sock.sendMessage( jid, { text: 'This is a reply' }, { quoted: originalMessage })
The quoted parameter is passed in the options object (third parameter), not in the content object.
Messages can be obtained from the messages.upsert event:
sock.ev.on('messages.upsert', async ({ messages }) => { for (const msg of messages) { // Store this message for later quoting await saveMessage(msg) // Your implementation // Reply to this specific message await sock.sendMessage( msg.key.remoteJid!, { text: 'Got your message!' }, { quoted: msg } ) }})
Text messages are sent as extendedTextMessage in the protocol:
type WATextMessage = { text: string matchedText?: string // For link preview description?: string // Link preview description title?: string // Link preview title jpegThumbnail?: Buffer // Link preview thumbnail contextInfo?: ContextInfo // For mentions, quotes, etc.}
WhatsApp Web does not natively support markdown-style formatting (bold, italic, etc.) through the protocol. What you see in the WhatsApp mobile app is handled client-side.
While you can send special formatting characters, the rendering is client-dependent:
// These may or may not render as formatted depending on the clientawait sock.sendMessage(jid, { text: '*bold* _italic_ ~strikethrough~ ```monospace```'})