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

# Connect apps with the CLI

> Connect Google Drive, Dropbox, OneDrive, Box, SharePoint, Notion, Confluence, and GitHub to a chatbot, and import their content from the command line.

A connected app is a source of content in another service, such as Google Drive or GitHub. You connect the app once, then import the files or pages that you want the chatbot to learn from.

The CLI calls a connected app a source. All commands on this page start with `sitegpt knowledge sources`. `knowledge connections` does the same.

This page shows the common path for each app. For every option, see [External data sources](/docs/cli/command-reference#external-data-sources). To connect apps in the dashboard, see [Connect apps](/docs/guides/content/connect-apps).

## Before you start

* A SiteGPT account on the Growth plan or above. See [Plans and limits](/docs/reference/plans-and-limits).
* The CLI installed and logged in. See [Install and log in](/docs/cli/install-login). The default access from `sitegpt login` is enough for the tasks on this page.
* Your chatbot ID. Run `sitegpt chatbots list` to find it.
* A web browser, to approve access in the other app. GitHub does not need this.
* Enough pages left for the new content. Run `sitegpt limits` to check.

## Connect Google Drive, Dropbox, OneDrive, Box, or SharePoint

These apps show a file picker after you approve access.

<Steps>
  <Step title="Create the connection">
    Set `--connector` to `GOOGLE_DRIVE`, `DROPBOX`, `ONEDRIVE`, `BOX`, or `SHAREPOINT`:

    ```bash theme={null}
    sitegpt knowledge sources create --chatbot YOUR_CHATBOT_ID --connector GOOGLE_DRIVE --name "Drive docs"
    ```

    The output shows the source ID and an `Authorization URL`.
  </Step>

  <Step title="Approve access and pick files">
    Open the authorization URL in a browser. Approve access, then select the files in the picker.
  </Step>

  <Step title="Check the selected files">
    ```bash theme={null}
    sitegpt knowledge sources documents --chatbot YOUR_CHATBOT_ID YOUR_SOURCE_ID
    ```
  </Step>

  <Step title="Import the files">
    ```bash theme={null}
    sitegpt knowledge sources ingest --chatbot YOUR_CHATBOT_ID YOUR_SOURCE_ID
    ```

    To import only some files, add `--external-id` with a file ID from the previous step. You can repeat it.
  </Step>
</Steps>

**Check that it works:** Run `sitegpt knowledge documents list --chatbot YOUR_CHATBOT_ID --source GOOGLE_DRIVE`. Use the connector name that you chose. Each file has the status `SUCCESS` when training is done.

## Connect Notion

In Notion, you select the pages during the approval, not in a picker.

<Steps>
  <Step title="Create the connection">
    ```bash theme={null}
    sitegpt knowledge sources create --chatbot YOUR_CHATBOT_ID --connector NOTION --name "Notion docs"
    ```
  </Step>

  <Step title="Approve access and select pages">
    Open the `Authorization URL` from the output. In Notion, select the pages and databases that the chatbot can read.
  </Step>

  <Step title="Import the pages">
    ```bash theme={null}
    sitegpt knowledge sources ingest --chatbot YOUR_CHATBOT_ID YOUR_SOURCE_ID
    ```
  </Step>
</Steps>

SiteGPT finds the selected Notion pages when you import. So `sources documents` can show no documents before the first import. This is normal.

**Check that it works:** Run `sitegpt knowledge documents list --chatbot YOUR_CHATBOT_ID --source NOTION`. Each page has the status `SUCCESS` when training is done. If no pages show, run `sources authorize` again and select pages. See [Add more files to a connection](#add-more-files-to-a-connection).

## Connect Confluence

<Steps>
  <Step title="Create the connection">
    Pass your Confluence site domain:

    ```bash theme={null}
    sitegpt knowledge sources create --chatbot YOUR_CHATBOT_ID --connector CONFLUENCE --domain your-team.atlassian.net --name "Confluence docs"
    ```
  </Step>

  <Step title="Approve access">
    Open the `Authorization URL` from the output and approve access.
  </Step>

  <Step title="Find the space and page IDs">
    List the spaces, then the pages in one space:

    ```bash theme={null}
    sitegpt knowledge sources confluence spaces --chatbot YOUR_CHATBOT_ID --source YOUR_SOURCE_ID
    sitegpt knowledge sources confluence pages --chatbot YOUR_CHATBOT_ID --source YOUR_SOURCE_ID --space YOUR_SPACE_ID
    ```
  </Step>

  <Step title="Import the pages">
    Pass one `--page` for each page:

    ```bash theme={null}
    sitegpt knowledge sources ingest --chatbot YOUR_CHATBOT_ID YOUR_SOURCE_ID --page YOUR_PAGE_ID --page YOUR_OTHER_PAGE_ID
    ```
  </Step>
</Steps>

**Check that it works:** Run `sitegpt knowledge documents list --chatbot YOUR_CHATBOT_ID --source CONFLUENCE`. Each page has the status `SUCCESS` when training is done.

## Connect GitHub

GitHub uses a personal access token instead of a browser approval.

<Steps>
  <Step title="Create the connection">
    ```bash theme={null}
    sitegpt knowledge sources create --chatbot YOUR_CHATBOT_ID --connector GITHUB --name "Docs repo" --owner YOUR_GITHUB_OWNER --api-key YOUR_GITHUB_TOKEN
    ```
  </Step>

  <Step title="Find the repository">
    ```bash theme={null}
    sitegpt knowledge sources github repos --chatbot YOUR_CHATBOT_ID --source YOUR_SOURCE_ID
    ```

    To see the files in one repository, use `sources github files` with `--owner`, `--repo`, and `--branch`.
  </Step>

  <Step title="Import the files">
    ```bash theme={null}
    sitegpt knowledge sources ingest --chatbot YOUR_CHATBOT_ID YOUR_SOURCE_ID --repo YOUR_REPO --branch main --pattern "docs/**" --sync MONTHLY
    ```

    * `--repo` is required.
    * `--pattern` limits the import to matching files. You can repeat it.
    * `--sync` sets auto-sync to `DAILY`, `WEEKLY`, or `MONTHLY`. GitHub is the only connected app that SiteGPT auto-syncs.
  </Step>
</Steps>

**Check that it works:** Run `sitegpt knowledge documents list --chatbot YOUR_CHATBOT_ID --source GITHUB`. Each file has the status `SUCCESS` when training is done.

## Add more files to a connection

To select more files, approve access again, or reconnect after access expired, authorize the connection that you have:

```bash theme={null}
sitegpt knowledge sources authorize --chatbot YOUR_CHATBOT_ID YOUR_SOURCE_ID
```

Open the `Authorization URL` from the output. Then [import](#connect-google-drive-dropbox-onedrive-box-or-sharepoint) the new files. `reauthorize`, `select-files`, and `picker` do the same as `authorize`.

Use the connection that you have. A new connection for the same app is a separate connection.

**Check that it works:** `sitegpt knowledge sources documents --chatbot YOUR_CHATBOT_ID YOUR_SOURCE_ID` lists the new files.

## Refresh content from a connected app

SiteGPT auto-syncs only GitHub. For other apps, resync the documents when the files change:

```bash theme={null}
sitegpt knowledge documents resync --chatbot YOUR_CHATBOT_ID --source GOOGLE_DRIVE
```

If you pass `--sync` to `sources ingest` for another app, SiteGPT sets it to `NEVER` and the response includes a warning.

**Check that it works:** The CLI prints `Documents queued for resync:` with a number.

## Rename a connection or change the GitHub token

```bash theme={null}
sitegpt knowledge sources update --chatbot YOUR_CHATBOT_ID YOUR_SOURCE_ID --name "Product docs"
sitegpt knowledge sources update --chatbot YOUR_CHATBOT_ID YOUR_SOURCE_ID --api-key YOUR_NEW_GITHUB_TOKEN
```

**Check that it works:** Run `sitegpt knowledge sources get --chatbot YOUR_CHATBOT_ID YOUR_SOURCE_ID`. The output shows the new name.

## Disconnect an app

<Steps>
  <Step title="Revoke the connection">
    ```bash theme={null}
    sitegpt knowledge sources revoke --chatbot YOUR_CHATBOT_ID YOUR_SOURCE_ID --yes
    ```

    `sources delete` does the same. The chatbot keeps the content that it already imported.
  </Step>

  <Step title="Delete the imported content (optional)">
    To also remove the content, delete the documents from that app:

    ```bash theme={null}
    sitegpt knowledge documents delete --chatbot YOUR_CHATBOT_ID --source GOOGLE_DRIVE --yes
    ```

    This deletes the documents from every connection to that app on this chatbot. To delete only some documents, pass their IDs instead. See [Delete content](/docs/cli/knowledge#delete-content).
  </Step>
</Steps>

**Check that it works:** The revoke command prints the connection details with `Status: REVOKED`.

## Related

* [Manage content](/docs/cli/knowledge)
* Command reference: [External data sources](/docs/cli/command-reference#external-data-sources), [GitHub source helpers](/docs/cli/command-reference#github-source-helpers), [Confluence source helpers](/docs/cli/command-reference#confluence-source-helpers)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.