Telegram Bots Anyone?

Idea for telegram bot — “welcome new users” summary

Here is an idea that you can build on top of.

I developed a simple Telegram bot that will send the list of new users once every few days in our community channel.

Channels are read-only in Telegram, i.e. like a news feed.

The bot will build a random “welcome” text like this:

Welcome our new users user1, user2, user3 and user4

Where user1, 2 etc are usernames of the newly registered users.

The bot keeps track of which users it announced already, so it does not repeat itself.


Implementation:

Use Longman\TelegramBot library.

Fetche new users by issuing a GET request to admin/users/list/new.json.

Filter out non-active users, admins, mods and blocked users.

Sending a message to a Telegram channel is then as simple as:

$telegram = new Telegram(TELEGRAM_BOT_AUTH_TOKEN);
        
$result = Request::sendMessage([
    'chat_id' => TELEGRAM_CHANNEL,
    'text' => $text
]);
3 Me gusta