# Whatsapp Channel Messages (`romy/whatsapp-channel-messages`) Actor

Fetch messages from a WhatsApp Channel by channel ID or invite code.

- **URL**: https://apify.com/romy/whatsapp-channel-messages.md
- **Developed by:** [Romy](https://apify.com/romy) (community)
- **Categories:** Social media, Agents, Automation
- **Stats:** 2 total users, 1 monthly users, 60.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $8.00 / 1,000 message scrapeds

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/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

## WhatsApp Channel Messages

Fetch messages from a WhatsApp Channel by channel ID or invite code.

### What does WhatsApp Channel Messages do?

This Actor retrieves messages from a WhatsApp Channel using its ID or invite code. It extracts message text, timestamps, and server IDs for further processing or analysis. Perfect for monitoring channels, archiving conversations, or integrating channel data into your applications.

### Why use WhatsApp Channel Messages?

- **Extract channel conversations** - Get structured message data from WhatsApp Channels without manual copying
- **Pagination support** - Fetch messages in batches using the `before` parameter for efficient data retrieval
- **Structured output** - Messages are returned as clean JSON with timestamps and server IDs
- **Easy integration** - Combine with other Apify Actors or third-party tools for automated workflows
- **Flexible input** - Use channel ID, bare ID, or invite code from `whatsapp.com/channel/<code>`

### How to use WhatsApp Channel Messages

1. Open the Actor in the Apify Console or run it locally
2. Enter your WhatsApp Channel ID or invite code
3. Optionally set the number of messages to fetch (default: 10, max: 100)
4. For pagination, use the `before` parameter with a server message ID from a previous run
5. Click **Start** to fetch messages
6. Download the dataset as JSON, CSV, or Excel from the Results tab

### Input

| Field | Type | Required | Default | Description |
|---|---|---|---|---|
| `channelId` | string | ✓ | — | Channel ID (`120363...@newsletter`), bare ID, or invite code from `whatsapp.com/channel/<code>`. |
| `count` | integer | — | 10 | Number of messages to fetch (max 100). |
| `before` | integer | — | — | Server message ID — only return messages before this ID (for pagination). |

#### Input example

```json
{
  "channelId": "120363012345678901@newsletter",
  "count": 25,
  "before": null
}
````

Or use an invite code:

```json
{
  "channelId": "jz3vf5h",
  "count": 10
}
```

### Output

One record per message — raw response from WhatsApp's API:

```json
{
  "MessageServerID": 3349,
  "MessageID": "AC28F698AA5E614BAA71E922A7833032",
  "Type": "text",
  "Timestamp": "2026-07-06T06:40:19+07:00",
  "ViewsCount": 0,
  "ReactionCounts": {"👍": 12},
  "Message": {
    "conversation": "Hello from the channel"
  }
}
```

#### Output fields

| Field | Type | Description |
|---|---|---|
| `MessageServerID` | integer | Unique server-side message ID (use for pagination via `before`) |
| `MessageID` | string | WhatsApp message UUID |
| `Type` | string | Message type: `text`, `media`, `poll`, etc. |
| `Timestamp` | string | ISO 8601 timestamp when message was sent |
| `ViewsCount` | integer | Number of views |
| `ReactionCounts` | object | Emoji → count map of reactions |
| `Message` | object | Message content by type (e.g. `conversation`, `imageMessage`, `stickerMessage`) |

#### Media messages

For non-text messages, `Message` contains a type-specific nested object (e.g. `imageMessage`, `videoMessage`, `stickerMessage`) with metadata. Text messages have `Message.conversation`.

### Pricing

This Actor uses Apify's **pay-per-event** billing:

- **Actor start**: $0.05 per run
- **Per message**: $0.008 per message scraped ($8 per 1,000 messages)

#### Cost estimation examples

- Fetch 10 messages: $0.05 + (10 × $0.008) = **$0.13 per run**
- Fetch 100 messages: $0.05 + (100 × $0.008) = **$0.85 per run**
- Fetch 1,000 messages (10 paginated runs): $0.50 + $8.00 = **$8.50 total**

Use the `count` parameter to limit messages per run and minimize costs.

### Tips and Advanced Options

#### Pagination for large channels

To fetch more than 100 messages, use pagination:

1. Run the Actor with your desired `count`
2. Note the `MessageServerID` of the **oldest message** in the output
3. Run again with `before` set to that `MessageServerID`
4. Repeat until you've fetched all needed messages

#### Identify invite codes

If you have a WhatsApp Channel link like `https://whatsapp.com/channel/0029VaAGzHb123xyz`, the invite code is `0029VaAGzHb123xyz`. You can use this directly in the `channelId` field.

#### Rate limiting

To avoid being rate-limited by WhatsApp, consider:

- Using longer intervals between runs (e.g., schedule Actor runs every 6 hours)
- Limiting `count` to 25–50 messages per run
- Running only when needed rather than continuously

#### Verify channel access

Only public WhatsApp Channels are supported. Private channels require membership and may not be accessible.

### FAQ and Support

#### Can I scrape private channels?

Only public channels are supported. Private channels that require membership cannot be accessed via this Actor.

#### What happens to media messages?

Images, videos, and documents appear as records with `text: null`. The raw metadata is available in the full message data for manual processing.

#### Is this legal?

WhatsApp Channels are designed for public or semi-public communication. Always respect channel owners' terms and privacy policies. This tool is for authorized use on channels you have permission to access.

#### How do I schedule regular fetches?

Use the Apify Console's **Scheduler** feature to run this Actor on a recurring basis (hourly, daily, weekly).

#### Need a custom solution?

If you need additional features (filtering, real-time webhooks, media downloads), [contact Apify](https://apify.com/contact) for custom development options.

### Feedback and Issues

Found a bug or have a feature request? Open an issue in the [Actor Issues tab](https://apify.com/romy/whatsapp-channel-messages#issues) to report it.

# Actor input Schema

## `channelId` (type: `string`):

Channel ID (e.g. '120363...@newsletter'), bare ID, or invite code from whatsapp.com/channel/<code>.

## `count` (type: `integer`):

Number of messages to fetch. Default: 10, max: 100.

## `before` (type: `integer`):

Only return messages before this server message ID (for pagination).

## Actor input object example

```json
{
  "channelId": "120363202150126650@newsletter",
  "count": 10
}
```

# Actor output Schema

## `dataset` (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 = {
    "channelId": "120363202150126650@newsletter"
};

// Run the Actor and wait for it to finish
const run = await client.actor("romy/whatsapp-channel-messages").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 = { "channelId": "120363202150126650@newsletter" }

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

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

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

```

## CLI example

```bash
echo '{
  "channelId": "120363202150126650@newsletter"
}' |
apify call romy/whatsapp-channel-messages --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=romy/whatsapp-channel-messages",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Whatsapp Channel Messages",
        "description": "Fetch messages from a WhatsApp Channel by channel ID or invite code.",
        "version": "0.0",
        "x-build-id": "tvKL4JBacbVuB5aXf"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/romy~whatsapp-channel-messages/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-romy-whatsapp-channel-messages",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/romy~whatsapp-channel-messages/runs": {
            "post": {
                "operationId": "runs-sync-romy-whatsapp-channel-messages",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/romy~whatsapp-channel-messages/run-sync": {
            "post": {
                "operationId": "run-sync-romy-whatsapp-channel-messages",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "channelId"
                ],
                "properties": {
                    "channelId": {
                        "title": "Channel ID",
                        "type": "string",
                        "description": "Channel ID (e.g. '120363...@newsletter'), bare ID, or invite code from whatsapp.com/channel/<code>.",
                        "default": "120363202150126650@newsletter"
                    },
                    "count": {
                        "title": "Message Count",
                        "type": "integer",
                        "description": "Number of messages to fetch. Default: 10, max: 100.",
                        "default": 10
                    },
                    "before": {
                        "title": "Before Server ID",
                        "type": "integer",
                        "description": "Only return messages before this server message ID (for pagination)."
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
