Use cases of filtering
Filtering of forwarded messages allows you to automatically filter out messages from forwarding according to certain criteria, such as text, author, media and fwd header.
You can configure filters in one of two modes:
- Block all messages with the specified content.
- Allow only messages with the specified content.
Filters will be useful in the following scenarios:
- Parsing of chats, groups and channels to search for potential customers (leads) on the subject of your business. You can set up monitoring of a huge number of thematic chats and all requests and requests from users in your direction will be sent to you in real time automatically. You will only have to respond to the hot lead on his message with your offer.
- Blocking advertising posts from sources if you have a news aggregator.
- Collecting information only on a specific topic.
- Copying messages from groups of only certain users.
Creating a simple text filter
Before creating a filter, make sure that you already have the forwarding configured.
To create a filter, follow these steps:
- Go to the Filters page.
- Click Add.
- Select a Message as the Where to apply the filter. This option will apply a filter to the text of messages and buttons.
- Enter the Contents of the filter. The filter will be triggered if the specified content is located in the location selected in the previous step.
- As a filter action, select Block with content. This means that messages in which the specified content will be found will not be forwarded.
- If necessary, enter a Description - it does not affect anything and is needed solely for the convenience of the user.
- Click OK.
- In the list of your forwards that appears, select the forward in which the filter will be applied.
- Click OK.
- Edit the filter settings.
- Select other forwards for the filter.
- Duplicate the filter for later modification.
- Remove the filter.
Multiple filter with regular expression
The most common way to use regular expressions in filters is to list multiple words in one filter (instead of creating a separate filter for each word).
To enable support for regular expression syntax, you must put the appropriate check mark under the content field, after which the content entered in the field will be perceived by the service as a regular expression.
In this example, the filter will block all messages that contain at least one of the words: black, white or red.
Media filtering (photos, videos, etc.)
- photo
- document
- poll
- geo
- video
- voice
- audio
Filtering by the author of the message
Filtering messages by author can be extremely useful when forwarding chats and groups where messages can be sent by different people.
In order to filter messages by author, you must select Author in the Where field. In this case, the specified content will be searched in the name, ID, or username of the author of the messages.
In this example, the filter will block all messages from a user with ID 12312433 or with the name main_admin.
Filtering by FWD header
Forwarded messages always have an FWD header indicating the source of the message. The service allows you to filter similar messages sent from somewhere by this header.
In order to filter messages by FWD Header, you must select FWD Header in the Where field . In this case, the specified content will be searched specifically in the message header.
In this example, the filter will block all messages forwarded to the source and not forward them further.
Forwarding only with the specified content
Sometimes it is necessary to forward messages with only certain content, or from a certain author, or only with a certain type of media, and block all others.
For such a task, it is necessary to select as the action Allow with content.
In this example, only messages with photos will be forwarded, and all others will be skipped.
IMPORTANT
If multiple filters with the Allow action are applied to one forward that they will be applied to the message sequentially. In other words, for a message to be forwarded, it must contain every content from every filter with the Allow action.
If it is necessary to forward a message when it contains at least one of the allowed words, then this must be done within the same filter using a regular expression, as shown above: (word1|word2|word3)