# WhatsApp Messages Scraper (`extremescrapes/whatsapp-messages-scraper`) Actor

Scrape and monitor WhatsApp group or private chat messages in real time. Scan the QR code to connect and start collecting structured WhatsApp message data.

- **URL**: https://apify.com/extremescrapes/whatsapp-messages-scraper.md
- **Developed by:** [Extreme Scrapes](https://apify.com/extremescrapes) (community)
- **Categories:** Social media, Lead generation
- **Stats:** 525 total users, 19 monthly users, 99.7% runs succeeded, 23 bookmarks
- **User rating**: 3.95 out of 5 stars

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-usage

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## WhatsApp Messages Scraper

### Overview

The **WhatsApp Messages Scraper** is an Apify actor that connects to your WhatsApp account and listens to incoming messages from private chats and group conversations. Once connected via a QR code (displayed in the actor's log), it continuously captures and stores incoming messages in real time.

This actor is ideal for developers building automation tools, service marketplaces, sentiment analysis pipelines, or real-time communication systems.

### How It Works

1. When you run the actor, a QR code is displayed in the LOG tab — you must open the **LOG** tab to see and scan the QR code using your WhatsApp mobile app.
2. You scan the QR code using your WhatsApp mobile app.
3. Once authenticated, the actor connects to your WhatsApp account.
4. It starts listening to messages from group chats and private conversations.
5. All messages are captured and stored in the default Apify dataset for further processing.
6. To stop the actor, simply log out of the connected WhatsApp session from your phone (via WhatsApp → Linked devices → Log out).

### Features

✅ Real-time message scraping from WhatsApp chats and groups

✅ Simple QR code authentication (no password or phone number needed)

✅ Outputs structured message data (sender, chat type, timestamp, content)

✅ Perfect for real-time analytics, service platforms, or data collection

✅ Compatible with both group and individual chats

### Getting Started

#### 1. Input Parameters

This actor does not require any input parameters to start. Just run the actor and follow the on-screen instructions.

| Parameter   | Type   | Required | Description                          |
|-------------|--------|----------|--------------------------------------|
| *(none)*    | —      | —        | No configuration needed to begin.   |

#### 2. Running the Actor

You can run the actor directly on Apify or via API:

##### **Using Apify Interface**

1. Navigate to the actor's page on Apify.
2. Click **Run** to start the actor.
3. Watch the **Log** section for the QR code.
4. Open WhatsApp on your mobile device, tap the menu → **Linked devices**, and scan the QR code.
5. The actor will connect and begin capturing messages.

##### **Using Apify API**

```bash
curl -X POST -H "Content-Type: application/json" \
     "https://api.apify.com/v2/acts/YOUR_ACTOR_ID/runs?token=YOUR_API_TOKEN"
```

Then open the Apify log in the browser and scan the QR code as described above.

### Output Format

The output is a structured JSON dataset of WhatsApp messages:

```json
[
    {
        "messageText": "Hello World!",
        "senderNumber": "4433556546677",
        "senderName": "John Doe",
        "timestamp": 1744832304,
        "isGroupMessage": true,
        "isPrivateMessage": false,
        "groupName": "Test",
        "groupId": "120363412896248312",
        "chatId": "120363412896248312",
        "rawMessageId": "E5C0669D75C493BD8D76DD56097EBF36",
        "deviceType": "android",
        "fromMe": false,
        "isForwarded": false,
        "hasMedia": false,
        "isStarred": false,
        "mentionedNumbers": [],
        "isStatus": false,
        "links": []
    }
]
```

### Use Cases

- **Real-time Service Marketplaces** – Capture and respond to service requests in WhatsApp groups.
- **Customer Support Automation** – Log and analyze customer messages for automated handling.
- **Lead Generation** – Scrape group conversations to identify leads or opportunities.
- **Data Collection for NLP** – Collect structured text data for training chatbots or AI models.
- **Market & Sentiment Analysis** – Monitor real-time discussions for trends or signals.

### Support & Contributions

If you encounter any issues or have feature suggestions, feel free to open an issue or fork and contribute. Let’s build better bots together! 🤖

***

Let me know if you want to include sections like FAQs or advanced configuration later!

# Actor input Schema

## `instruction` (type: `string`):

You don't need to fill anything out. You just need to start the actor, go to the Log tab and scan the QR code

## Actor input object example

```json
{
  "instruction": "You don't need to fill anything out. You just need to start the actor, go to the Log tab and scan the QR code"
}
```

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "instruction": "You don't need to fill anything out. You just need to start the actor, go to the Log tab and scan the QR code"
};

// Run the Actor and wait for it to finish
const run = await client.actor("extremescrapes/whatsapp-messages-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "instruction": "You don't need to fill anything out. You just need to start the actor, go to the Log tab and scan the QR code" }

# Run the Actor and wait for it to finish
run = client.actor("extremescrapes/whatsapp-messages-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "instruction": "You don'\''t need to fill anything out. You just need to start the actor, go to the Log tab and scan the QR code"
}' |
apify call extremescrapes/whatsapp-messages-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,extremescrapes/whatsapp-messages-scraper"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/ocR9IBFeML3kVU2FW/builds/KdOiXbbpMfJgKy5gO/openapi.json
