Chat Functions
Search Chats
List all Chats
javascript
let response = await client.getChats()
Successful return
javascript
{
session: 'Marketing',
device: "551152204957",
type: 'get-chats',
chats: [
{ id: '556181590153'},
{ id: '5511982743910-1596072761'}
]
}
Erro return
javascript
{
session: 'Marketing',
device: "551152204957",
status: 404,
type: 'get-chats',
message: 'message of erro'
}
Mute Conversation
Silence the conversation for a period
Mutate
javascript
//chat number, time: ['hour', 'week', 'ever']
let response = await client.muteChat("5561981590153", "hour")
Unmute
javascript
//chat number
let response = await client.unmuteChat("5561981590153")
Successful return
javascript
{
session: 'Marketing',
device: "551152204957",
status: 200,
type: 'mute-chat',
}
Erro return
javascript
{
session: 'Marketing',
device: "551152204957",
status: 404,
type: 'mute-chat',
message: 'message of erro'
}
Archive Chat
Archive or Unarchive a chat
To file
javascript
//número do chat, true
let response = await client.archiveChat("5561981590153", true)
Unarchive
javascript
//número do chat, false
let response = await client.archiveChat("5561981590153", false)
Successful return
javascript
{
session: 'Marketing',
device: "551152204957",
status: 200,
type: 'archive-chat',
}
Erro return
javascript
{
session: 'Marketing',
device: "551152204957",
status: 404,
type: 'archive-chat',
message: 'message of erro'
}
Delete Chat
Delete a specific chat or group
javascript
//número do chat ou group
let response = await client.deleteChat("5561981590153")
Successful return
javascript
{
session: 'Marketing',
device: "551152204957",
status: 200,
type: 'delete-chat',
}
Erro return
javascript
{
session: 'Marketing',
device: "551152204957",
status: 404,
type: 'delete-chat',
message: 'message of erro'
}
PinChat
Pin or Unpin a chat
Fix
javascript
//chat number, true
let response = await client.pinChat("5561981590153", true)
Unpin
javascript
//chat number, false
let response = await client.pinChat("5561981590153", false)
Successful return
javascript
{
session: 'Marketing',
device: "551152204957",
status: 200,
type: 'pin-chat',
}
Erro return
javascript
{
session: 'Marketing',
device: "551152204957",
status: 404,
type: 'pin-chat',
message: 'message of erro'
}