Using Generative AI on Telegram for Crisis Reporting
Generative AIMediaOSINTTelegram
April 20, 202510min
Illustration of some cases where journalists face difficulties accessing the field: war (Ukraine), natural disasters (Myanmar), or military restrictions (Gaza Strip).
TL;DR
This blog post explores the use of Gemini AI, a generative AI model, to analyze Telegram messages during crises like wars and natural disasters.
In this project, we will discuss a single use case: automatically geolocating Telegram messages based on their textual content.
We'll discuss the challenges and the code required to solve this task.
Check the following links for further information:
git clone https://github.com/Guepardow/telegram_feed_analyzer
cd telegram_feed_analyzer
uv sync
uv run gradio app.py
Objective: transform Telegram feeds into insights
Accessing real-time information from conflict zones and crisis regions, such as Gaza, Ukraine and Sudan, remains a significant challenge for journalists.
Telegram, a popular messaging platform, has become a vital tool in these areas, providing live updates that traditional media often miss.
However, manually analyzing thousands of messages is time-consuming, involving copy-pasting messages into translation and mapping tools.
This project leverages generative AI to transform raw Telegram posts into insights.
By focusing on multi-lingual translation and geolocation, we support journalists and OSINT (Open-Source Intelligence) analysts in better understanding geopolitical events.
Using real data from Telegram in late March 2025, focusing on Israel and Palestine, we demonstrate how AI-enhanced feeds can provide valuable insights,
making reporting easier.
Let's focus on a single task: geolocating Telegram messages based on their textual data. Geolocating Telegram messages is valuable for analysts and journalists. It serves as a strong starting point for further investigation and verification. For example, it allows real-time tracking of conflicts or political events, such as a coup d'état.
Common challenges
Traditional methods for geolocating involve a multi-step process: detecting the language of the post, translating it, identifying location names, and using an API to find their coordinates (latitude and longitude).
However, this approach has several limitations:
Contextual understanding: traditional algorithms often lack the ability to interpret the context of the posts, leading to inaccuracies;
Error accumulation: each step in the process can introduce errors, which compound as the analysis progresses.
Instead of having a complex pipeline, generative AI allows for a simpler pipeline. This illustration compares the two approaches.
Comparaison between a traditional pipeline and one based on generative AI.
One significant challenge for geolocation is knowing exactly what needs to be geolocated. For instance, consider the sentence: "China refuses to have its hand twisted." In this case, the algorithm should not geolocate "China" because the sentence does not describe an event occurring in China.
Similarly, in the sentence: "Explosions were heard in the Tal as Sultan neighborhood of Rafah," the model should return the coordinates for "Tal as Sultan" only, as it is the most precise location mentioned.
These examples highlight common errors that can occur. Let's explore more scenarios to understand these challenges better:
Several examples of success and failures in the task of geolocation.
Solution using Gemini 2.0
Gemini 2.0 is an AI model that can take text as input and return various types of outputs. Two questions arise:
First, how can we make the AI understand what to geolocate?
Second, how can we force this model to return the name of the location and the geographical coordinates?
For the first question, we can simply show some examples to the model: this technique is called "few-shot prompting". You only need to provide a few examples in the prompt of your large language model.
PROMPT = """
You are an expert capable of geolocating from a given Telegram post.
The message is posted on channels based in the Middle East (mainly, Gaza, Israel and West Bank).
Telegram Message:
```
{text}
```
Instructions:
1. Read carefully to find any current factual events. Ignore speeches and announcements. Ignore very old events and future events.
2. Read the post carefully to identify any mentioned locations, such as cities, landmarks, or addresses.
3. Find the location (most precise if many) of the factual event based on the context provided.
4. Provide the latitude and longitude of the identified location in decimal degrees format.
5. Return only the location and their coordinates in the format [(location_name: str, latitude: float, longitude: float)]
Examples:
Example 1:
Telegram Message:
```
A protest took place in front of the Al-Aqsa Mosque today, with hundreds of participants.
```
Output:
[("Al-Aqsa Mosque", 31.776, 35.235)]
Explanation: The event is a protest, which is a factual event that can be recorded on video.
Example 2:
Telegram Message:
```
The Prime Minister will deliver a speech tomorrow at the Knesset.
```
Output:
[]
Explanation: The event is a future speech, which is not a factual event that has already occurred.
Example 3:
Telegram Message:
```
There are power outages in Rafah, in the southern Gaza Strip.
```
Output:
[("Rafah", 31.294, 34.248)]
Explanation: Only the most precise location is reported.
Example 4:
Telegram Message:
```
The President visited Jerusalem where he discussed the events that took place in Jenin last week.
```
Output:
[("Jerusalem", 31.777, 35.232)]
Explanation: Only the events that recently happened are geolocated.
Output:
- geolocation: [(location_name: str, latitude: float, longitude: float)]
"""
Then, for the second question, we can force the model to return a specific output:
Let's run the traditional method and the generative AI approaches on 50 Telegram messages focused on the situation in Israel and Palestine. We can now compare these two methods with the ground truth map with these three interactive maps:
on the left, we have the correct geolocations: they are exclusively in Israel and Palestine;
in the center, we have the predicted geolocations by the traditional approach: many locations are outside this region. We can notice some mistakes, such as the West Bank being located in Minnesota, USA. Additionally, the map contains a lot of irrelevant geolocations;
on the right, we have the predicted geolocations by the generative AI model of Gemini: they are almost identical to the correct geolocations!
Providing context to the AI model improves contextual understanding and reduces the amount of hallucinations.
Conclusion
Geolocating Telegram messages is now feasible using a generative AI model. This will give analysts and journalists a powerful starting point for further investigation and verification.
For now, this project only utilizes textual data. However, Telegram also provides images and videos. Therefore, a possible future enhancement would be to integrate computer vision and audio understanding to further enhance the capabilities of this tool.
If you are interested in this project, you can check our Gradio Dashboard, which lets you interact with the data (see below and link above).