# Social Interactions

Enable social features to enhance player engagement by allowing them to share, join communities, invite friends, and more.

#### Share <a href="#share" id="share"></a>

Use this to allow players to share game content or achievements on social media platforms.

```gdscript
Bridge.social.is_share_supported
```

Check if the share feature is supported on the platform.

{% tabs %}
{% tab title="Godot 3.x" %}

```gdscript
func _ready():
    var options

    match Bridge.platform.id:
        "vk":
            options = {
                "link": "YOUR_LINK"
            }
        "facebook":
            options = {
                "image": "A base64 encoded image to be shared", 
                "text": "A text message to be shared"
            }
        "msn":
            options = {
                "title": "A title to display",
                "image": "A base64 encoded image or image URL to be shared", 
                "text": "A text message to be shared"
            }

    Bridge.social.share(options, funcref(self, "_on_share_completed"))

func _on_share_completed(success):
    print(success)
```

{% endtab %}

{% tab title="Godot 4.x" %}

```gdscript
func _ready():
    var options

    match Bridge.platform.id:
        "vk":
            options = {
                "link": "YOUR_LINK"
            }
        "facebook":
            options = {
                "image": "A base64 encoded image to be shared", 
                "text": "A text message to be shared"
            }
        "msn":
            options = {
                "title": "A title to display",
                "image": "A base64 encoded image or image URL to be shared", 
                "text": "A text message to be shared"
            }

    Bridge.social.share(options, Callable(self, "_on_share_completed"))

func _on_share_completed(success):
    print(success)
```

{% endtab %}
{% endtabs %}

#### Join Community <a href="#join-community" id="join-community"></a>

Enable players to join social communities related to your game, enhancing engagement and loyalty.

```gdscript
Bridge.social.is_join_community_supported
```

Check if the join community feature is supported on the platform.

{% tabs %}
{% tab title="Godot 3.x" %}

```gdscript
func _ready():
    var options

    match Bridge.platform.id:
        "vk":
            options = {
                "groupId": YOUR_GROUP_ID
            }
        "ok":
            options = {
                "groupId": YOUR_GROUP_ID
            }
        "facebook":
            # if isPage = true, invite to page, else invite to group
            options = {
                "isPage": true
            }

    Bridge.social.join_community(options, funcref(self, "_on_join_community_completed"))

func _on_join_community_completed(success):
    print(success)
```

{% endtab %}

{% tab title="Godot 4.x" %}

```gdscript
func _ready():
    var options

    match Bridge.platform.id:
        "vk":
            options = {
                "groupId": YOUR_GROUP_ID
            }
        "ok":
            options = {
                "groupId": YOUR_GROUP_ID
            }
        "facebook":
            # if isPage = true, invite to page, else invite to group
            options = {
                "isPage": true
            }

    Bridge.social.join_community(options, Callable(self, "_on_join_community_completed"))

func _on_join_community_completed(success):
    print(success)
```

{% endtab %}
{% endtabs %}

#### Invite Friends <a href="#invite-friends" id="invite-friends"></a>

Allow players to invite their friends to play the game, helping to grow your player base organically.

```gdscript
Bridge.social.is_invite_friends_supported
```

Check if the invite friends feature is supported on the platform.

{% tabs %}
{% tab title="Godot 3.x" %}

```gdscript
func _ready():
    var options

    match Bridge.platform.id:
        "ok":
            options = {
                "text": "Hello World!"
            }
        "facebook":
            options = {
                "image": "A base64 encoded image to be shared", 
                "text": "A text message to be shared"
            }

    Bridge.social.invite_friends(options, funcref(self, "_on_invite_friends_completed"))

func _on_invite_friends_completed(success):
    print(success)
```

{% endtab %}

{% tab title="Godot 4.x" %}

```gdscript
func _ready():
    var options

    match Bridge.platform.id:
        "ok":
            options = {
                "text": "Hello World!"
            }
        "facebook":
            options = {
                "image": "A base64 encoded image to be shared", 
                "text": "A text message to be shared"
            }
    Bridge.social.invite_friends(options, Callable(self, "_on_invite_friends_completed"))

func _on_invite_friends_completed(success):
    print(success)
```

{% endtab %}
{% endtabs %}

#### Create Post <a href="#create-post" id="create-post"></a>

Use this to let players create posts about their achievements or updates directly from the game.

```gdscript
Bridge.social.is_create_post_supported
```

Check if the create post feature is supported on the platform.

{% tabs %}
{% tab title="Godot 3.x" %}

```gdscript
func _ready():
    var options

    match Bridge.platform.id:
        "ok":
            options = {
                "media":[
                    {
                        "type": "text",
                        "text": "Here you can see odnoklassniki API docs(click the link)"
                    },
                    {
                        "type": "link",
                        "url": "https://apiok.ru"
                    },
                    {
                        "type": "poll",
                        "question": "Do you like our API?",
                        "answers": [
                            { "text": "Yes" },
                            { "text": "No" }
                        ],
                        "options": "SingleChoice,AnonymousVoting"
                    }
                ]
            }

    Bridge.social.create_post(options, funcref(self, "_on_create_post_completed"))

func _on_create_post_completed(success):
    print(success)
```

{% endtab %}

{% tab title="Godot 4.x" %}

```gdscript
func _ready():
    var options

    match Bridge.platform.id:
        "ok":
            options = {
                "media":[
                    {
                        "type": "text",
                        "text": "Here you can see odnoklassniki API docs(click the link)"
                    },
                    {
                        "type": "link",
                        "url": "https://apiok.ru"
                    },
                    {
                        "type": "poll",
                        "question": "Do you like our API?",
                        "answers": [
                            { "text": "Yes" },
                            { "text": "No" }
                        ],
                        "options": "SingleChoice,AnonymousVoting"
                    }
                ]
            }

    Bridge.social.create_post(options, Callable(self, "_on_create_post_completed"))

func _on_create_post_completed(success):
    print(success)
```

{% endtab %}
{% endtabs %}

#### Add to Favorites <a href="#add-to-favorites" id="add-to-favorites"></a>

Allow players to bookmark your game for easy access in the future.

```gdscript
Bridge.social.is_add_to_favorites_supported
```

Check if the add to favorites feature is supported on the platform.

{% tabs %}
{% tab title="Godot 3.x" %}

```gdscript
func _ready():
    Bridge.social.add_to_favorites(funcref(self, "_on_add_to_favorites_completed"))

func _on_add_to_favorites_completed(success):
    print(success)
```

{% endtab %}

{% tab title="Godot 4.x" %}

```gdscript
func _ready():
    Bridge.social.add_to_favorites(Callable(self, "_on_add_to_favorites_completed"))

func _on_add_to_favorites_completed(success):
    print(success)
```

{% endtab %}
{% endtabs %}

#### Add to Home Screen <a href="#add-to-home-screen" id="add-to-home-screen"></a>

Enable players to add a shortcut to your game on their home screen for quick access.

```gdscript
Bridge.social.is_add_to_home_screen_supported
```

Check if the add to home screen feature is supported on the platform.

{% tabs %}
{% tab title="Godot 3.x" %}

```gdscript
func _ready():
    Bridge.social.add_to_home_screen(funcref(self, "_on_add_to_home_screen_completed"))

func _on_add_to_home_screen_completed(success):
    print(success)
```

{% endtab %}

{% tab title="Godot 4.x" %}

```gdscript
func _ready():
    Bridge.social.add_to_home_screen(Callable(self, "_on_add_to_home_screen_completed"))

func _on_add_to_home_screen_completed(success):
    print(success)
```

{% endtab %}
{% endtabs %}

#### Rate the Game <a href="#rate-the-game" id="rate-the-game"></a>

Encourage players to rate your game, providing valuable feedback and improving visibility.

```gdscript
Bridge.social.is_rate_supported
```

Check if the rate the game feature is supported on the platform.

{% tabs %}
{% tab title="Godot 3.x" %}

```gdscript
func _ready():
    Bridge.social.rate(funcref(self, "_on_rate_completed"))

func _on_rate_completed(success):
    print(success)
```

{% endtab %}

{% tab title="Godot 4.x" %}

```gdscript
func _ready():
    Bridge.social.rate(Callable(self, "_on_rate_completed"))

func _on_rate_completed(success):
    print(success)
```

{% endtab %}
{% endtabs %}

#### External Links <a href="#external-links" id="external-links"></a>

Allow players to follow links to external websites, such as your game’s official site or related resources.

```gdscript
Bridge.social.is_external_links_allowed
```

Check if external links are allowed on the platform.


---

# 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://wiki.playgama.com/playgama/sdk/engines/godot/social-interactions.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.
