# LiveChat

![LiveChat_logo.svg](https://assets.relyanceuat.xyz/images/docs/9953732783501/9953522986253.svg)
LiveChat is an online customer service communication platform that enables you and your website visitors to chat in real-time. It provides organizations online chat, help desk software, and web analytics capabilities.

Relyance AI provides two (2) options to integrate a tenant's LiveChat account:

1. [The first option uses LiveChat's API and OAuth2](#h_01GFKYAEVPBTYKR7WEX5C3Y2KR)
2. [The second option uses LiveChat's Partner Program API](#h_01GFNY2SR94M3WKDHBHRP2TMZ6)

### Option 1 - Using LiveChat's API and OAuth2

---

In order to integrate LiveChat with Relyance AI you will need a LiveChat **Client ID**, **Client Secret**, and follow an OAuth2 flow.

#### In LiveChat:

1. Login to your LiveChat account.
2. Go the developer console here: [https://developers.livechat.com/console/](https://developers.livechat.com/console/)
3. Following the instructions found [here](https://developers.livechat.com/docs/authorization/authorization-in-practice#step-1-configure-the-authorization-building-block), create an App. Click **Build App**.
4. Provide a meaningful name for the App in the resulting dialog.
5. Add an App Authorization block to your app.
6. Select **Server-side** app and click **Continue**.
7. This will bring up your **App Authorization** configuration. Fill in the form with the following info: **Redirect URI whitelist**: [https://root.relyance.ai/api/oauth2](https://root.relyance.ai/api/oauth2) (*Ensure you click **Add +**) **Scopes**:

![LiveChat-6.png](https://assets.relyanceuat.xyz/images/docs/9953732783501/9971724155277.png)

![LiveChat-5.png](https://assets.relyanceuat.xyz/images/docs/9953732783501/9971702781197.png)

![LiveChat-4.png](https://assets.relyanceuat.xyz/images/docs/9953732783501/9971702785549.png)

![LiveChat-1.png](https://assets.relyanceuat.xyz/images/docs/9953732783501/9972177348621.png)

8. Copy the **Client ID** and **Client Secret** from this page to be used in Relyance.
9. Click **Save changes**.

#### In the Relyance AI application:

1. Login to your Relyance account.
2. Navigate to the **Settings** Menu in the bottom left-hand side.
3. Select **Integrations**.
4. Click on the **Vendor Integration** tab.
5. Find the **LiveChat** integration card and click it to open its connections.
6. Under **Authentication Method**, choose **Oauth2 / App Token / General APIs**.
8. Paste the **Client ID** and **Client Secret** into their respective fields.

![LiveChat-3.png](https://assets.relyanceuat.xyz/images/docs/9953732783501/9971723911181.png)

9. Click **Authenticate**.
10. This will then initiate an OAuth2 workflow and you may be asked to sign into LiveChat.
11. At this point, you should see the following result on the **Vendor** Integrations page:

12. Congratulations, you are now connected to **LiveChat**.

### Option 2 - Using LiveChat's Partner Program API

---

In order to integrate LiveChat with Relyance AI you will need a LiveChat Partner Program API Token.

#### In LiveChat:

1. Login to your LiveChat Partner Program account.
2. After logging in, go here: [https://partners.livechat.com/app/v2/account/token](https://partners.livechat.com/app/v2/account/token)
3. Create a Partner Program Token by providing a meaningful name and clicking the **Create token** button.
4. Copy the **API Token** to be used in Relyance.

![LiveChat-7.png](https://assets.relyanceuat.xyz/images/docs/9953732783501/9972680674317.png)

#### In the Relyance AI application:

1. Login to your Relyance account.
2. Navigate to the **Settings** Menu in the bottom left-hand side.
3. Select **Integrations**.
4. Click on the **Vendor Integration** tab.
5. Find the **LiveChat** integration card and click it to open its connections.
6. Under **Authentication Method**, choose **Custom / Partner Program API**.
8. Paste the **API Token** into its respective field.

![LiveChat-8.png](https://assets.relyanceuat.xyz/images/docs/9953732783501/9972680670477.png)

9. Click **Authenticate**.
10. At this point, you should see the following result on the **Vendor** Integrations page:

![LiveChat-2.png](https://assets.relyanceuat.xyz/images/docs/9953732783501/9971723913613.png)

11. Congratulations, you are now connected to **LiveChat**.

<!-- failure-modes:begin (generated from the integration catalog; do not hand-edit) -->

## If the connection reports Connected but returns nothing

These are the ways this integration comes back empty without reporting an error. Generated from the integration catalog, so it tracks what the connection actually asks for.

1. **Authorised, then empty.** The connection carries an authorisation, not a password: it stops returning data if the account that granted it loses access, its own permissions narrow, or the grant is revoked at the vendor. None of that reports an error here -- the connection keeps its last status until the next scan.
2. **A credential rotated at the vendor is not picked up here.** **Client Secret** and **API Token** are stored when you save the connection, so regenerating the value at the vendor breaks the next scan until it is re-pasted here. Recording the expiry on the connection means Relyance warns you before it lapses.

<!-- failure-modes:end -->

<!-- terraform-examples:begin (generated from the integration catalog; do not hand-edit) -->

## Manage this integration with Terraform

Connections for this integration can be managed as code with the [Relyance Terraform provider](https://registry.terraform.io/providers/Relyance/relyance/latest). Non-secret fields go in `auth.params`; secret fields go in `auth.secrets_wo`, which is write-only — never stored in Terraform state. Rotate secrets by bumping `auth.secrets_wo_version`.

### OAuth (browser authorization)

The **OAuth (browser authorization)** method uses a browser authorization flow, so the connection is created in the Relyance app. Manage it in Terraform afterwards by importing it (`terraform import relyance_integration_connection.example livechat/<connection_id>`) or reading it with the `relyance_integration_connection` data source.

### API token

```hcl
resource "relyance_integration_connection" "livechat_1" {
  vendor = "livechat"
  name   = "<your connection name>"

  auth = {
    method = "api-token"
    params = {
      data_storage_location = "us"
    }
    # Secret fields are write-only: sent to Relyance, never stored in state.
    secrets_wo = {
      api_token = var.livechat_api_token
    }
    secrets_wo_version = 1
  }

  scans = { "property-inspection" = { enabled = true } }
}
```

<!-- terraform-examples:end -->
