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

# Setup

> Connect to your Confluence app for OAuth

To setup your Confluence app in Refold for OAuth, you will need the following credentials from your [Confluence Developer account]():

* Client ID
* Client Secret
* Scopes

### Pre-requisites

1. Confluence Developer Portal. You can create one [here](https://www.atlassian.com/developers).

### Required Settings

* **Mandatory Scopes**

1. offline\_access

<Info>If you haven't already created an app in Confluence, you'd need to create one.</Info>

### Creating an app in Confluence

To create a Confluence app and acquire the above mentioned credentials, please follow the steps mentioned below:

1. Log in to your [Confluence Developer Portal](https://developer.atlassian.com/console).
2. Click on the `Create` button in the right and select `OAuth 2.0 integration`.

<img height="200" src="https://mintcdn.com/cobalt-55/0IGKzTphHY-auv_h/images/Jira/jira_navigation.png?fit=max&auto=format&n=0IGKzTphHY-auv_h&q=85&s=8225ab62874be437288952b2a0147f2b" alt="Navigation for App setup" data-path="images/Jira/jira_navigation.png" />

3. Enter the **App Name** for your application, **agree** to the Developer's terms and click on `Create`.
4. Go to your [`Apps catalog`](https://app.gocobalt.io/apps) in Refold > Search for `Confluence` > `Settings` > `Use your credentials` > `Callback Url` > Copy it.
5. Navigate to `Authorization` in the side menu > Click on `Add` button under **Action** > Paste the **Callback Url** > Click on `Save changes`.

<img height="200" src="https://mintcdn.com/cobalt-55/qu02QklkWCst59D2/images/Confluence/confluence_config.png?fit=max&auto=format&n=qu02QklkWCst59D2&q=85&s=443c9b49a448bc02dda32a1e07ac265f" alt="Setting up Confluence Developer app" data-path="images/Confluence/confluence_config.png" />

6. Navigate to `Permissions` in the side menu > Click on `Add` button in **Jira API** > Click on `Configure`.
7. Navigate to **Classic scopes** tab > Click on `Edit Scopes` button in **Confluence API** > Select scops > Click on the `Save` button.

<img height="200" src="https://mintcdn.com/cobalt-55/qu02QklkWCst59D2/images/Confluence/confluence_setscopes.png?fit=max&auto=format&n=qu02QklkWCst59D2&q=85&s=2433c72a8b94e9532b5436d7f85049a0" alt="Scopes Selection in Confluence App" data-path="images/Confluence/confluence_setscopes.png" />

8. Navigate to `Distribution` in the side menu > Click on the `Edit` button > Change **distribution status** to `Sharing` and provide **Vendor and Security Details** > Click on `Save Changes`.

<Info>
  **Note**: Changing Distribution Status from Private to Sharing is necessary, otherwise only the Developer account user can install and use it.
</Info>

9. Navigate to `Settings` in the side menu, scroll down and copy the **Client ID** and **Secret** from **Authentication details** section.

<img height="200" src="https://mintcdn.com/cobalt-55/qu02QklkWCst59D2/images/Confluence/confluence_credentials.png?fit=max&auto=format&n=qu02QklkWCst59D2&q=85&s=256a91cb1ea1bc27c685b2d44f1bf18a" alt="Getting Credentials" data-path="images/Confluence/confluence_credentials.png" />

#### Configuring credentials in Refold

App settings page lets you configure the authentication settings for an `OAuth2` based application. For your customers to provide you authorization to access their data,
they would first need to install your application. This page lets you set up your application credentials.

<img height="200" src="https://mintcdn.com/cobalt-55/qu02QklkWCst59D2/images/Confluence/confluence_cobalt.png?fit=max&auto=format&n=qu02QklkWCst59D2&q=85&s=da696e2a9b2f95c3be539fadeb5336a8" alt="Setting up application client credentials" data-path="images/Confluence/confluence_cobalt.png" />

Refold lets you use pre-configured applications to play around. You can do so by selecting `Use our credentials`. However, if you wish to use your own application,
select `Use your own credentials`. Provide the acquired Client Id and Client secret and click on `Save changes`.

#### Configuring Scopes

Refold lets you configure what permissions to ask from your users while they install your application. The scopes can be added or removed from the App settings page, under `Permissions & Scopes`
section.

For some applications Refold sets mandatory scopes which cannot be removed. Additional scopes can be selected from the drop down. Refold also has the provision to add any
custom scopes supported by the respective platform.

<img height="200" src="https://mintcdn.com/cobalt-55/qu02QklkWCst59D2/images/Confluence/confluence_scopes.png?fit=max&auto=format&n=qu02QklkWCst59D2&q=85&s=4de25e1e23c62f072b820d5dfea2db88" alt="OAuth Scopes" data-path="images/Confluence/confluence_scopes.png" />

Once the scopes has been added to the application in Refold, go to your [Confluence Developer Portal](https://developer.atlassian.com/console) and update the scopes as added on Refold.

Select the OAuth App created for Refold > Click on `Permissions` in the left menu > Click `Configure` in **Confluence API** > Click on `Edit Scopes` > Select the scope > Click on `Save` .

<Warning>
  If you are facing scopes missing or invalid scope error. Make sure you are not passing any custom scope not supported by the platform. And, the scopes selected here are
  identical to the ones selected in the platform.
</Warning>

#### Actions and triggers

Once the above setup is completed, you can create orchestrations of your use-cases using Confluence actions and triggers. Following are the set of Confluence actions and triggers
supported by Refold.

<Tabs>
  <Tab title="Actions">
    <AccordionGroup>
      <Accordion title="Labels">
        1. **List Labels** - List labels in Confluence.
      </Accordion>

      <Accordion title="Pages">
        2. **List Pages** - List pages in Confluence.
        3. **Create Page** - Create a page in Confluence.
        4. **Update Page** - Update a page in Confluence.
      </Accordion>

      <Accordion title="Spaces">
        5. **List Spaces** - Get all spaces in Confluence.
        6. **Get Space** - Get a space by ID in Confluence.
      </Accordion>

      <Accordion title="Tasks">
        7. **Get Tasks** - Get task by ID in Confluence.
        8. **Update Task** - Update task in Confluence.
      </Accordion>

      <Accordion title="Users">
        9. **Invite User** - Invite a user in Confluence.
        10. **Check User Access** - Check a user's access in Confluence.
      </Accordion>

      <Accordion title="Others">
        11. **HTTP Request** - Make HTTP API calls to any Confluence documented REST APIs.
      </Accordion>
    </AccordionGroup>
  </Tab>

  <Tab title="Triggers">
    1. **Page Created** - Triggers when a page is created on Confluence.
    2. **Label Created** - Triggers when a label is created on Confluence.
  </Tab>
</Tabs>
