Back to blog

How to remove Telegram advertising automatically without unnecessary bans

Choose the right mix of stop words, text anti-spam, links and forward rules. Test removal separately from penalties and understand automatic AI verification limits.

One group gets the same easy-money pitch every day. Another sees fresh wording that always directs people to the same channel. A third is overwhelmed by forwarded promotions. These are different moderation problems, even if members call all of them advertising.

Start with the recurring mechanism. A distinctive phrase suggests a stop-word rule; an unwanted destination suggests link filtering; a reposting policy belongs under forwards. Text anti-spam can help classify advertising-like messages, but it cannot supply every agreement your community has made. A useful setup must protect legitimate discussion and give people a way to challenge mistakes.

Define the advertising you actually prohibit

“Selling my child's bicycle” might be welcome in a neighbourhood group and off topic in a study group. A store link might be a promotion, an answer to a question, or evidence in a refund discussion. If moderators have not agreed on that distinction, automation will make the disagreement happen faster.

Write a concrete policy. For example: “Unsolicited earning offers and repeated channel promotion are prohibited. A relevant recommendation in reply to a question is allowed.” Decide how to handle quoted scam messages, partner announcements and invitations to related groups.

Collect a small set of real examples, removing unnecessary personal details. Separate clear violations, clearly acceptable posts and cases requiring a human decision. A blank profile, unfamiliar name or missing photo is not evidence that someone is an advertiser.

Match the first filter to the repeated problem
What keeps recurringWhere to startLegitimate messages to test
A distinctive promotional phraseStop wordsQuotes, reports and similar permitted phrases
Different wording with spam-like characteristicsAnti-spam → TextJob discussions, sales and industry topics the group allows
The same site, channel or invitation typeAnti-spam → LinksOfficial resources, member mentions and subdomains
Reposted promotions from outside sourcesAnti-spam → ForwardsApproved sources and forwards with hidden authors

This is a selection guide, not a report of tested classifier results. The group's policy still determines what should be allowed.

Stop words: target the pitch, not the whole subject

If a recurring promotion says “guaranteed daily profit, message me,” blocking the word “work” is unnecessarily broad. It could remove an ordinary employment question without establishing why that question breaks the rules.

In the custom stop-word mode, a rule such as "guaranteed daily profit" && "message me" requires both phrases in one message. It remains a text condition: “Beware of posts saying ‘guaranteed daily profit, message me’” also contains both phrases. Quotation marks and a warning intent do not automatically exempt the message.

Defendy offers exact, partial and custom matching. The matching method is shared across the group, while lists can have different consequences. Short fragments in partial mode can catch unrelated text, and the custom syntax is not an arbitrary regular-expression field. Start with a small explainable list and use the stop-word guide before importing a large dictionary.

Text anti-spam: strictness is not an accuracy score

Open Anti-spam → Text. The current controls include Lenient, Standard and Strict and a member action. Deletion is a separate saved consequence; the current Text screen has no dedicated deletion switch. The implementation combines built-in text patterns with a local classification model.

Increasing strictness lowers the trigger threshold for part of the model's decisions. It does not guarantee better understanding of your community. A group about recruitment, trading or cryptocurrency especially needs tests containing legitimate discussion of those subjects. Use the actual languages your members write in rather than assuming one language's examples establish another's performance.

A built-in pattern match or a high local-model score can trigger moderation without additional AI verification. Enabling AI therefore does not make it an appeal stage for every mistaken deletion. If a known-good message keeps disappearing, identify the triggering reason rather than only adjusting strictness.

What automatic AI verification actually covers

The AI spam check switch is inside text anti-spam. It enables an additional automatic check for eligible messages. The separate manual /spam workflow has a different purpose and settings.

The automatic path depends on several conditions:

  • Text anti-spam and its AI check are enabled.
  • The AI service is configured and available on the service side.
  • The local model places the text in its uncertain range: a score of at least 0.10 and below 0.80.
  • The text contains at least 10 characters.
  • The member is not considered trusted and meets the active newcomer restriction.

In the current Mini App, New members only is a disabled control. The Newbie period selector offers 3, 7, 14 or 30 days. Do not expect to turn that disabled switch off to check everyone. The window is counted from Defendy’s first stored observation for this check, not the actual Telegram join time. An existing member without a record can therefore qualify too.

The automatic implementation sends up to the first 300 characters of the checked text, together with the group title, to the configured model provider. It does not provide the whole conversation. Context later in a long message may be missing. The external transmission also matters for the group's privacy expectations and rules.

If AI is unavailable, returns an unusable result, or is not applicable to the member, the decision falls back to the local strictness threshold. Within that range, the thresholds are 0.65 for Lenient, 0.55 for Standard and 0.45 for Strict. These are internal model scores, not measured accuracy percentages. An AI failure does not mean every message is retained or automatically sent to a human review queue.

In Links, first check that the filter itself is enabled. External links and Telegram links each have their own mode:

  • Ignore: that category is not blocked by its mode.
  • Blacklist: listed prohibited destinations trigger the mode.
  • Delete: destinations outside the whitelist trigger it, subject to other exceptions and special link types.

The mode label Delete and the saved message-deletion setting are different parts of the configuration. The current Links screen has no dedicated deletion switch. Check the member action separately and verify what actually happens to a matching test message; that one mode label does not establish every consequence.

An allowed domain is not an exemption from all moderation. Stop words or text anti-spam can still reject a message that contains it. The current list comparison is case-insensitive but exact: allowing example.com does not automatically allow help.example.com.

Invitation links and group quotes have special handling. Where their detection and blocking apply, the ordinary whitelist is not a universal override. Popular-site and IP-address exceptions can also change results, so review them before testing a blacklist entry.

Do not build a policy around “allow people mentions, block channel mentions” using the mention-permission switch: the current interface marks it as forthcoming and disables it. Test genuine member mentions separately before broadly restricting Telegram links.

Forwards: test the real source and format

Forwards has settings for channels, groups, users, bots and hidden users. Each type has its own enabled state, deletion, action and additional options. Source whitelists and blacklists are shared across this section.

Allow a specific verified source when your rules permit its posts, but test an actual forward from it. A name entered into a list is not evidence that every forward will match. Some authors are hidden, while manually copied text is not a forwarded message at all and reaches other checks.

Review Allow first message and the self-forward exception where available. These options change the boundary of the restriction. The media-filtering setting can change coverage too; test text and media forwards separately. A problem with one advertising channel does not automatically justify banning every kind of forward.

Separate deletion from penalties

The action None disables the filter’s selected punishment, such as a warning, mute or ban. It does not disable the saved message-deletion setting. A matching message can still disappear, and separately configured automatic reputation deductions may still apply when deletion is enabled. Likewise, turning deletion off does not cancel a configured mute or warning.

Use a test group and None for the initial member action. If the test is specifically about removal, check the saved deletion behaviour and send only prepared examples. Sections with a deletion switch let you change it separately; the Text and Links screens do not provide that control. Before adding warnings, inspect the warning system: accumulated points can trigger an existing restriction. A warning is not a harmless observation marker when an escalation threshold is active.

In the current moderation chain, the first matching filter stops further checks. Do not assume the message receives every configured penalty, or that AI will inspect it after link filtering has already triggered. For diagnosis, test one layer at a time and record the actual reason.

Build a test set before using the production group

Include a prohibited pitch, a rewritten version, a legitimate discussion of the same subject, a warning quoting the pitch, an official URL, a subdomain URL, a normal member mention and an approved forward. Write down the intended policy decision for each before sending it.

Use an ordinary member without moderator immunity. The current processing path skips administrator messages, so “I posted it myself and nothing happened” is not evidence that the filter is broken. Compare the intended decision, reported reason, deletion and penalty separately.

After rollout, review disputed removals and missed violations rather than just the deletion count. A large count may reflect useful protection or an overbroad rule. Run newly added phrases and stricter settings against the same legitimate-message set.

Recover from mistakes and investigate misses

If a legitimate message is removed, pause the offending rule or its harsh consequence, preserve any available context and investigate the reason. Editing the list does not automatically restore deleted text or undo a warning, mute or ban already applied. Check those consequences separately. Once the rule is corrected, the author may need to repost the permitted message.

If an advertisement remains, check the selected group, enabled state, exceptions, deletion permissions and the actual action result. Telegram's deleteMessage documentation imposes permission and message-age restrictions, including the usual requirement that a message be less than 48 hours old. Enabling a filter also does not launch a review of the entire history.

Members may see a message before removal, including in a notification. A promise that nobody will ever see advertising is not realistic. A better outcome is predictable handling of repeated violations, room for legitimate conversation, and a quick human route for correcting mistakes.

Reviewed on 5 October 2026 against Defendy's current code and interface. An implemented automatic AI path does not establish that it is enabled for a particular group or that its provider is available at any given moment.