new PrivateChat()

Extends
Chat

Properties

archived  unknown

Indicates if the Chat is archived

Inherited from
Chat#archived

id  unknown

ID that represents the chat

Inherited from
Chat#id

isGroup  unknown

Indicates if the Chat is a Group Chat

Inherited from
Chat#isGroup

isMuted  unknown

Indicates if the chat is muted or not

Inherited from
Chat#isMuted

isReadOnly  unknown

Indicates if the Chat is readonly

Inherited from
Chat#isReadOnly

lastMessage  unknown

Last message fo chat

Inherited from
Chat#lastMessage

muteExpiration  unknown

Unix timestamp for when the mute expires

Inherited from
Chat#muteExpiration

name  unknown

Title of the chat

Inherited from
Chat#name

pinned  unknown

Indicates if the Chat is pinned

Inherited from
Chat#pinned

timestamp  unknown

Unix timestamp for when the last activity occurred

Inherited from
Chat#timestamp

unreadCount  unknown

Amount of messages unread

Inherited from
Chat#unreadCount

Methods

async

archive()

Archives this chat

Inherited from
Chat#archive
async

changeLabels(labelIds) → Promise containing void

Add or remove labels to this Chat

Parameter

Name Type Optional Description

labelIds

 

 

Inherited from
Chat#changeLabels
Returns
async

clearMessages() → Promise containing Boolean

Clears all messages from the chat

Inherited from
Chat#clearMessages
Returns

result

async

clearState()

Stops typing or recording in chat immediately.

Inherited from
Chat#clearState
async

delete() → Promise containing Boolean

Deletes the chat

Inherited from
Chat#delete
Returns

result

async

fetchMessages(searchOptions) → Promise containing Array of Message

Loads chat messages, sorted from earliest to latest.

Parameters

Name Type Optional Description

searchOptions

 

 

Options for searching messages. Right now only limit and fromMe is supported.

Values in searchOptions have the following properties:

Name Type Optional Description

limit

 

Yes

The amount of messages to return. If no limit is specified, the available messages will be returned. Note that the actual number of returned messages may be smaller if there aren't enough messages in the conversation. Set this to Infinity to load all messages.

fromMe

 

Yes

Return only messages from the bot number or vise versa. To get all messages, leave the option undefined.

Inherited from
Chat#fetchMessages
Returns
async

getContact() → Promise containing Contact

Returns the Contact that corresponds to this Chat.

Inherited from
Chat#getContact
Returns
async

getLabels() → Promise containing Array of Label

Returns array of all Labels assigned to this Chat

Inherited from
Chat#getLabels
Returns
async

markUnread()

Mark this chat as unread

Inherited from
Chat#markUnread
async

mute(unmuteDate)

Mutes this chat forever, unless a date is specified

Parameter

Name Type Optional Description

unmuteDate

 

 

Date at which the Chat will be unmuted, leave as is to mute forever

Value can be null.

Inherited from
Chat#mute
async

pin() → Promise containing boolean

Pins this chat

Inherited from
Chat#pin
Returns

New pin state. Could be false if the max number of pinned chats was reached.

async

sendMessage(content[, options]) → Promise containing Message

Send a message to this chat

Parameters

Name Type Optional Description

content

 

 

options

 

Yes

Inherited from
Chat#sendMessage
Returns

Message that was just sent

async

sendSeen() → Promise containing Boolean

Set the message as seen

Inherited from
Chat#sendSeen
Returns

result

async

sendStateRecording()

Simulate recording audio in chat. This will last for 25 seconds.

Inherited from
Chat#sendStateRecording
async

sendStateTyping()

Simulate typing in chat. This will last for 25 seconds.

Inherited from
Chat#sendStateTyping
async

unarchive()

un-archives this chat

Inherited from
Chat#unarchive
async

unmute()

Unmutes this chat

Inherited from
Chat#unmute
async

unpin() → Promise containing boolean

Unpins this chat

Inherited from
Chat#unpin
Returns

New pin state