Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/pustur/whatsapp-chat-parser

A package to parse WhatsApp chats with Node.js or in the browser 💬
https://github.com/pustur/whatsapp-chat-parser

npm-package parser whatsapp whatsapp-chat-parser whatsapp-parser

Last synced: 2 days ago
JSON representation

A package to parse WhatsApp chats with Node.js or in the browser 💬

Awesome Lists containing this project

README

        

# WhatsApp Chat Parser

[![Continuous Integration](https://github.com/Pustur/whatsapp-chat-parser/actions/workflows/ci.yml/badge.svg)](https://github.com/Pustur/whatsapp-chat-parser/actions/workflows/ci.yml)
[![codecov](https://codecov.io/gh/Pustur/whatsapp-chat-parser/branch/master/graph/badge.svg)](https://codecov.io/gh/Pustur/whatsapp-chat-parser)
[![npm version](https://img.shields.io/npm/v/whatsapp-chat-parser.svg)](https://www.npmjs.com/package/whatsapp-chat-parser)
[![minified size](https://img.shields.io/bundlephobia/min/whatsapp-chat-parser.svg)](https://bundlephobia.com/result?p=whatsapp-chat-parser)

> A package to parse WhatsApp chats with Node.js or in the browser 💬

## Important notice

🚨 `v4.0.0` brings some **BREAKING CHANGES**, check out the [release page](https://github.com/Pustur/whatsapp-chat-parser/releases/tag/4.0.0) for more info.

## Introduction

This library allows you to parse WhatsApp chat logs from text format into javascript objects, enabling you to more easily manipulate the data, create statistics, export it in different formats, etc.

You can test the package online with this example website:
[whatsapp-chat-parser.netlify.app](https://whatsapp-chat-parser.netlify.app/) ([Source code](https://github.com/Pustur/whatsapp-chat-parser-website))

## Install

```
$ npm install whatsapp-chat-parser
```

## Usage

### Node

```js
import fs from 'node:fs';
import * as whatsapp from 'whatsapp-chat-parser';

const text = fs.readFileSync('path/to/_chat.txt', 'utf8');
const messages = whatsapp.parseString(text);

console.log(messages);
```

### Browser

Add the script to your HTML file (usually just before the closing `