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 →
  • Setting up manual acceptance/rejection of requests →

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 Accept, the other marked Reject. 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 Conditional Template.

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

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

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 Accept function selected, the request is accepted and the user receives a successful response screen, the component works correctly.

If, with Reject function selected, the component rejects the request, the user receives a successful response screen, the component works correctly.

7. In the Settings, create an Entry Request event. In Action, specify Type — Screen on which the Accept/Reject request component is already set up.

8. Generate an invitation link for the user.

Via the usual link to the group / channel taken from the information, the user immediately gets there without prior approval or rejection of the request. Create a special invitation link.

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 Entry Request event, Accept or Reject request component and Conditional template

Requests can be accepted together using a Conditional Template.

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 Accept or Reject request component. In the component settings, add Conditional template that checks the user's age.

Create Entry Request event.

We design the screens in the constructor:

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 Accept or reject the 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 Entry Request event, configured on the screen with the user's request and the Accept or Reject 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 Entry Request event

If the event is set to a screen in which there is no Accept or Reject 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 Entry 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.