Chat request (Telegram)

Chat request event allows you to process requests automatically. It sends a screen or message when a user submits an request to join a closed group / channel via an invitation link.

The event is triggered no matter whether the user has been accepted into the group/channel or not, even if the user has never written to the bot before.

Setting up automatic acceptance/rejection of requests via Chat request event and the Approve or Decline the join request component

1. Create a private group / channel.

2. Add the bot to the administrators of the group / channel (Group Settings → Add a member).

The bot must have all administrator rights and permissions. If the status of the administrator did not appear to the bot when it was added to the group automatically, it is necessary to appoint the bot as an administrator manually.

3. Write to the group on behalf of the bot.

If the bot has not written to the group automatically, then in the settings of the admin bot, open the Information → Groups section and select the group to which the bot has been added. Write /start to the group.

Or you can just write a message to the group like this: /start@admin_bot_name.

4. Add the Approve or Decline the join request component to the screen and choose what it will do — accept or reject requests.

If necessary, you can add two components in a row — one marked Approve, the other marked Decline. One of the two components will work for the user, depending on the presence/absence of the variables being checked. User variables can be checked using a Calling condition.

5. Add the group / channel ID or the group/channel username to the component.

The group ID will appear in Users section after the bot is added to the group and a message from the bot is sent to this group.

To get the channel ID in Telegram, you need to open the channel in the web version. There will be a number at the end of the address bar - this is a channel id. At the beginning of this number add: -100, i.e. if the address bar of the web version displays

web.telegram.org/a/#-2234567899

then in the Telegram ID field you need to enter: -1002234567899.

6. If necessary, add screens for a successful response and for an error.

The screen for a successful response will work if the component is working correctly:

  • If, with Approve function selected, the request is accepted and the user receives a successful response screen, the component works correctly.
  • If, with Decline function selected, the component rejects the request, the user receives a successful response screen, the component works correctly.

7. In the Settings, create an Chat request event. In Action, specify Type — Screen on which the Approve or Decline the join request component is already set up.

8. Generate an invitation link for the user.

Through the usual link to the group / channel taken from the information, the user immediately enters the channel / group without prior approval or rejection of the application. Therefore, you need to create a special invitation link. To generate a link, click on the avatar in the group header, then click on “Edit” and create an invitation link in the settings section that opens.

Now, if the user follows the invitation link to the group / channel and submits an Entry Requestin the window that opens, then the specified screen will come to him in the dialog with the bot and the request will be rejected / accepted by the bot automatically.

If a screen is set for a successful and unsuccessful response, then the user will receive a screen depending on the result.

Setting up automatic acceptance/rejection of requests via the Chat request event, Approve or Decline the join request component and Calling condition

Requests can be accepted together using a Calling condition.

For example, the bot needs to accept users who indicated during the survey that they are over 16 years old. Requests from users who answered that they are under 16 years old will be rejected automatically.

In order for such a scenario to work, you need:

  • Ask the user for the age and write it to a variable.
  • Add Approve or Decline the join request component. In the component settings, add Calling condition template that checks the user's age.
  • Create Chat request event.

We design the screens in the builder:

1. Create a screen and add Message component to it — so we will ask the user his age.

2. Write the age to age variable using User Input.

3. Add two consecutive components to Approve or Decline the join request with the ID of our group. One component will approve requests, the other will reject them.

4. In the component that will accept requests, we add a conditional template for checking for age — {{gte (toInt age) 16}}.

In the component rejecting requests, we leave the conditional template empty.

5. Add Chat request event, configured on the screen with the user's request and the Approve or Decline the join request components. Make a save.

Now, before automatically adding / rejecting a user to a group, the bot will ask him about his age, then automatically add to the group only those who answered that he was over 16 years old.

You can separate users using a conditional template either by age or by any other principle.

Setting up manual acceptance/rejection of requests via the Chat request event

If the event is set to a screen in which there is no Approve or Decline the join request component, then the event will also work, but the requests will be processed manually by the channel/group administrator.

To set up such an event, you need to do the following steps:

1. Create a private group / channel.

2. Add the bot to the administrators of the group / channel and write a message to the group / channel on behalf of the bot. The bot must have all administrator rights and permissions.

3. Add Chat request event, which should specify the screen or text that will come to the user.

4. Generate an invitation link for the user.

5. Send such a link to the user. The user will click on the link and submit an request in the Telegram window that opens.

6. After that, the user will receive a message or a screen set up in the event, even if he has never written to the bot.

At this time, a user will send a request to join our closed group / channel. The request will be visible only in the group itself. You need to accept or reject the request manually.

To the beginning ↑