Pustur / whatsapp-chat-parser

A package to parse WhatsApp chats with Node.js or in the browser 💬
https://whatsapp-chat-parser.netlify.app
MIT License
160 stars 26 forks source link

Parsing group name and participants #257

Open Rahmican opened 2 months ago

Rahmican commented 2 months ago

Hi,

We want to use this library but we also need the following information.

{
+   groupName: 'blablabla',
+   participants: [ 'Rahmican','Mehmet','Loris'],
    date: 2019-06-20T13:44:58.000Z,
    author: 'Loris',
    message: 'I hope you like whatsapp-chat-parser'
}

Could you make the relevant changes? :) Regards, Rahmican.

Pustur commented 2 months ago

Hi @Rahmican,

For the participants you could already get that information by doing the following:

const messages = wcp.parseString(chatLog);
const participants = new Set(messages.map(m => m.author));

console.log(participants); // Set(5) { 'Person1', 'Person2', 'Person3', 'Person4', 'Person5'}

For the group name, seems like we can extract it from the first message, but I have to do some testing


If i decide to add these properties however, it would make sense to change the returned structure like this:

{
  groupName: 'My Group Name',
  participants: [
    'Person1',
    'Person2',
  ],
  messages: [
    {
      date: 2024-08-14T19:00:10.000Z,
      author: null,
      message: '‎Messages and calls are end-to-end encrypted. No one outside of this chat, not even WhatsApp, can read or listen to them.'
    },
    {
      date: 2024-08-14T19:00:10.000Z,
      author: 'Person1',
      message: '‎Hi all bla bla bla'
    }
    // ...
  ]
}
Rahmican commented 2 months ago

Hi @Pustur ,

Thank you for your quick response and support.

Rahmican commented 1 month ago

Hi Loris, what's your decide on this? :)

Pustur commented 1 month ago

@Rahmican This issue is blocked by #258, once that is resolved I can go ahead an release a new major version that changes the output as shown above.

The problem is that I am currently very busy with my job and other stuff, so I don't know when I'll be able to get to these issues.