> ## 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 Keap app for OAuth.

To setup your Keap app in Refold for OAuth, you will need the following credentials from your [Keap Developer account](https://keys.developer.keap.com):

* Client ID
* Client Secret
* Scopes

### Pre-requisites

1. Keap Developer account. You can create one [here](https://keys.developer.keap.com/accounts/create).

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

### Creating an app in Keap

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

1. Log in to your [Keap Developer account](https://keys.developer.keap.com).
2. Click on the `Username` in the top right and select `Apps` button.

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

3. Click on `+ New App` button in the top right.
4. Enter the **App Name** for your application, click on `Enable` button under **APIs** section and click on `Save`.
5. Navigate to **API Keys** section and copy the `Key`(**Client ID**) and `Secret`(**Client Secret**).

<img height="200" src="https://mintcdn.com/cobalt-55/0IGKzTphHY-auv_h/images/Keap/keap_credentials.png?fit=max&auto=format&n=0IGKzTphHY-auv_h&q=85&s=301ea56781a311f40f513450bf82652e" alt="Getting Credentials" data-path="images/Keap/keap_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/0IGKzTphHY-auv_h/images/Keap/Keap_cobalt.png?fit=max&auto=format&n=0IGKzTphHY-auv_h&q=85&s=1bc2ad4a85e053d2c00b327897a2491e" alt="Setting up application client credentials" data-path="images/Keap/Keap_cobalt.png" />

Provide the acquired Client ID and Client Secret under Settings of the app and save it.

#### 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/0IGKzTphHY-auv_h/images/Keap/keap_scopes.png?fit=max&auto=format&n=0IGKzTphHY-auv_h&q=85&s=88e4e4a33ff1c6f082695081525db6c3" alt="OAuth Scopes" data-path="images/Keap/keap_scopes.png" />

Once the scopes has been added to the application in Refold, the app will now request for access of the mentioned scopes.

<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.
</Warning>

#### Actions and triggers

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

<Tabs>
  <Tab title="Actions">
    <AccordionGroup>
      <Accordion title="Contact">
        1. **Create Contact** - Create a new contact in Keap.
        2. **Create Or Update Contact** - Create or Update a Contact in Keap.
        3. **Update Contact** - Update a contact in Keap.
        4. **Get Contact By Id** - Get contact by its ID in Keap.
        5. **Retrieve Contact Model** - Get the custom fields and optional properties for the Contact object in Keap.
      </Accordion>

      <Accordion title="Note">
        6. **Create Note** - Create a new note in Keap.
      </Accordion>

      <Accordion title="Custom Field">
        7. **Create Custom Field** - Create a new custom field in Keap.
      </Accordion>

      <Accordion title="Opportunity">
        9. **Create Opportunity** - Create a new opportunity in Keap.
        10. **Update Opportunity** - Update an opportunity in Keap.
      </Accordion>

      <Accordion title="Tag">
        11. **List Tags** - List tags in Keap.
        12. **Create Tag** - Create a new tag in Keap.
      </Accordion>

      <Accordion title="Others">
        13. **HTTP Request** - Make HTTP API calls to any Keap documented REST APIs.
        14. **Add Tag To Contact** - Add a tag to a contact in Keap.
      </Accordion>
    </AccordionGroup>
  </Tab>

  <Tab title="Triggers">
    1. **Contact Created** - Triggers when a new contact is created on Keap.
    2. **Opportunity Created** - Triggers when a new opportunity is created on Keap.
    3. **Contact Updated** - Triggers when a contact is updated on Keap.
    4. **Tag Associated with Contact** - Triggers when a tag is associated with a contact on Keap.
  </Tab>
</Tabs>
