Join group
Closed this issue ยท 3 comments
GroupManager#join(inviteLink: string): Promise<Group>
GroupManager#join(groupID: string, shareToken: string): Promise<Group>
Joins a group.
Can take either an invite URL, or a combination of group ID and share token as parameters.
Usage:
client.groups.join('https://groupme.com/join_group/27317261/ibNNhx')
client.groups.join('27317261', 'ibNNhx')
Invite links can take a number of forms depending on the client it was created with. The inviteLink
overload will need to take this into account.
@not-so-smart Do you have a list of the different forms the invite link can take?
Nope, I don't have a complete list but I know that generally invite URLs end with .../{groupID}/{shareToken}
.
I've also seen a very rare form of invite link which only had a share token and did not include the group ID -- I don't remember the exact format but it was only obtainable via an obscure email generated by GroupMe under certain circumstances. I'm not entirely sure how those invites work, it's possible that maybe that link is only useful for following it in a browser, which then GroupMe looks up the associated group ID and presents the browser with a landing page containing a "proper" invite URL which can then be used to accept the invite. That's just my theory though, this is certainly a topic which can either be researched further or completely ignored since 99.999% of use cases will follow the .../{groupID}/{shareToken}
format.
It might be worth noting in the JSDoc comments for this particular overload that it will attempt to parse the given string as an invite URL, but users are welcome to parse invites themselves and use the other overload instead if they want.
TL;DR if you don't want to spend a ton of effort on this, feel free to just parse the end of the string as .../{groupID}/{shareToken}
and ignore the rest of the link. If it fails then whatever, the user can parse the invite themselves.
๐ This issue has been resolved in version 2.5.0 ๐
The release is available on:
Your semantic-release bot ๐ฆ๐