You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|`senderLid`|`string \| null`| The sender's LID (linked-device identifier), if known. Keeps the raw LID even after `senderId` is resolved to PN. |
299
299
|`senderName`|`string \| null`| The sender's WhatsApp push name. |
300
300
|`senderUsername`|`string \| null`| The sender's WhatsApp username (`@handle`), without the `@`. `null` unless WhatsApp sends one — mostly group messages from LID-only senders. |
301
-
|`isOffline`|`boolean`|`true` for a backlog message replayed after a reconnect. Guard on this so the bot does not answer old messages twice. |
301
+
|`isOld`|`boolean`|`true` for a backlog message replayed after a reconnect. Guard on this so the bot does not answer old messages twice. |
302
302
|`forwardCount`|`number`| Forward hops. `>= 5` is WhatsApp's "forwarded many times". |
303
303
|`ephemeralDuration`|`number \| null`| The chat's disappearing timer in seconds. |
304
304
|`addressingMode`|`'pn' \| 'lid'`| How WhatsApp addressed the message. |
Copy file name to clipboardExpand all lines: docs/content/message-payload.mdx
+8-8Lines changed: 8 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -58,14 +58,8 @@ So plain fields are cheap to read; the function fields do real work (network/asy
58
58
|`senderLid`|`string \| null`|`key.participantAlt` / `remoteJidAlt` ending in `@lid`| The sender's LID, when WhatsApp exposes one. `null` if not available. |
59
59
|`senderName`|`string \| null`|`message.pushName`| Display/push name. Can be `null` or spoofed — don't use for authz. |
60
60
|`senderUsername`|`string \| null`|`key.participantUsername` / `remoteJidUsername`| The sender's WhatsApp username (the `@handle`), without the `@`. `null` unless WhatsApp sends one — see the note below. |
61
-
|`isOffline`|`boolean`|`messages.upsert` type `append`|**`true` for a backlog message replayed after a reconnect.** Skip these so your bot doesn't answer hours-old messages twice. |
62
-
|`forwardCount`|`number`|`contextInfo.forwardingScore`| How many hops the message has been forwarded. `0` = not forwarded, `>= 5` = WhatsApp's "forwarded many times". |
63
-
|`ephemeralDuration`|`number \| null`|`contextInfo.expiration`| The chat's disappearing timer **in seconds**, or `null` when messages are kept. |
64
-
|`addressingMode`|`'pn' \| 'lid'`|`key.addressingMode`| Whether WhatsApp addressed this message by phone number or by LID. Useful when debugging identity resolution. |
65
-
|`mentionedGroups`|`string[]`|`contextInfo.groupMentions`| JIDs of groups tagged in the message (community `@group` mentions). |
66
-
|`ad`|`AdAttribution \| undefined`|`contextInfo.externalAdReply`| Present **only** on the first message of a chat opened from a Meta ad. |
67
-
|`business`|`BusinessInfo \| undefined`|`verifiedBizName`| Present **only** when the sender is a verified WhatsApp Business account. |
68
61
|`senderDevice`|`SenderDevice`| Parsed from the sender's device jid | Which client app sent it: `android` · `ios` · `web` · `desktop` · `unknown`. |
62
+
|`addressingMode`|`'pn' \| 'lid'`|`key.addressingMode`| Whether WhatsApp addressed this message by phone number or by LID. Useful when debugging identity resolution. |
69
63
|`isFromMe`|`boolean`|`key.fromMe === true`|`true` if your own account sent it (echo of your sends, other-device activity). |
70
64
|`isGroup`|`boolean`|`remoteJid` is a group jid | Branch group vs DM logic. |
71
65
|`isNewsletter`|`boolean`|`remoteJid` ends `@newsletter`| Message came from a channel/newsletter. |
@@ -82,7 +76,12 @@ So plain fields are cheap to read; the function fields do real work (network/asy
82
76
|`text`|`string`| body / caption / poll name / location label, after unwrapping | The textual content. Empty string if none. Caption text for media is mirrored here too. |
83
77
|`timestamp`|`number`|`messageTimestamp`, converted **seconds → milliseconds**| Unix **ms** epoch. Feed straight into `new Date(ctx.timestamp)`. `0` if invalid. |
84
78
|`mentions`|`string[]`|`contextInfo.mentionedJid`, mapped to PN | Jids tagged in the message. |
79
+
|`mentionedGroups`|`string[]`|`contextInfo.groupMentions`| Groups tagged in the message (community `@group` mentions). |
85
80
|`links`|`string[]`| Regex over `text`| URLs found in the text (trailing punctuation trimmed). |
81
+
|`forwardCount`|`number`|`contextInfo.forwardingScore`| How many hops the message has been forwarded. `0` = not forwarded, `>= 5` = WhatsApp's "forwarded many times". |
82
+
|`ephemeralDuration`|`number \| null`|`contextInfo.expiration`| The chat's disappearing timer **in seconds**, or `null` when messages are kept. |
83
+
|`ad`|`AdAttribution \| undefined`|`contextInfo.externalAdReply`| Present **only** on the first message of a chat opened from a Meta ad. See [`ad`](#ad--where-a-lead-came-from). |
84
+
|`business`|`BusinessInfo \| undefined`|`verifiedBizName`| Present **only** when the sender is a verified WhatsApp Business account. |
86
85
87
86
---
88
87
@@ -95,6 +94,7 @@ All computed from the message **except `isSpam`** (reserved, always `false` for
95
94
|`isViewOnce`| view-once wrapper present, or media marked `viewOnce`. |
|`isForwarded`| marked forwarded, or `forwardingScore > 0`. |
97
+
|`isOld`| the message is **backlog** — it arrived while your bot was disconnected and WhatsApp replayed it on reconnect. Guard on this so you don't answer hours-old messages. |
98
98
|`isQuestion`| trimmed `text` ends with `?`. |
99
99
|`isPrefix`|`text` starts with one of your configured command **prefixes**. |
100
100
|`isTagMe`| your jid is in `mentions` (you were @-tagged). |
@@ -299,7 +299,7 @@ A few values come from your `Client` config rather than the raw message:
299
299
-**`roomId` follows the conversation, not the direction** — safe as a reply target for both inbound and your own (`isFromMe`) messages.
300
300
-**`isSpam` is reserved** and always `false` today. Use `forwardCount >= 5` for chain-message detection.
301
301
-**Answer only live messages.** After a reconnect WhatsApp replays everything you missed. Guard with
302
-
`if (ctx.isOffline) return` unless you deliberately want to process the backlog.
302
+
`if (ctx.isOld) return` unless you deliberately want to process the backlog.
303
303
-**Mirror the disappearing timer on replies.**`ctx.reply()` does not inherit it — pass
304
304
`ctx.ephemeralDuration` to `.disappearing()` yourself, or your answer outlives the thread it belongs to.
305
305
-**`senderUsername` is usually `null` — WhatsApp sends the phone number _or_ the username, never
0 commit comments