> ## Documentation Index
> Fetch the complete documentation index at: https://docs.useparagon.com/llms.txt
> Use this file to discover all available pages before exploring further.

# eGain

> Connect to your users' eGain Knowledge Hub to search and sync articles and request grounded answers from your app.

Product
Supported

## Setup Guide

You can find your app credentials in the Client Application you create in the eGain administration console, under **Partition > Integration > Client Application**. See eGain's [authentication guide](https://apidev.egain.com/developer-portal/get-started/authentication_guide) for how to create a client application.

Paragon supports two ways to connect eGain:

* **eGain User OAuth:** Your users sign in to eGain, and Paragon calls the Knowledge Hub APIs as that user with delegated scopes.
* **eGain Client Credentials:** Paragon requests a client-credentials token for the client application, using application scopes (prefixed with `app.`).

You'll need the following information to set up your eGain app with Paragon Connect:

* Client ID
* Client Secret
* Scopes Requested

### Add the Redirect URL to your eGain app

When you use eGain User OAuth, Paragon provides a redirect URL to send information to your eGain client application. To add the redirect URL to your eGain app:

1. Copy the link under "**Redirect URL**" in your integration settings in Paragon. The Redirect URL is:

```text theme={null}
https://passport.useparagon.com/oauth
```

2. Add the redirect URL from Paragon as a redirect URL of your eGain client application.

### Add your eGain app to Paragon

1. Select **eGain** from the **Integrations Catalog**.

2. Under **Integrations > Connected Integrations > eGain > App Configuration > Configure**, fill out your credentials in their respective sections:

* **Client ID:** The Client ID of your eGain client application.
* **Client Secret:** The client secret of your eGain client application. eGain shows it only once, when you create the client application.
* **Scopes:** Select the scopes granted on your client application. For eGain User OAuth, Paragon requests `knowledge.portalmgr.read`, `knowledge.contentmgr.read` and `core.aiservices.read` by default. For eGain Client Credentials, Paragon requests `app.knowledge.portalmgr.read`, `app.knowledge.contentmgr.read` and `app.core.aiservices.read` by default. Add the `manage` scopes to create and update articles.

Press the purple "**Save Changes**" button to save your credentials.

## Connecting to eGain

Your users will need the following information from the eGain client application's **Metadata** button to connect their eGain account with your integration built with Paragon Connect:

* **Authorization URL:** The user authorization URL, for example `https://auth.egain.cloud/TENANT-U/oauth2/authorize`. Required only for eGain User OAuth.
* **Token URL:** The token URL for the client application.
* **API Domain:** The API host. Knowledge Hub uses `https://api.ai.egain.cloud`.
* **Domain URL:** The tenant console URL, which identifies the connected partition.
* **Portal ID:** The knowledge portal to search and sync, for example `PROD-1000`. Required for eGain Client Credentials. With eGain User OAuth, Paragon uses the first portal the user can open when this is blank.
* **Department ID (optional):** The department that owns knowledge folders. Required only to list folders.
* **Language (optional):** The knowledge language, for example `en-US`. Defaults to `en-US`.

Once your users have connected their eGain account, you can use the Paragon SDK to access the eGain Knowledge Hub API on behalf of connected users. Paragon sends requests to the API Domain your user entered.

See the eGain [Knowledge API documentation](https://apidev.egain.com/developer-portal/guides/knowledge/content-manager) for their full API reference.

Any eGain API endpoints can be accessed with the Paragon SDK as shown in this example.

```js JavaScript theme={null}
// You can find your project ID in the Overview tab of any Integration

// Authenticate the user
paragon.authenticate(<ProjectId>, <UserToken>);

// Search articles in a portal
await paragon.request("egain", "/knowledge/portalmgr/v4/PORTAL-ID/search", {
  method: "GET",
  params: { q: "reset password", $lang: "en-US" }
});

// Get an article
await paragon.request("egain", "/knowledge/contentmgr/v4/article/PROD-1000", {
  method: "GET",
  params: { versionSelector: "published", $lang: "en-US" }
});
```

## Building eGain workflows

Once your eGain account is connected, you can add steps to perform the following actions:

* **Articles:** Search articles, get an article, list a topic's articles, create and update articles, and check whether an article is readable
* **Portals:** Get a portal and list portals
* **Topics:** List topics
* **Folders:** Get a folder and list folders
* **Answers:** Get certified or generative answers and retrieve passages from Knowledge Hub

You can also use the [eGain Request](https://docs.useparagon.com/workflows/requests.md#making-integration-requests) step to access any of eGain's API endpoints without the authentication piece.

When creating or updating records in eGain, you can reference data from previous steps by typing `{{` to invoke the variable menu.

## Using triggers

eGain triggers run your workflows when eGain sends a knowledge notification to Paragon. To receive events, copy the Paragon webhook URL and paste it into the eGain administration console. You can use the following triggers:

* **Article Created**
* **Article Updated**
* **Article Deleted**
