Skip to main content

Handling Messages

Messages, from a history sync or from a messages.upsert event, come in the form of proto.IWebMessageInfo. This is the protobuf that WhatsApp Web stores its messages in.

The message data specifically is in the format proto.IMessage. You can send messages in this format using the sock.relayMessage function.

Text Messages

Text based messages come in the form of proto.IMessage.conversation and proto.IMessage.extendedTextMessage. If the message comes in with reply data or attached metadata (link preview, group invite), then it is usually extendedTextMessage. Status updates are also only extendedTextMessage as it contains the fields for the color/font of the text-based status updates.

Media Messages

Media messages come in the following protobuf messages: proto.IMessage.audioMessage, proto.IMessage.documentMessage, proto.IMessage.imageMessage, video, sticker .. so on

That being said, let's look at some common types handle different message types /// sock.updateMediaMessage

point to gloss on -> Handling protos

some internal documentation -> Proto systems or things like that & Contribution guidelines