> ## Documentation Index
> Fetch the complete documentation index at: https://cometchat-22654f5b-docs-audit-content-webhooks.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Setup

> Install the CometChat plugin in your Unreal Engine project.

## Get your Application Keys

[Sign up for CometChat](https://app.cometchat.com) and then:

1. Create a new app
2. Head over to the **API & Auth Keys** section and note the **Auth Key**, **App ID**, and **Region**

***

## Prerequisites

<Tip>
  **Minimum Requirements**

  * Unreal Engine **5.5.4** or **5.7.2**
  * C++ development tools for your platform
  * CometChat account with App ID, Auth Key, and Region
</Tip>

### Supported Platforms

| Engine Version | Platforms                  |
| -------------- | -------------------------- |
| UE 5.5.4       | Mac, Windows, iOS, Android |
| UE 5.7.2+      | Mac, Windows, iOS, Android |

***

## Install the Plugin

### Option 1: Use Precompiled Binaries (No Build Required)

<Steps>
  <Step title="Copy the plugin source">
    Copy `Plugins/CometChatSdk/` from the [SDK repository](https://github.com/cometchat/chat-sdk-unreal/tree/v1) into your project's `Plugins/CometChat/` directory.
  </Step>

  <Step title="Download precompiled binaries">
    Download the precompiled binaries for your engine version:

    <Tabs>
      <Tab title="UE 5.5 (Mac + Windows)">
        ```bash theme={null}
        curl -1sLf -O 'https://dl.cloudsmith.io/public/cometchat/cometchat/raw/versions/1.0.0-beta.2/CometChat-UE5.5-precompiled.zip'
        ```
      </Tab>

      <Tab title="UE 5.7 (Mac)">
        ```bash theme={null}
        curl -1sLf -O 'https://dl.cloudsmith.io/public/cometchat/cometchat/raw/versions/1.0.0-beta.2/CometChat-UE5.7-precompiled.zip'
        ```
      </Tab>
    </Tabs>
  </Step>

  <Step title="Extract into your plugin directory">
    Extract the zip contents into your project's `Plugins/CometChat/` directory (merging with existing files).
  </Step>

  <Step title="Enable the plugin">
    Add the plugin to your `.uproject` file:

    ```json theme={null}
    {
      "Plugins": [
        {
          "Name": "CometChat",
          "Enabled": true
        }
      ]
    }
    ```
  </Step>

  <Step title="Open your project">
    Open your project in Unreal Editor — no compilation needed.
  </Step>
</Steps>

Your project structure should look like this:

```
YourProject/
├── Plugins/
│   └── CometChat/
│       ├── CometChat.uplugin
│       ├── Source/
│       ├── Config/
│       └── ThirdParty/chatsdk/    ← Prebuilt static libraries (all platforms)
├── Source/
└── YourProject.uproject
```

***

### Option 2: Build from Source

1. Copy `Plugins/CometChatSdk/` from the [SDK repository](https://github.com/cometchat/chat-sdk-unreal/tree/v1) into your project's `Plugins/CometChat/` directory
2. Regenerate project files and build

***

## Add Module Dependency

In your game module's `.Build.cs` file, add the `CometChat` module as a dependency:

```csharp theme={null}
using UnrealBuildTool;

public class YourGame : ModuleRules
{
    public YourGame(ReadOnlyTargetRules Target) : base(Target)
    {
        PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;

        PublicDependencyModuleNames.AddRange(new string[]
        {
            "Core",
            "CoreUObject",
            "Engine",
            "CometChat"   // Add this line
        });
    }
}
```

***

## Verify the Plugin

After installation:

1. Open your project in the Unreal Editor
2. Go to **Edit → Plugins**
3. Search for **CometChat** — it should appear and be enabled

<Info>
  The plugin loads at the **PreDefault** phase, so it's available before your game module initializes.
</Info>

***

## Initialize CometChat

The `CometChatSubsystem` is a `UGameInstanceSubsystem` — it's created automatically when your game starts. You need to call the **Configure Async** node with your App ID and Region before using any other SDK methods. This is a latent async node with **On Success** and **On Failure** pins.

<Tabs>
  <Tab title="Blueprint">
    1. In any Blueprint, search for the **CometChat Configure Async** node
    2. Pass your **App ID** and **Region**
    3. Wire the **On Success** and **On Failure** pins

    | Parameter | Type      | Description                    |
    | --------- | --------- | ------------------------------ |
    | App Id    | `FString` | Your CometChat App ID          |
    | Region    | `FString` | Your app region (`us` or `eu`) |

    **On Success** returns an `FCometChatUser`:

    * If a saved session was restored, the user details are populated (auto-login)
    * If no saved session exists, `Uid` will be empty — you need to call Login next

    **On Failure** returns an `FCometChatError` with error details.
  </Tab>

  <Tab title="C++">
    ```cpp theme={null}
    #include "CometChatSubsystem.h"
    #include "AsyncActions/CometChatConfigureAction.h"

    void AMyActor::BeginPlay()
    {
        Super::BeginPlay();

        auto* Action = UCometChatConfigureAction::CometChatConfigureAsync(
            this,
            TEXT("YOUR_APP_ID"),
            TEXT("us")
        );
        Action->OnSuccess.AddDynamic(this, &AMyActor::OnConfigureSuccess);
        Action->OnFailure.AddDynamic(this, &AMyActor::OnConfigureFailed);
        Action->Activate();
    }

    void AMyActor::OnConfigureSuccess(const FCometChatUser& LoggedInUser)
    {
        if (LoggedInUser.Uid.IsEmpty())
        {
            UE_LOG(LogTemp, Log, TEXT("SDK configured — no saved session, need to login"));
            // Proceed to Login
        }
        else
        {
            UE_LOG(LogTemp, Log, TEXT("SDK configured — session restored for %s"), *LoggedInUser.Name);
            // User is already logged in, ready to use SDK
        }
    }

    void AMyActor::OnConfigureFailed(const FCometChatError& Error)
    {
        UE_LOG(LogTemp, Error, TEXT("Configure failed: %s"), *Error.Message);
    }
    ```
  </Tab>
</Tabs>

<Warning>
  **Configure must be called before Login.** Calling Login without configuring first will result in a failure callback.
</Warning>

<Tip>
  **Session restoration**: If the user was previously logged in, Configure will automatically restore the session — you don't need to call Login again. Check if the returned `FCometChatUser.Uid` is non-empty to determine if a session was restored.
</Tip>

Make sure you replace `YOUR_APP_ID` with your actual CometChat **App ID**.

***

## Plugin Architecture

The plugin provides:

* **`UCometChatSubsystem`** — Game instance subsystem for CometChat operations
* **Async Blueprint actions** — for login, logout, send/fetch messages, groups, conversations, moderation, and more
* **`CometChatEventBridge`** — Real-time event callbacks (40+ delegates organized by listener type)
* **`UCometChatPanel`** — Ready-to-use tabbed chat panel widget (My Groups, Personal, Browse Groups)
* **`UCometChatButton`** — Floating button widget that toggles the chat panel
* **Native C++ chat SDK** via `ThirdParty/chatsdk/` (prebuilt static libraries)

***

## Next Steps

Now that the plugin is installed and configured, head to [Authentication](/sdk/unreal/authentication) to log in your first user.
