This guide will help you configure your Masa Node as a Telegram scraper.
app_id
and app_hash
from Telegram applications page)The Telegram scraper uses full API access as a user, not a bot. Ensure you comply with Telegram’s terms of service and respect user privacy when using this scraper.
Set environment variables
Enable Telegram scraping and add your app credentials in your .env
file:
Restart your node
Restart the Masa node to apply the changes.
Verify configuration
Check the logs for confirmation:
Authenticate your Telegram account
a. Start authentication:
b. Complete authentication with the code received on your phone:
Test the Telegram scraper
To use the Telegram scraper, you’ll need to provide a chat ID. Here’s how to obtain chat IDs for different types of Telegram chats:
a. Public Channels:
-100
followed by the channel name (e.g., -100channelname
)b. Private Channels/Groups:
c. Using @username_to_id_bot:
d. Personal Chat:
Curl the node to confirm it returns Telegram data (replace {chatID}
with an actual chat ID):
You should receive a response with Telegram message data.
Channel and group chat IDs are typically negative numbers, often starting with -100
.
Use these chat IDs in your API calls, replacing {chatID}
with the actual ID:
You can join multiple Telegram channels with your authenticated account. The scraper will be able to access and scrape data from all channels you’ve joined, making it an efficient way to gather information from various sources.
:::warning This scraper uses full API access as a user account, not a bot. Be aware of Telegram’s terms of service and data usage policies. Ensure you have the right to access and use the data from the channels you’re scraping. :::
If you encounter issues:
This guide will help you configure your Masa Node as a Telegram scraper.
app_id
and app_hash
from Telegram applications page)The Telegram scraper uses full API access as a user, not a bot. Ensure you comply with Telegram’s terms of service and respect user privacy when using this scraper.
Set environment variables
Enable Telegram scraping and add your app credentials in your .env
file:
Restart your node
Restart the Masa node to apply the changes.
Verify configuration
Check the logs for confirmation:
Authenticate your Telegram account
a. Start authentication:
b. Complete authentication with the code received on your phone:
Test the Telegram scraper
To use the Telegram scraper, you’ll need to provide a chat ID. Here’s how to obtain chat IDs for different types of Telegram chats:
a. Public Channels:
-100
followed by the channel name (e.g., -100channelname
)b. Private Channels/Groups:
c. Using @username_to_id_bot:
d. Personal Chat:
Curl the node to confirm it returns Telegram data (replace {chatID}
with an actual chat ID):
You should receive a response with Telegram message data.
Channel and group chat IDs are typically negative numbers, often starting with -100
.
Use these chat IDs in your API calls, replacing {chatID}
with the actual ID:
You can join multiple Telegram channels with your authenticated account. The scraper will be able to access and scrape data from all channels you’ve joined, making it an efficient way to gather information from various sources.
:::warning This scraper uses full API access as a user account, not a bot. Be aware of Telegram’s terms of service and data usage policies. Ensure you have the right to access and use the data from the channels you’re scraping. :::
If you encounter issues: