A
A
agoge2017-10-06 15:37:02
JavaScript
agoge, 2017-10-06 15:37:02

INVITE_HASH_EXPIRED when opening invite link Telegram?

Greetings.
I use the library for node.js telegram-mtproto to work with the Telegram API via MTProto .

const params = JSON.parse(response);
// 1. Создаю приватный канал (не группу)
        const channel = await client('channels.createChannel',
          {
            "title": params.channel_title,
            "about": params.channel_title
          }
        );
        const inputChannel = {
          _: 'inputChannel',
          channel_id: +channel.chats[0].id,
          access_hash: channel.chats[0].access_hash
        }
// 2. Получаю данные бота по его имени
        const userBot = await client('contacts.resolveUsername', { username: process.env.TL_BOT_USERNAME });
// 3. Назначаю бота админом канала
        const update = await client('channels.editAdmin', {
          channel: inputChannel,
          user_id: {
            _: 'inputUser',
            user_id: +userBot.users[0].id,
            access_hash: userBot.users[0].access_hash
          },
          role: {
            _: 'channelRoleModerator'
          }
        });
// 4. Получаю инвайт линк на канал
        const channelLink = await client('channels.exportInvite', { channel: inputChannel });

I get an error when opening the link
Method: messages.checkChatInvite
Result: {"_":"rpc_error","error_code":400,"error_message":"INVITE_HASH_EXPIRED"}

Something goes wrong ((
I would be very grateful if you point out the error.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question