td icon indicating copy to clipboard operation
td copied to clipboard

messageChatAddMembers update not fired when user joins group via invite link (intermittent issue)

Open spencermayne opened this issue 6 months ago • 6 comments

Description

Environment:

  • Telegram app: Mobile app
  • Using TDLib with TypeScript bindings via tdl v8.0.1

Issue Summary: When users join a basic group created via createNewBasicGroupChat using an invite link, TDLib intermittently fails to emit the messageChatAddMembers update, despite the user successfully joining the group. It's unclear whether this is a TDLib issue or related to the Android/iOS Telegram apps.

Frequency: Intermittent - roughly 1 in 50 attempts (not consistently reproducible)

Steps to Reproduce:

  1. Create a new basic group using createNewBasicGroupChat
  2. Use the default invite link created with the group (same behavior occurs with links created via createChatInviteLink)
  3. Share invite link with a user
  4. User clicks the invite link in Telegram mobile app
  5. User clicks "Join" button
  6. Loading spinner appears and disappears
  7. User is not navigated to the group chat

Expected Behavior:

  • User should be navigated to the group chat after joining
  • TDLib should emit a messageChatAddMembers update
  • Group should appear in the user's chat list

Actual Behavior:

  • User successfully joins the group (confirmed as member)
  • No messageChatAddMembers update is fired by TDLib
  • User is not navigated to the group
  • Group does not appear in chat list initially
  • Clicking the invite link again navigates to the group (no join prompt) but group still missing from chat list

Additional Observations:

  • This occurs with both the default group invite link and links created via createChatInviteLink
  • If the user leaves the group and joins again, the messageChatAddMembers event typically fires correctly
  • The user does become a member of the group (verified)
  • The missing update prevents proper UI synchronization

Questions:

  1. Is this a known issue with TDLib or potentially related to the mobile Telegram apps?
  2. Are there known conditions that could prevent the messageChatAddMembers update from being emitted?
  3. Should there be additional fallback mechanisms to detect membership changes?

spencermayne avatar Jun 30 '25 10:06 spencermayne

messageChatAddMembers is a possible content of a service message. Service messages are sent by the server whenever appropriate. Any behavior regarding their presence is expected behavior. They are intended for users and there are no any guarantees about conditions when they are sent or when they are not sent.

Bot accounts must be used for all automatic tasks like detection of new users in a chat. Regular users never need to "detect" new chat members. Bots can receive "chat_member" updates, which can be used for this and many other purposes.

levlam avatar Jun 30 '25 11:06 levlam

Appreciate the quick response and clarification @levlam!

Just wanting to confirm; the strange behaviours that I see on the Android and iOS apps when I don't get this update coming through on my client is just a coincidence?

spencermayne avatar Jun 30 '25 13:06 spencermayne

What do you mean by "the strange behaviours that I see on the Android and iOS apps"?

levlam avatar Jun 30 '25 17:06 levlam

What do you mean by "the strange behaviours that I see on the Android and iOS apps"?

The normal behaviour when joining a group through the mobile app is as follows:

  1. Click the invite link, you are shown the drawer containing the group info, as well as a 'Join Group' button
  2. Click 'Join Group', button goes to loading state
  3. Loading finishes, drawer closes, I am navigated to the group
  4. Going back to my chat list, the group is visible

In this scenario, the update containing messageChatAddMembers is always emitted from my tdlib client

The strange behaviour I am referring to:

  1. Click the link, you are shown the drawer containing the group info, as well as a 'Join Group' button
  2. Click 'Join Group', button goes to loading state
  3. Loading finishes, drawer closes, I am not navigated to the group
  4. Going back to my chat list, the group is not visible
  5. Clicking on the invite link again navigates me to the group (no drawer shown)

In this scenario, the update containing messageChatAddMembers is never emitted from my tdlib client. Its also worth mentioning that after step 3, I am actually a member of the group.

spencermayne avatar Jul 01 '25 11:07 spencermayne

In this scenario, the update containing messageChatAddMembers is always emitted from my tdlib client

The message sending isn't guaranteed. There are many cases when it isn't sent.

In this scenario, the update containing messageChatAddMembers is never emitted from my tdlib client. Its also worth mentioning that after step 3, I am actually a member of the group.

You need to reproduce the issue with app logs enabled and check requests sent to the server and their responses to find the cause.

levlam avatar Jul 04 '25 19:07 levlam

Thanks

mgkaung239 avatar Aug 03 '25 23:08 mgkaung239