The question gets two stock answers — «it is all public, so anything goes» and «none of it is allowed». Both are wrong.
What open data means
A username, a display name and membership of a public chat were published by the person themselves. Compiling those into a list is not in itself prohibited — it is the same as writing them down by hand, only faster.
Where the violation starts
Not in the collection but in what happens next.
- Passing data to third parties. Selling a collected list is distribution of personal data without consent, and there is no ambiguity there.
- Messaging without consent. Bulk messages to strangers fall under advertising law in most jurisdictions.
- Circumventing technical restrictions. Collecting from closed groups you were not admitted to is not open data.
Platform rules
Separate from the law, Telegram's own rules prohibit bulk messaging of strangers outright — and the penalty arrives faster than any legal process, in the form of a restriction.
Working comfortably
Use what you collect yourself, and to find venues rather than people. Start contact in public — with a comment, not a DM. Message directly only those who approached you or subscribed. That is both lawful and more effective: warm lists respond better. See the cold and warm list comparison.