Back to blog

Set up Telegram anti-spam step by step, with checks and a rollback plan

A practical Defendy walkthrough: connect a test group, verify logging, configure links and text, test CAPTCHA and introduce warnings without surprises.

Use a separate test group, a willing helper with an ordinary member account and a set of harmless messages. A successful setup means a prohibited example gets the action you intended, a legitimate example stays visible and you know how to correct a mistaken restriction. Watching a switch turn on is not enough.

This walkthrough follows Defendy's Mini App controls. You do not need every module: use the steps that solve your group's actual problem. If you have not yet decided what should be allowed, start with the anti-spam policy guide.

Prepare before adding the bot

Keep valuable conversation out of the test group. Tell your helper which messages may be deleted and whether you plan to test a challenge failure or a restriction. Make sure an administrator can restore the helper's access before trying either.

Do not assume a newly connected bot is passive. Defendy's current text-spam defaults enable the filter and message deletion, with None as the additional punishment. An existing group may have different saved settings. Inspect those values immediately after connecting, before posting test messages.

Write down the group name, enabled modules, modes, actions and exceptions. For a group you already manage, record the current values before editing them. This simple configuration note is your recovery reference; it does not need private conversations, member profiles or credentials.

1. Connect the group and verify authority

  1. Open @defendy_bot in a private chat and tap Start or send /start.
  2. Open Settings beneath the response or through the menu button beside the message field.
  3. Choose Connect group, select the test group and add Defendy as an administrator. If already connected, select it under My groups.
  4. Read the group name at the top of the Mini App. Repeat this check whenever you switch between the test and real groups.

Telegram permissions are configured in Telegram. Defendy settings do not grant the bot the authority to delete messages or restrict members. Review the corresponding rights. Telegram administrator-right definitions.

Defendy's current full-rights check can show a warning without blocking access to settings. An open settings screen therefore does not prove that every moderation action will succeed. Verify the rights for the functions you plan to use rather than granting unrelated authority merely to make a warning disappear. Bot-permission guide.

Do not try to reconfigure someone else's hosted bot through BotFather. Telegram documents a separate message-visibility rule for administrator bots, so disabling privacy mode is not a universal installation requirement. Telegram Bots FAQ.

Continue when: the intended group is selected, its settings load and the relevant rights are confirmed. If the group is missing or the settings page fails to load, use troubleshooting first.

2. Make the moderation log observable

Open Logging. Its setup wizard lets you add @defendy_logs_bot to a destination group or channel. A private moderator group is a useful place for the initial test.

Select the detected destination to start verification automatically. If it is missing, enter the chat ID manually and tap Check; add a topic ID only for a specific forum topic. After successful verification, tap Done. The check may send a test message.

Enable logging and the categories you need. For these exercises, that generally means filter and moderation events, plus member events when testing newcomer verification. Connecting a destination without enabling the relevant category will not give you the record you expect. Logging setup and categories.

Stop before stronger actions if: you cannot establish that a test record reaches the responsible moderator. Selected-event logging helps explain outcomes, but it is not a complete archive of everything happening in the group. Check the visible result in the group as well.

For a hypothetical training group, suppose web references are welcome but invitations to unrelated Telegram groups are prohibited. This is an example policy, not a universal recommendation.

Open Anti-spam → Links. In the test group, temporarily disable other filters you are evaluating and record that change so they do not obscure the result. Then:

  1. Enable the link filter.
  2. Set Websites to Ignore. This leaves website links outside this category's checks, although other enabled filters can still act on the message.
  3. Set Channels and chats to Delete.
  4. Inspect Exceptions. If the training group needs an official announcements channel, add that permitted destination through the relevant form and save it.
  5. Select None under punishment for the initial test. A matching link message can still be deleted; this choice avoids an additional punishment for its author.

The category modes are distinct. Delete applies the category's removal policy, taking exceptions into account. Blacklist targets listed unwanted destinations. Ignore leaves that category alone. A category mode is also separate from the main filter switch. Complete link-filter reference.

Send three harmless examples from the ordinary member account: a relevant website link, the permitted Telegram destination and a test-chat invitation that is not in the exceptions. Under this example policy, the first two should remain and the third should be removed without an additional restriction. Include a link embedded in display text if your members use that format.

If a result differs: stay on this step. Check the mode, exceptions, sender privileges, saved values and bot rights. Fix an incorrectly blocked useful destination, then rerun all three examples before adding another filter.

4. Test the text filter independently

Open Anti-spam → Text. The page contains the filter switch, Strictness Level, AI verification and punishment settings. Strictness options are Lenient, Standard and Strict; the schema's initial value is Standard. Choose based on the behavior of your examples, not the assumption that the strongest label is best.

Some controls appear only after the filter is enabled. This makes configuration an active change, not a harmless draft. In the test group, begin with no additional punishment and leave AI verification off while establishing a baseline. Use an invented promotional message without a link so the link rule does not explain the outcome.

There is no message-deletion switch on the current Text screen. With the standard saved defaults, a detected message is removed even when punishment is None. Warn is not an observation-only substitute: it can add points and activate a threshold. Text-filter behavior.

Alongside the promotional example, try an ordinary question, relevant discussion containing advertising-related words and a member quoting spam to ask for help. If useful text disappears, compare the less strict setting. Lower strictness does not guarantee that every individual detection rule stops matching; if the problem remains, pause that filter and investigate the example.

Automatic AI verification is a separate extension to this step. Its execution depends on configuration, eligibility and service availability. The current screen restricts that path to newcomers and offers a newcomer period of 3, 7, 14 or 30 days. That period does not impose a matching ban on posting or links. Also, do not treat a manual spam-check command as a guaranteed non-destructive testing tool. Manual and automatic AI checks.

5. Test CAPTCHA through the actual join route

If unwanted activity starts with new arrivals, open Captcha. Choose the mode, challenge type, timeout, attempts and failure action. In group and Join requests give members different journeys; the selected mode must match how people actually enter.

For an isolated training exercise, you could begin with a button challenge, five minutes and a kick on failure. Those are illustrative values, not a promise of the best configuration. Check that your helper has a usable way back into the group before deliberately allowing the timer to expire.

Run separate cases:

  • A newcomer completes the challenge and sends an ordinary message afterward.
  • A newcomer lets the challenge expire, receives the configured result and can follow your recovery instructions.
  • For a challenge with incorrect answers, the configured attempt limit behaves as expected.

Do not use unsuspecting real newcomers for failure tests. A timeout is a deadline for completing verification, not a setting that prevents every new member from speaking for the next day. CAPTCHA setup.

If the helper is still restricted after a successful attempt, stop and investigate before rollout. Making the timer longer will not fix missing authority or a different restriction that is still active.

6. Review the warning system before choosing Warn

Open Warnings first. Read the profile, thresholds, actions, durations and counter-reset period. Only then return to the relevant filter, select Warn and choose the event weight. The reverse order can feed an existing punishment ladder before you have reviewed it.

Here is a hypothetical policy calculation: three points trigger a one-hour mute, and this filter adds one point. A member already on two points reaches the restriction after one match. If the filter's weight is three, a single event may reach the same threshold. These are illustrative choices, not recommended settings for every community.

Using the consenting test account, inspect the counter before the event, its increase, the actual restriction and the duration. Practise correcting the counter and lifting the restriction as separate tasks. /unwarn removes one point, not necessarily the entire weight of an incident. /resetwarns clears the counter; it is not a universal undo for an existing mute or ban. Warning thresholds and recovery.

Avoid adding extra tiers just to explore the interface in the real group. Review every resulting action and duration in the test group, including any indefinite action. A preset's name alone cannot tell you whether its consequences fit your community.

Your acceptance check before rollout

Keep the observed result beside the saved configuration. The table defines what you should establish; it is not a report of tests already run on your group.

Release checks for your chosen moderation policy
CaseReady to proceedStop and investigate
Ordinary text and a useful linkRemain visible without warning pointsUseful content disappears
Prohibited test destinationReceives the intended actionNo action, or a harsher action than planned
A report quoting spamHas an acceptable outcome and a workable review routeThe reporter receives an unexplained restriction
CAPTCHA success and timeoutBoth outcomes and recovery are understoodNo one knows how to restore a legitimate person's access
Logs and persistence

The selected event arrives; reopening shows the intended settings

You cannot tell which configuration is active

Ordinary switches and selectors save when changed. Separate forms with Save require that button. After a failed request, reopen the section and inspect the stored value. If the app says a write succeeded but refreshing failed, check the data again rather than blindly submitting the write a second time.

Move one checked module into the real group

Switch groups and read the name again. Reproduce only the settings that passed your checks, beginning with one module. Enabling CAPTCHA, every content filter and automatic bans together will make any unexpected result difficult to diagnose.

Choose a period when a moderator can supervise the change. Tell the moderation team who handles appeals and which setting was changed. Inspect useful conversation as well as blocked content. Add the next module only after unexpected results from the current one have been resolved.

Keep this rollback sequence beside your configuration note:

  1. Disable the responsible rule or restore its recorded previous values.
  2. Confirm the change saved and rerun a legitimate example.
  3. Review the affected member's access and warning points separately.
  4. Explain the correction; deleted content may need to be posted again.
  5. Add the failure case to the test set before re-enabling the rule.

Turning off a filter stops future matches; it does not undo earlier consequences. Dedicated anti-flood and other Coming soon items are not available steps in this setup. If you need a posting interval, configure Telegram's own control separately rather than expecting a frequency counter in the text filter.

Sources and review date

Reviewed on October 5, 2026 against current Defendy Mini App screens, settings schemas and handlers. Product references appear beside the relevant steps; the linked Telegram primary sources cover platform authority and message visibility. This is a reproducible setup procedure, not a claim that tests or changes have been performed in your group.