# Community Invitation

The community invitation system allows community moderators and administrators to invite users to join their communities. This feature provides a controlled way to grow community membership by extending personalized invitations to specific users.

#### Network-Level Membership Settings

Your network can be configured with different membership acceptance modes that affect how invitations work:

* **Automatic membership**: Invited users become members immediately upon invitation
* **Invitation acceptance**: Users must explicitly accept invitations to become members (provides user consent and control)

{% tabs %}
{% tab title="iOS" %}
{% embed url="<https://gist.github.com/amythee/bb39b0d4bdef72823a05815499e6b70b>" %}
{% endtab %}

{% tab title="Android" %}
{% embed url="<https://gist.github.com/abc3e32ec70e74048699e6cf78eb349f>" %}
{% endtab %}

{% tab title="TypeScript" %}
{% embed url="<https://gist.github.com/amythee/cf5c84b278cf24e1feea1fbdbda74fdd>" %}
{% endtab %}
{% endtabs %}

#### Invitation Types

**Direct Invitation**

* **Immediate membership**: User becomes a member instantly when invited (automatic membership mode)
* **No user action required**: Membership is activated without user intervention
* **Notification sent**: User receives notification about being added to the community

**Invitation with Acceptance**

* **User consent required**: User must accept the invitation to join (invitation acceptance mode)
* **Pending status**: Invitation remains pending until user responds
* **User control**: Users can accept or decline invitations

#### Invitation Process

When using invitation acceptance mode:

1. **Send Invitation**: Moderator sends invitation to specific user
2. **User Notification**: User receives invitation notification
3. **User Decision**: User can accept or decline the invitation
4. **Membership Activation**: Upon acceptance, user becomes community member
5. **Confirmation**: Both parties receive confirmation of membership

#### Managing Invitations

#### For Users

### Get My Community Invitations

The `getMyCommunityInvitations` function allows users to retrieve all their pending community invitations. This helps users see which communities they've been invited to join and manage their invitation responses.

{% tabs %}
{% tab title="iOS" %}
{% embed url="<https://gist.github.com/amythee/d04b70061ccb8503bcae3bdb40985979>" %}
{% endtab %}

{% tab title="Android" %}
{% embed url="<https://gist.github.com/a2b959509c2fdd1384f4acddf3475719>" %}
{% endtab %}

{% tab title="TypeScript" %}
{% embed url="<https://gist.github.com/amythee/ef082b6eb51da15ae7a1a34a4fb9a1f8>" %}
{% endtab %}
{% endtabs %}

#### Check Community Invitation Status

This function retrieves the current status of a community invitation. It helps users understand if their invitation is still pending, has been accepted, rejected, or canceled. Users can then take appropriate actions based on the status of their invitations.

Returns invitation status: 'pending', 'accepted', 'rejected' or 'cancelled'

{% tabs %}
{% tab title="iOS" %}
{% embed url="<https://gist.github.com/amythee/7c73a108ac2261160264e21fd1029ce0>" %}
{% endtab %}

{% tab title="Android" %}
{% embed url="<https://gist.github.com/983570a0299643c628638f8aea4c86bc>" %}
{% endtab %}

{% tab title="TypeScript" %}
{% embed url="<https://gist.github.com/amythee/9c5e0c5147a9e0e23a0803b9b6244b97>" %}
{% endtab %}
{% endtabs %}

### Accept Invitation

The `acceptInvitation` function allows users to accept pending community invitations. This function is only relevant when the network is configured for invitation acceptance mode.

{% tabs %}
{% tab title="iOS" %}
{% embed url="<https://gist.github.com/amythee/fd65a05eaddeb6f151013f7b2568b4ac>" %}
{% endtab %}

{% tab title="Android" %}
{% embed url="<https://gist.github.com/278e23e23cc6231c9e020200df4ee815>" %}
{% endtab %}

{% tab title="TypeScript" %}
{% embed url="<https://gist.github.com/amythee/641b8a907440000cfa84067b801d800b>" %}
{% endtab %}
{% endtabs %}

### Decline Invitation

The `declineInvitation` function allows users to decline pending community invitations.

{% tabs %}
{% tab title="iOS" %}
{% embed url="<https://gist.github.com/amythee/4e51c3ea569f3b71197a4450e284f6ed>" %}
{% endtab %}

{% tab title="Android" %}
{% embed url="<https://gist.github.com/50c797b72361e43379c39bfb8d0b1d18>" %}
{% endtab %}

{% tab title="TypeScript" %}
{% embed url="<https://gist.github.com/amythee/bfe19705ca8090b52d5edb3b09f79ca0>" %}
{% endtab %}
{% endtabs %}

#### For Moderators

#### Send Invitation

Moderators can send invitations to users to join the community:

{% tabs %}
{% tab title="iOS" %}
{% embed url="<https://gist.github.com/amythee/ad837f9c1e5e7c7b32a4eec67073b5c3>" %}
{% endtab %}

{% tab title="Android" %}
{% embed url="<https://gist.github.com/463bc1a3410258906c5dfe85cb9d3f9f>" %}
{% endtab %}

{% tab title="TypeScript" %}
{% embed url="<https://gist.github.com/amythee/96453667060984af798907fd6789dad1>" %}
{% endtab %}
{% endtabs %}

**Get Sent Invitations**

Moderators can view all invitations they've sent:

{% tabs %}
{% tab title="iOS" %}
{% embed url="<https://gist.github.com/amythee/d723ee9b6f818df288b8f4cc320454a0>" %}
{% endtab %}

{% tab title="Android" %}
{% embed url="<https://gist.github.com/c5f7bf5e8045685a602f3c19b6ccdc22>" %}
{% endtab %}

{% tab title="TypeScript" %}
{% embed url="<https://gist.github.com/amythee/e27c81f08a6f16848a7486f8fb8b0c5f>" %}
{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.social.plus/social-plus-sdk/social/communities/community-invitation.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
