Skip to main content

Class: Chat

Defined in: structures/Chat.ts:25

Fluent chat handle: send without having to repeat the recipient.

Example

const chat = wa.chat('34600112233');
await chat.text('hi!');
await chat.image('./cat.jpg', { caption: 'meow' });

Extended by

Constructors

Constructor

new Chat(client, id, name?): Chat

Defined in: structures/Chat.ts:26

Parameters

client

Client

id

string

Chat JID.

name?

string

Chat name, if known.

Returns

Chat

Properties

client

protected readonly client: Client

Defined in: structures/Chat.ts:27


id

readonly id: string

Defined in: structures/Chat.ts:29

Chat JID.


name?

readonly optional name?: string

Defined in: structures/Chat.ts:31

Chat name, if known.

Accessors

isGroup

Get Signature

get isGroup(): boolean

Defined in: structures/Chat.ts:35

Is it a group?

Returns

boolean

Methods

audio()

audio(source, options?): Promise<Message>

Defined in: structures/Chat.ts:59

Parameters

source

MediaSource

options?

AudioOptions

Returns

Promise<Message>


block()

block(): Promise<void>

Defined in: structures/Chat.ts:100

Blocks this contact.

Returns

Promise<void>


document()

document(source, options?): Promise<Message>

Defined in: structures/Chat.ts:68

Parameters

source

MediaSource

options?

DocumentOptions

Returns

Promise<Message>


fromLink(link, options?): Promise<Message>

Defined in: structures/Chat.ts:77

Sends whatever a link points to, auto-detecting the media kind.

Parameters

string

options?

SendFromLinkOptions

Returns

Promise<Message>


image()

image(source, options?): Promise<Message>

Defined in: structures/Chat.ts:51

Parameters

source

MediaSource

options?

CaptionOptions

Returns

Promise<Message>


location()

location(location, options?): Promise<Message>

Defined in: structures/Chat.ts:72

Parameters

location

LocationInput

options?

MiscMessageGenerationOptions

Returns

Promise<Message>


profilePictureUrl()

profilePictureUrl(highRes?): Promise<string | undefined>

Defined in: structures/Chat.ts:90

Profile picture URL of this chat/contact.

Parameters

highRes?

boolean = false

Returns

Promise<string | undefined>


send()

send(content, options?): Promise<Message>

Defined in: structures/Chat.ts:40

Sends raw Baileys content (or text).

Parameters

content

string | AnyMessageContent

options?

MiscMessageGenerationOptions

Returns

Promise<Message>


subscribePresence()

subscribePresence(): Promise<void>

Defined in: structures/Chat.ts:95

Subscribes to this contact's presence updates.

Returns

Promise<void>


text()

text(body, options?): Promise<Message>

Defined in: structures/Chat.ts:47

Parameters

body

string

options?

TextOptions

Returns

Promise<Message>


typing()

typing(): Promise<() => Promise<void>>

Defined in: structures/Chat.ts:82

Shows "typing…". Returns a function to stop showing it.

Returns

Promise<() => Promise<void>>


unblock()

unblock(): Promise<void>

Defined in: structures/Chat.ts:105

Unblocks this contact.

Returns

Promise<void>


video()

video(source, options?): Promise<Message>

Defined in: structures/Chat.ts:55

Parameters

source

MediaSource

options?

CaptionOptions

Returns

Promise<Message>


voice()

voice(source, options?): Promise<Message>

Defined in: structures/Chat.ts:64

Voice note (audio with ptt: true).

Parameters

source

MediaSource

options?

MiscMessageGenerationOptions

Returns

Promise<Message>