Notification SettingsUSER-ONLY
User clients can control notifications for individual chats.
Getting Notification Settings
Use getNotificationSettings to get a chat’s NotificationSettings.
const settings = await client.getNotificationSettings(chatId);
console.log(settings.isSilent, settings.muteUntil);
Muting a Chat
Use setNotificationSettings with a Unix timestamp in seconds.
const muteUntil = Math.floor(Date.now() / 1_000) + 60 * 60;
await client.setNotificationSettings(chatId, {
settings: { muteUntil },
});
Set muteUntil to 0 to unmute the chat.
Changing Other Settings
Use InputNotificationSettings to change options such as notification previews, sounds, and story notifications.
await client.setNotificationSettings(chatId, {
settings: {
showsPreviews: false,
isSilent: true,
},
});
Resetting Notification Settings
Use resetNotificationSettings to reset all notification settings.
await client.resetNotificationSettings();