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

To setup your DocuSign app in Refold for OAuth, you will need the following credentials from your [DocuSign Developer account](https://developers.docusign.com/):

* Client ID
* Client Secret
* Scopes

### Pre-requisites

1. DocuSign Developer account. You can create one [here](https://go.docusign.com/o/sandbox/?postActivateUrl=https://developers.docusign.com/).

### Required Settings

* **Mandatory Scopes**

1. Openid
2. Extended
3. Signature

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

### Creating an app in DocuSign

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

1. Log in to your [DocuSign Developer account](https://developers.docusign.com/).
2. Click on the `Profile` icon in the top right corner and select `My Apps & Keys` button.

<img height="200" src="https://mintcdn.com/cobalt-55/C3P12YsraPVmMY5N/images/Docusign/Docusign_navigation.png?fit=max&auto=format&n=C3P12YsraPVmMY5N&q=85&s=1805cb26193e8bc6ef3a1e9892655961" alt="Navigation for App setup" data-path="images/Docusign/Docusign_navigation.png" />

3. Click on `Add App and Integration Key` button.
4. Enter the unique App Name for your application and click on the `Create App` button.
5. Go to your [`Apps catalog`](https://app.gocobalt.io/apps) in Refold > Search for `DocuSign` > `Settings` > `Use your credentials` > `Callback Url`.
6. Scroll down in the App to `Additional settings` section > click on `+ Add URL` > paste the Callback URL copied from **Refold**.

<img height="200" src="https://mintcdn.com/cobalt-55/C3P12YsraPVmMY5N/images/Docusign/Docusign_config.png?fit=max&auto=format&n=C3P12YsraPVmMY5N&q=85&s=d67b7ee1a34e1fb34f892f0a57695b9b" alt="Setting up DocuSign Developer app" data-path="images/Docusign/Docusign_config.png" />

7. Scroll to the `Authentication` section > Mark `Yes` under **User Application** > Click on `+ Add Secret Key` button > Copy it > Click on `Save` button at the bottom of the page. This is the **Client Secret**.
8. Copy the string under `Integration Key` above `Authentication` section. This is the **Client ID**.

<img height="200" src="https://mintcdn.com/cobalt-55/C3P12YsraPVmMY5N/images/Docusign/Docusign_credentials.png?fit=max&auto=format&n=C3P12YsraPVmMY5N&q=85&s=967a767caefd7287069c272e499c17f5" alt="Getting Credentials" data-path="images/Docusign/Docusign_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/C3P12YsraPVmMY5N/images/Docusign/Docusign_cobalt.png?fit=max&auto=format&n=C3P12YsraPVmMY5N&q=85&s=08e81ccd0ddcfa1d4694445587bae385" alt="Setting up application client credentials" data-path="images/Docusign/Docusign_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/C3P12YsraPVmMY5N/images/Docusign/Docusign_scopes.png?fit=max&auto=format&n=C3P12YsraPVmMY5N&q=85&s=66065cd043065c779bae53ab4d3b0d6e" alt="OAuth Scopes" data-path="images/Docusign/Docusign_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 DocuSign actions and triggers. Following are the set of DocuSign actions and triggers
supported by Refold.

<Tabs>
  <Tab title="Actions">
    <AccordionGroup>
      1. **HTTP Request** - Make HTTP API calls to any Docusign documented REST APIs.
      2. **Create and send envelope from template** - Create and send and envelope from a DocuSign template.
    </AccordionGroup>
  </Tab>

  <Tab title="Triggers">
    1. **Envelope Created** - Triggers when an Envelope is created on DocuSign.
    2. **Envelope Sent** - Triggers when an Envelope is sent on DocuSign.
    3. **Envelope Delivered** - Triggers when an Envelope is delivered on DocuSign.
    4. **Envelope Completed** - Triggers when an Envelope is completed on DocuSign.
    5. **Envelope Declined** - Triggers when an Envelope is declined on DocuSign.
  </Tab>
</Tabs>
