Overview
Disappearing messages automatically delete after a set period. You can enable this feature for entire chats or send individual messages that disappear.Ephemeral Durations
Supported time periods for disappearing messages:You need to pass in seconds, not milliseconds. The default is 7 days.
WA_DEFAULT_EPHEMERAL Constant
Baileys provides a constant for the default 7-day duration:src/Defaults/index.ts:23:
Enable Disappearing Messages in a Chat
Turn on disappearing messages for all future messages in a chat:Custom Duration
Disable Disappearing Messages
Turn off disappearing messages in a chat:This only affects future messages. Previously sent disappearing messages will still delete at their scheduled time.
Send Individual Disappearing Messages
Send a single message that will disappear without enabling the feature for the entire chat:Custom Expiration
Complete Example
Update Default Disappearing Mode
Set a default disappearing message duration for all new chats:Implementation Details
Fromsrc/Utils/messages.ts:465 and src/Utils/messages.ts:717: