Appearance
Kind 9009: Group Invite Creation
Overview
This event is used to create an invitation code for a closed group. The invitation code can then be shared with specific users to allow them to join the group without requiring manual approval of their join request.
Specification
Property | Value |
---|---|
Kind Number | 9009 |
Event Range | Regular |
Defined in | NIP-29 |
Content Format
The content
field can contain an optional description or context for the invitation.
Schema
"optional description"
Tags
Tag Name | Description | Format | Required |
---|---|---|---|
h | Group identifier | ["h", "<group-id>"] | Yes |
code | Invite code | ["code", "<invite-code>"] | No |
limit | Usage limit | ["limit", "<number-of-uses>"] | No |
expires | Expiry timestamp | ["expires", "<unix-timestamp>"] | No |
previous | Timeline references | ["previous", "<event-id-prefix>"] | No, but recommended |
Client Behavior
Clients with appropriate permissions can send this event to create an invitation code for a closed group. The client should include the group ID in the h
tag and can optionally specify an invite code, usage limit, and expiry time.
If the code
tag is not provided, the relay will typically generate a random code.
Clients should include timeline references in the previous
tag to prevent messages from being used out of context.
Relay Behavior
Relays should validate that:
- The sender has the appropriate permissions to create invites for the group.
- The event contains a valid
h
tag with the group ID. - The timeline references in the
previous
tag, if present, refer to events in the relay's database.
If validation succeeds, the relay should:
- Generate an invite code if not provided in the event.
- Store the invite code along with any specified limitations (usage limit, expiry time).
- Allow users who provide this code in a kind 9021 join request to automatically join the group.
Use Cases
- Creating invitation links to share with specific individuals.
- Setting up limited-use invitations for special events or promotions.
- Implementing time-limited invitation windows for group enrollment periods.
Example
json
{
"id": "...",
"pubkey": "1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
"created_at": 1671217411,
"kind": 9009,
"tags": [
["h", "vegans-united"],
["code", "PIZZA2023"],
["limit", "10"],
["expires", "1672422000"],
["previous", "a1b2c3d4"]
],
"content": "Creating a limited-use invite code for our pizza making workshop participants",
"sig": "..."
}
References
Related Kinds
Notes
The event should only be accepted by relays if it comes from a user with appropriate permissions (e.g., a group admin with the capability to create invites).
The invite code can be used in conjunction with kind 9021 (join request) events, where users can include the code in the code
tag to gain automatic admission to closed groups.