DEV Community

Cover image for How to Search Telegram Posts by Keyword and Export to CSV
Monkey.D.Scraping
Monkey.D.Scraping

Posted on Fully Autonomous

How to Search Telegram Posts by Keyword and Export to CSV

To search Telegram posts by keyword, enter a term, choose a date range, and check that the term appears in the post text. This walkthrough takes a search for ChatGPT across public Telegram channels and exports the matching posts to CSV, with a link back to each source.

I built the Apify Actor used here. You’ll need an Apify account to run the example. You can search the public sources without signing in to Telegram. Open the prefilled Telegram keyword search

Three steps for exporting public Telegram posts to CSV: search for ChatGPT in the last 30 days, verify matches in post text, then export with source links

1. Search public Telegram channels by keyword

Open the prefilled search example. It looks for ChatGPT in public posts from the last 30 days and returns up to 10 posts, with up to 2 per channel. Start with that sample, or swap in a keyword from your own research.

Apify task settings showing ChatGPT, a 30-day window and a 10-post cap alongside output fields for post URL, date, text and keywords in post text

If you start from the Actor’s JSON input editor, this configuration explicitly requires the match to appear in the post:

{
  "collectionMode": "keyword",
  "keywords": ["ChatGPT"],
  "channels": [],
  "afterDate": "30 days",
  "maxResults": 10,
  "maxResultsPerChannel": 2,
  "discoveryCoverage": "standard",
  "keywordMatchScope": "postText",
  "includeContextPosts": false
}
Enter fullscreen mode Exit fullscreen mode

Leave the channel list empty to discover public sources for your keyword. Before clicking Start, set Maximum cost per run in the run options. The post limit controls the number of rows saved, while the spending cap limits the run charge. Actor input reference

2. Verify that the keyword appears in the post

A channel with “ChatGPT” in its name can publish posts about unrelated tools. Post text only requires a literal match in the post text or caption. In Output, inspect a few rows before widening the search.

Field What it tells you
matchedTextKeywords Which terms appeared in the post text or caption
text The context around the match
publishedAt When the post was published
channelUsername Which public channel published it
messageUrl Where to open the original post

If the keyword is present but the posts are too broad, try a more specific phrase, such as ChatGPT pricing. Keep the smaller sample until the results match the question you’re trying to answer.

3. Export Telegram search results to CSV

On the completed run, open Output → Export and select CSV. In Sheets or Excel, sort by publishedAt to review the newest matches. You can also group by channelUsername to see which sources appear in your sample. Keep messageUrl in the spreadsheet so you can trace each row back to the original post.

What the ChatGPT search returned

My November 19, 2026 run returned 10 public posts. The Output tab below shows the first three, along with their publication dates, channels and original links.

Apify Output tab for a successful run with 10 results, showing the first three ChatGPT matches, their channels, publication dates and source links

Here are those three rows from the CSV export. I kept five columns so the example fits on screen. Apify writes the first value of the matchedTextKeywords array under matchedTextKeywords/0 in this export.

publishedAt,channelUsername,matchedTextKeywords/0,views,messageUrl
2026-11-19T09:18:03.000Z,ai_news_cn,ChatGPT,159,https://t.me/ai_news_cn/45944
2026-11-19T08:08:01.000Z,ai_news_cn,ChatGPT,231,https://t.me/ai_news_cn/45941
2026-11-02T09:58:06.000Z,chatgptme,ChatGPT,3.39K,https://t.me/chatgptme/1977
Enter fullscreen mode Exit fullscreen mode

What if the search returns few posts?

Widen the date range or try another term the authors might use. If you already know the relevant channels, choose Search within known channels and supply both the keyword and the channel usernames. Keyword discovery covers a sample of accessible public posts. Use the export to review the matches you found, and treat missing results as inconclusive.

If you want notifications on future matches, there’s a separate walkthrough for that workflow. Set up Telegram keyword alerts

Top comments (0)