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

To setup your FreshBooks app in Refold for OAuth, you will need the following credentials from your [FreshBooks Developer account](https://my.freshbooks.com/?_gl=1*tfyugh*_ga*MTM0OTgzODIxMi4xNzA4NDkzMjIz*_ga_LNDHWTHSMK*MTcwOTMyMjYzNy4zLjEuMTcwOTMyMzIwNy4yMC4wLjA.#/developer):

* Client ID
* Client Secret
* Scopes

### Pre-requisites

1. FreshBooks Developer account. You can create one [here](https://www.freshbooks.com/pages/developer-signup).

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

### Creating an app in FreshBooks

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

1. Log in to your [FreshBooks Developer account](https://my.freshbooks.com/?_gl=1*tfyugh*_ga*MTM0OTgzODIxMi4xNzA4NDkzMjIz*_ga_LNDHWTHSMK*MTcwOTMyMjYzNy4zLjEuMTcwOTMyMzIwNy4yMC4wLjA.#/developer).
2. Click on the `Create New App` button in the top right.

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

3. Go to your [`Apps catalog`](https://app.gocobalt.io/apps) in **Refold** > Search for `Freshbooks` > `Settings` > `Use your credentials` > `Callback Url` > Copy it.
4. Enter the **Application Name**, choose **Type** according to your requirement, paste the Callback Url under **Redirect URIs** and click on `Save` at the top.
5. Scroll down in the app after it has been created and copy the **Client ID** and **Client Secret**.

<img height="200" src="https://mintcdn.com/cobalt-55/h1VL7v_8HaANGLZ5/images/Freshbooks/freshbooks_credentials.png?fit=max&auto=format&n=h1VL7v_8HaANGLZ5&q=85&s=9aaa3d6a41f236f792373eece3584072" alt="Getting Credentials" data-path="images/Freshbooks/freshbooks_credentials.png" />

#### Configuring credentials in Refold

App settings page lets you configure the authentication settings for an `OAuth 2.0` 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/h1VL7v_8HaANGLZ5/images/Freshbooks/freshbooks_cobalt.png?fit=max&auto=format&n=h1VL7v_8HaANGLZ5&q=85&s=cb3b5371ce6300253fda975281df1a88" alt="Setting up application client credentials" data-path="images/Freshbooks/freshbooks_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/h1VL7v_8HaANGLZ5/images/Freshbooks/freshbooks_scopes.png?fit=max&auto=format&n=h1VL7v_8HaANGLZ5&q=85&s=040b3b6f4a47e11dbb65924238a67d28" alt="OAuth Scopes" data-path="images/Freshbooks/freshbooks_scopes.png" />

Once the scopes has been added to the application in Refold, go to your [FreshBooks Developer account](https://my.freshbooks.com/?_gl=1*tfyugh*_ga*MTM0OTgzODIxMi4xNzA4NDkzMjIz*_ga_LNDHWTHSMK*MTcwOTMyMjYzNy4zLjEuMTcwOTMyMzIwNy4yMC4wLjA.#/developer) and update the scopes as added on Refold.

Select the OAuth App created for Refold > Scroll down to `Scopes` section > Click on `+ Add Scope` > Select the scopes as added in Refold > Click on `Save Settings`.

<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 Freshbooks actions and triggers. Following are the set of Freshbooks actions and triggers
supported by Refold.

<Tabs>
  <Tab title="Actions">
    <AccordionGroup>
      <Accordion title="Client">
        1. **Create Client** - Create a Client in Freshbooks.
        2. **Update Client** - Update a Client in Freshbooks.
        3. **Delete Client** - Delete a Client in Freshbooks.
        4. **Get Client** - Get a Client in Freshbooks.
      </Accordion>

      <Accordion title="Invoice">
        5. **Create Invoice** - Create an Invoice in Freshbooks.
        6. **Update Invoice** - Update Invoice in Freshbooks.
        7. **Get Invoice** - Get an Invoice in Freshbooks.
        8. **Delete Invoice** - Delete an Invoice in Freshbooks.
      </Accordion>

      <Accordion title="Payment">
        9. **Create Payment** - Create a payment in Freshbooks.
        10. **Update Payment** - Update Payment in Freshbooks.
        11. **Get Payment** - Get a payment in Freshbooks.
        12. **Delete Payment** - Delete a payment in Freshbooks.
      </Accordion>

      <Accordion title="Time Entry">
        13. **Create Time Entry** - Create Time entry in Freshbooks.
        14. **Get Time Entry** - Get a time entry in Freshbooks.
        15. **Update Time Entry** - Update a time entry in Freshbooks.
        16. **Delete Time Entry** - Delete time entry in Freshbooks.
        17. **List Time Entry** - List all time entries in Freshbooks.
      </Accordion>

      <Accordion title="Others">
        18. **HTTP Request** - Make HTTP API calls to any Freshbooks documented REST APIs.
        19. **List Payments** - List all payments in Freshbooks.
        20. **List Specific Day Time Entries** - List time entries from a specific day in Freshbooks.
        21. **Send Invoice By Emails** - Send an invoice by email in Freshbooks.
      </Accordion>
    </AccordionGroup>
  </Tab>

  <Tab title="Triggers">
    1. **Bill Created** - Triggers when a bill is created on Freshbooks.
    2. **Bill Updated** - Triggers when a bill is updated on Freshbooks.
    3. **Bill Deleted** - Triggers when a bill is deleted on Freshbooks.
    4. **Invoice Created** - Triggers when an invoice is created on Freshbooks.
    5. **Invoice Updated** - Triggers when an invoice is updated on Freshbooks.
    6. **Invoice Deleted** - Triggers when an invoice is deleted on Freshbooks.
    7. **Payment Created** - Triggers when a payment is created on Freshbooks.
    8. **Payment Updated** - Triggers when a payment is updated on Freshbooks.
    9. **Payment Deleted** - Triggers when a payment is deleted on Freshbooks.
  </Tab>
</Tabs>
