> For the complete documentation index, see [llms.txt](https://calendly-salesforce-sdk.gitbook.io/calendly-salesforce-sdk/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://calendly-salesforce-sdk.gitbook.io/calendly-salesforce-sdk/master.md).

# Getting Started

## Installation <a href="#getting-started-with-typescript" id="getting-started-with-typescript"></a>

The Calendly Salesforce SDK is available as an unmanaged package which can be installed by using one of the links below:

* [Production Package Link](https://login.salesforce.com/packaging/installPackage.apexp?p0=04t5Y000001qxnk)
* [Sandbox Package Link](https://test.salesforce.com/packaging/installPackage.apexp?p0=04t5Y000001qxnk)

## Setup

To allow the Calendly Salesforce SDK to access your Calendly data you'll need to create a new personal access token by visiting <https://calendly.com/integrations/api_webhooks>. Once you've created your personal access token you'll then need to register a [Named Credential ](https://help.salesforce.com/articleView?id=sf.named_credentials_about.htm\&type=5)in Salesforce to securely store your Calendly token.

### Create Calendly Personal Access Token

Visit <https://calendly.com/integrations/api_webhooks> to create / copy your new personal access token (this will be used in the step below).

### Create Salesforce Named Credential

Login to your Salesforce account and create a new **Named Credential** with the following attributes:

**Label**: Calendly\
**Name**: calendly\_api\
**URL**: <https://api.calendly.com>\
**Identity Type**: Named Principal\
**Authentication Protocol**: Password Authentication\
**Username**: user\
**Password**: YOUR\_CALENDLY\_PERSONAL\_ACCESS\_TOKEN\
**Generate Authorization Header**: Disabled\
**Allow Merge Fields in HTTP Header**: Enabled

![](https://948888192-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MUxLOcCRhNqsDd6L6_q%2F-MUxLX_M5r_7gOAkwmrO%2F-MUxkTDQeI2IQ96tbXmb%2FScreen%20Shot%202021-03-04%20at%209.18.05%20AM.png?alt=media\&token=283e2187-a1ff-4575-b007-de5522883637)

### Test Connection

To ensure that the Calendly Salesforce SDK has access to your Calendly data you can test the connect by executing the Apex code below from your [Salesforce developer console](https://help.salesforce.com/articleView?id=sf.code_dev_console_opening.htm\&type=5).

![](https://948888192-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MUxLOcCRhNqsDd6L6_q%2F-MUxxdvAaxEmu6t06qEI%2F-MUy0FACUI5xqCvk-wNB%2FScreen%20Shot%202021-03-04%20at%2011.14.17%20AM.png?alt=media\&token=c8c67f6a-f26a-47e7-a570-3c8102840491)

{% hint style="info" %}
Before clicking the **"Execute"** button to run your code, ensure that the **Open Log** checkbox option is enabled so that you can confirm the request was successful.
{% endhint %}

```bash

try {
    CalendlyApi.UserResource userResource = CalendlyApi.getCurrentUser();
    
    System.debug('Current User:');
    System.debug(userResource);
} catch (CalendlyApi.CalendlyApiException e) {
    System.debug('Error');
    System.debug(e.title); 
    System.debug(e.message); 
}
```

An **Execution Log** should appear after running the code above; select the **Debug Only** option to filter the logs.

![](https://948888192-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MUxLOcCRhNqsDd6L6_q%2F-MUy4_2KAfpet2Wqry56%2F-MUy5G_XC-RaJoqW-OC2%2FDeveloper%20Console.png?alt=media\&token=5e911fae-ed81-4860-9bfa-27f3e4caf457)

If the request was successful then you should see the user data of the Calendly user who created the personal access token in the Apex execution log.
