Skip to content

Commit

Permalink
docs: add create invite for on-chain groups
Browse files Browse the repository at this point in the history
  • Loading branch information
waddaboo committed Nov 29, 2024
1 parent 20705e8 commit a60b8de
Showing 1 changed file with 24 additions and 3 deletions.
27 changes: 24 additions & 3 deletions apps/docs/docs/tutorials/api-sdk/groups.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,15 +183,36 @@ const invite = await apiSdk.createInvite(groupId, apiKey)

You can wrap the invite code into a custom URL for your app, where it will handle the logic for adding a member to the group by invite code.

Here is an example of the custom URL structure.
Here is an example of the custom URL structure:

```
https://<custom-domain>?inviteCode=<invite-code>
```


#### Create invite for on-chain groups

You will have to create an associated off-chain group first in order to use the create invite feature for on-chain groups.

```ts
const apiKey = "your-api-key"
const groupName = "onchain-group-name"
const description = `This group is associated to the on-chain group ${groupName}`

const associatedGroup = await apiSdk.createGroup(
groupName,
description,
"on-chain",
16,
3600
)

const invite = await apiSdk.createInvite(associatedGroup.id, apiKey)
```

#### Get invite

Returns a specific invite along with the group details associated with the invite.
Returns a specific invite along with the group details associated to the invite.

```ts
const inviteCode = "INVITECODE"
Expand All @@ -206,7 +227,7 @@ Adds a member to a group using an invite code.

```ts
const groupId = "your-group-id"
const apiKey = "member-id-1"
const memberId = "member-id-1"
const inviteCode = "INVITECODE"

await apiSdk.addMemberByInviteCode(groupId, memberId, inviteCode)
Expand Down

0 comments on commit a60b8de

Please sign in to comment.