# Join/Leave Community

## Join Community

The `join()` function works by adding the active user as a member of the specified community. By becoming a member of a community within your app, users can connect with like-minded individuals and build deeper relationships within the community.&#x20;

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

{% tab title="Android" %}
{% embed url="<https://gist.github.com/amythee/630f229a7fd7196f24bc165d2f5f59c5#file-amitycommunityjoin-kt>" %}
{% endtab %}

{% tab title="JavaScript" %}
{% embed url="<https://gist.github.com/amythee/780c0b61e4a8d3f5c0a25c09e2e8273e#file-joincommunity-js>" %}
{% endtab %}

{% tab title="TypeScript" %}
{% embed url="<https://gist.github.com/amythee/fa4bd7be302f34eccbf98801d5d26c5b#file-joincommunity-ts>" %}
{% endtab %}

{% tab title="Flutter" %}
{% embed url="<https://gist.github.com/amythee/f60a5504a5be1b390bc125f515444fc9#file-amitycommunityjoin-dart>" %}
{% endtab %}
{% endtabs %}

## Network-Level Membership Settings

Your network can be configured with different membership acceptance modes:

* Automatic membership (default): Users become members immediately when added
* Invitation acceptance: Users receive an invitation and must explicitly accept before joining

## Community Types and Join Behavior

### Public Communities

* Doesn't require approval: Users can join immediately by calling `joinCommunity`
* **Requires approval**: Users must submit a join request and wait for moderator approval

### Private & Visible Communities

* Discoverable in search and explore pages
* Content is hidden from non-members
* Typically requires moderator approval to join

### **Private & Hidden Communities**

* Not discoverable by non-members
* Content is hidden from non-members
* Requires moderator approval to join

To join a community, you simply need to call `join()` method present in Community object. If a community requires moderator approval, the join process creates a request instead of immediate membership:

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

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

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

### Managing Join Requests

#### For Users

**Check Join Request Status**

Users can check the status of their submitted join requests:

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

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

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

{% endtab %}
{% endtabs %}

**Cancel Join Request**

Users can cancel pending join requests:

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

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

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

{% endtab %}
{% endtabs %}

#### For Moderators

**Get Pending Requests**

Moderators can retrieve all pending join requests for their communities:

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

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

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

Approve Join Request

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

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

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

Reject Join Request

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

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

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

## Leave Community

The `leaveCommunity` function works by removing the active user as a member of the specified community. This removes the user's access to the community feed and disables their ability to post messages or participate in community discussions. To leave a community, you simply need to pass the specific community ID as a parameter of the `leaveCommunity` function.

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

{% tab title="Android" %}
{% embed url="<https://gist.github.com/amythee/24d739ed747bcf54b00db1ed1d99f4ee#file-amitycommunityleave-kt>" %}
{% endtab %}

{% tab title="JavaScript" %}
{% embed url="<https://gist.github.com/amythee/4d5c555edfb8d0bbeba60fd530d7eeee#file-leavecommunity-js>" %}
{% endtab %}

{% tab title="TypeScript" %}
{% embed url="<https://gist.github.com/amythee/ae5a91de54e1221c2a992a61dba9bb78#file-leavecommunity-ts>" %}
{% endtab %}

{% tab title="Flutter" %}
{% embed url="<https://gist.github.com/amythee/2327681b1e0674e477fe1967bdbbaa57#file-amitycommunityleave-dart>" %}
{% 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/join-leave-community.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.
