It's possible to create a chat?
JVini0166 opened this issue · comments
Description:
I would like to request a new feature for this library: the ability to set up a chat that can retrieve all conversations and messages. This would greatly enhance the usability and functionality of the library for projects requiring complete chat history access.
Use Case:
In my current project, I need to implement a chat system that not only allows for real-time communication but also provides access to the entire chat history. This includes fetching all past conversations and their respective messages. This feature is crucial for applications such as customer support systems, where having access to previous interactions can significantly improve the service quality.
why are you requesting a feature like you are paying the maintainers? lmao. that is not how github issues are used. hire someone to do that for you.
lol, github has a template for feature request when you're opening an issue @bentacos
I understand your concern, but let me clarify why this approach is actually beneficial for both users and maintainers of the library
GitHub Issues are a collaborative platform where users and maintainers can discuss potential improvements. Providing a well-thought-out feature request helps maintainers understand the user's needs and assess the feasibility and priority of the request.
While hiring someone to implement the feature is an option, contributing ideas and suggestions through GitHub Issues is a standard and effective practice in the open-source community.
Sorry if I expressed myself poorly, but I wanted to know if it's possible to build a chat, like a Whatsapp clone, because I didn't find a function that would return all chats to me @bentacos
Sorry if I expressed myself poorly, but I wanted to know if it's possible to build a chat, like a Whatsapp clone, because I didn't find a function that would return all chats to me @bentacos
honestly, that's stupid. just use whatsapp and don't reinvent the wheel
lol, github has a template for feature request when you're opening an issue @bentacos
I understand your concern, but let me clarify why this approach is actually beneficial for both users and maintainers of the library
GitHub Issues are a collaborative platform where users and maintainers can discuss potential improvements. Providing a well-thought-out feature request helps maintainers understand the user's needs and assess the feasibility and priority of the request.
While hiring someone to implement the feature is an option, contributing ideas and suggestions through GitHub Issues is a standard and effective practice in the open-source community.
you are basically asking for an "app", not a feature. there are already several functions in Baileys that will help you manage the chat messages. use a database if you want to save the old messages.
That's the point, I don't want to save the message history but access the existing one, the feature that I am asking for is something like fetching last messages from a specific chat for example, not fetching the messages after I've scanned the QR Code @bentacos
const wppconnect = require('@wppconnect-team/wppconnect');
wppconnect.create().then(async (client) => {
try {
// Obtenha todos os chats
const allChats = await client.getAllChats();
// Ordene os chats pela data da última mensagem e pegue os 50 mais recentes
const sortedChats = allChats.sort((a, b) => {
const dateA = new Date(a.t);
const dateB = new Date(b.t);
return dateB - dateA;
}).slice(0, 50);
console.log(sortedChats);
} catch (error) {
console.error('Error fetching chats:', error);
}
}).catch((error) => {
console.error('Error initializing wppconnect:', error);
});
const wppconnect = require('@wppconnect-team/wppconnect');
wppconnect.create().then((client) => {
client.onMessage(async (message) => {
// Substitua "chatId" pelo ID do chat que você deseja buscar as mensagens
const chatId = '5541999999999@c.us';
try {
const messages = await client.getChatMessages(chatId, {
limit: 50,
});
console.log(messages);
} catch (error) {
console.error('Error fetching messages:', error);
}
});
}).catch((error) => {
console.error('Error initializing wppconnect:', error);
});
something like this getAllChats().
I am not asking for an "app", I am asking for functions that I could use for creating something like that.