# Zalo Data Scraper (`dead00/zalo-data-scraper`) Actor

Export your Zalo account's friends, groups, group members and chat history to JSON, CSV or Excel. Log in once by scanning a QR code with the Zalo app; the session is saved, so later runs need no scan.

- **URL**: https://apify.com/dead00/zalo-data-scraper.md
- **Developed by:** [Dead](https://apify.com/dead00) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $3.00 / 1,000 id lookups

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

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

## 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

## Zalo Data Scraper — Friends, Groups & Chats

Export your own Zalo account's data: friends, groups, group members and chat history. Log in once by scanning a QR code with the Zalo app. The session is saved, so later runs log in automatically.

### What you can export

- **Friends**: name, user ID, avatar, phone number (only if the friend shares it)
- **Groups**: name, description, member count, admins
- **Group members**: name, user ID and avatar of each member
- **Chat history**: recent messages from your groups and private chats (off by default)
- **Account extras**: your profile, labels, close friends, aliases, pinned/archived/muted chats, devices, settings and more
- **ID lookups**: profile info for user IDs or group IDs you already have

### How to use

1. Start the actor.
2. Open the run's **Storage** tab, then the key-value store, and open **qr.png**. The log also prints a direct link.
3. Scan it with the Zalo app on your phone (QR scanner) and confirm the login. You have about 150 seconds.
4. The export runs. Results appear in the **Dataset** tab, and you can download them as JSON, CSV or Excel.

Next runs reuse the saved session, so you don't need to scan again. If the session expires, the actor shows a new QR.

### Output example

```json
{
  "type": "friend",
  "userId": "2296642519983593997",
  "displayName": "Minh Anh",
  "zaloName": "minhanh",
  "avatar": "https://s120-ava-talk.zadn.vn/...jpg",
  "phoneNumber": null,
  "gender": 1
}
```

Each row has a `type` field (`friend`, `group`, `group-members`, `group-history`, `friend-history`, `account-info`, `user-lookup` and others), so you can filter by it.

### Pricing

You pay only for the data you get. Platform and proxy costs are included.

| Event | Price per 1,000 |
|---|---|
| Friend exported | $3.00 |
| Group exported | $3.00 |
| Group member exported | $4.00 |
| Chat message exported | $4.50 |
| Extra data exported (each "More options" dataset) | $1.00 |
| ID lookup | $3.00 |
| Actor start (per run) | $0.00005 |

**Example:** 500 friends, 20 groups and 1,000 group members cost about $1.50 + $0.06 + $4.00 = **$5.56**.

Set a **Maximum cost per run** in Run options. When it is reached, the actor stops and keeps everything exported so far.

### Good to know

- **Your own data only.** The actor sees what your account sees: your friends, your groups and their members. It cannot look up random people.
- **Use a spare account.** Zalo may lock accounts that use automated tools.
- **Vietnamese proxy.** Zalo blocks connections from outside Vietnam, so the actor uses a Vietnamese residential proxy. It is set by default; leave it on.
- **Chat history is recent only.** You get the messages Zalo syncs to Zalo Web, not necessarily your full archive.
- **Keep Zalo Web closed** on the same account while exporting private chats.

You are responsible for using the exported data in line with Zalo's terms and privacy laws.

# Actor input Schema

## `lookupUserIds` (type: `array`):

Zalo user IDs (long numbers) to fetch profile info for: name, avatar, and whatever their privacy settings allow. Get IDs from the friends or group-members output.

## `lookupGroupIds` (type: `array`):

Zalo group IDs to fetch info for: name, members, admins. Your account must be able to see the group.

## `exportFriends` (type: `boolean`):

Export your friends list (name, Zalo ID, avatar, and phone number only if the friend shares it).

## `exportGroups` (type: `boolean`):

Export the groups you are in, with name, description, member count and admin list.

## `exportGroupMembers` (type: `boolean`):

For each of your groups, resolve member IDs to names and avatars.

## `exportGroupHistory` (type: `boolean`):

Export recent messages from each of your groups. Off by default, since chat content is sensitive.

## `exportFriendHistory` (type: `boolean`):

Recent messages from your direct chats with friends. Uses a live connection to Zalo; only recent synced history is available.

## `historyMessageCount` (type: `integer`):

How many recent messages to fetch per group when history export is on.

## `maxFriendsForHistory` (type: `integer`):

Cap how many friends' chats to pull, to keep the run bounded.

## `exportAccountInfo` (type: `boolean`):

Your own full profile (name, bio, avatar, phone).

## `exportFriendAliases` (type: `boolean`):

Nicknames you set for friends.

## `exportLabels` (type: `boolean`):

Your friend/chat labels (tags).

## `exportCloseFriends` (type: `boolean`):

Your close-friends list.

## `exportSentFriendRequests` (type: `boolean`):

Friend requests you have sent.

## `exportPinnedConversations` (type: `boolean`):

Your pinned chats.

## `exportArchivedConversations` (type: `boolean`):

Your archived chats.

## `exportMutedConversations` (type: `boolean`):

Chats you have muted.

## `exportAutoReplies` (type: `boolean`):

Your auto-reply rules.

## `exportQuickMessages` (type: `boolean`):

Your saved quick-reply messages.

## `exportDevices` (type: `boolean`):

Devices currently signed in to your account.

## `exportSettings` (type: `boolean`):

Your account settings.

## `exportAvatars` (type: `boolean`):

Your past profile pictures.

## `exportBusinessCatalogs` (type: `boolean`):

Product catalogs (only if this is a Zalo Business account).

## `exportGroupPendingMembers` (type: `boolean`):

For each group, people waiting for approval to join.

## `exportGroupReminders` (type: `boolean`):

For each group, its reminders and events.

## `sessionStoreName` (type: `string`):

Named key-value store where the login session is saved and reused. Use different names to keep multiple Zalo accounts separate.

## `qrWaitSeconds` (type: `integer`):

How long the run waits for you to scan the QR before giving up.

## `language` (type: `string`):

Interface language sent to Zalo.

## `maxGroups` (type: `integer`):

Limit how many groups to process (0 = all of them). Useful for a quick first test.

## `requestDelayMs` (type: `integer`):

Pause between Zalo requests. Higher is slower but less likely to trigger rate limits or a ban.

## `proxyConfiguration` (type: `object`):

Route Zalo traffic through a proxy. Zalo often refuses connections from Apify's foreign servers, so a Vietnamese residential proxy (RESIDENTIAL, country VN) is strongly recommended. Residential proxy usage costs extra on Apify.

## Actor input object example

```json
{
  "lookupUserIds": [],
  "lookupGroupIds": [],
  "exportFriends": true,
  "exportGroups": true,
  "exportGroupMembers": true,
  "exportGroupHistory": false,
  "exportFriendHistory": false,
  "historyMessageCount": 50,
  "maxFriendsForHistory": 20,
  "exportAccountInfo": true,
  "exportFriendAliases": false,
  "exportLabels": false,
  "exportCloseFriends": false,
  "exportSentFriendRequests": false,
  "exportPinnedConversations": false,
  "exportArchivedConversations": false,
  "exportMutedConversations": false,
  "exportAutoReplies": false,
  "exportQuickMessages": false,
  "exportDevices": false,
  "exportSettings": false,
  "exportAvatars": false,
  "exportBusinessCatalogs": false,
  "exportGroupPendingMembers": false,
  "exportGroupReminders": false,
  "sessionStoreName": "zalo-session",
  "qrWaitSeconds": 150,
  "language": "vi",
  "maxGroups": 0,
  "requestDelayMs": 800,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ],
    "apifyProxyCountry": "VN"
  }
}
```

# Actor output Schema

## `results` (type: `string`):

No description

# 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 = {
    "lookupUserIds": [],
    "lookupGroupIds": [],
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ],
        "apifyProxyCountry": "VN"
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("dead00/zalo-data-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 = {
    "lookupUserIds": [],
    "lookupGroupIds": [],
    "proxyConfiguration": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
        "apifyProxyCountry": "VN",
    },
}

# Run the Actor and wait for it to finish
run = client.actor("dead00/zalo-data-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 '{
  "lookupUserIds": [],
  "lookupGroupIds": [],
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ],
    "apifyProxyCountry": "VN"
  }
}' |
apify call dead00/zalo-data-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,dead00/zalo-data-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/7FdDWnAjyABYVA9nd/builds/REJoeg86aFVyTpO9L/openapi.json
