# Filtering forwarded messages

Language: en
Canonical: <https://flowin.click/en/articles/filtering-forwarded-messages>
Published: 2024-06-22T09:44:09+01:00
Modified: 2024-06-22T09:44:16+01:00

## 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](<https://flowin.click/posts/telegram-messages-forwarding/>).

To create a filter, follow these steps:

![en\_filter\_add](<https://flowin.click/wp-content/uploads/2024/06/en_filter_add.webp>)

1. Go to the **Filters** page.
2. Click **Add**.

![filter simple text](<https://flowin.click/wp-content/uploads/2024/06/en_filter_simple_text.webp>)

3. Select a **Message** as the **Where** to apply the filter. This option will apply a filter to the text of messages and buttons.
4. 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.
5. As a filter action, select **Block with content**. This means that messages in which the specified content will be found will not be forwarded.
6. If necessary, enter a **Description** - it does not affect anything and is needed solely for the convenience of the user.
7. Click **OK**.

![filter select forward](<https://flowin.click/wp-content/uploads/2024/06/en_filter_select_forward.webp>)

8. In the list of your forwards that appears, select the forward in which the filter will be applied.
9. Click **OK**.

![filter menu](<https://flowin.click/wp-content/uploads/2024/06/en_filter_menu.webp>)

After successful creation, the filter will be displayed in the list. Now messages that fall under the filter will not be forwarded (in this case, all messages that contain the word ad). If necessary, by clicking on the gear, you can:

- Edit the filter settings.
- Select other forwards for the filter.
- Duplicate the filter for later modification.
- Remove the filter.

## Multiple filter with regular expression

Regular expressions are text templates that allow you to search for certain lines in the text according to specified conditions (numbers, links, words and other patterns), which opens up incredible possibilities for configuring filters.   
  
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).

![filter regexp](<https://flowin.click/wp-content/uploads/2024/06/en_filter_regexp.webp>)

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.)

![filter media](<https://flowin.click/wp-content/uploads/2024/06/en_filter_media.webp>)

In order to filter messages with media, it is necessary to select **Media ** in the ** Where** field. In this case, the specified content will be searched in the name, type and extension of the media attached to the message. The following types can be used:

- photo
- document
- poll
- geo
- video
- voice
- audio

 In this example, the filter will block all messages with photos and videos, skipping all others.

## Filtering by the author of the message

![filter author](<https://flowin.click/wp-content/uploads/2024/06/en_filter_author.webp>)

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

![fwd заголовок пересланного сообщения](<https://flowin.click/wp-content/uploads/2023/10/fwd-header-ru.webp>)

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.

![filter fwd header](<https://flowin.click/wp-content/uploads/2024/06/en_filter_fwd_header.webp>)

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

![filter allow media](<https://flowin.click/wp-content/uploads/2024/06/en_filter_allow_media.webp>)

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)*
