Module hubspot.files

vishwaj/hubspot.files

0.1.0
hubspot.files Connector

Overview

HubSpot is a leading CRM platform that provides tools for marketing, sales, customer service, and content management, helping businesses grow by centralizing their customer data and workflows.

The ballerinax/hubspot.files package offers APIs to connect and interact with the HubSpot Files API endpoints, specifically based on HubSpot Files API v3.

Setup guide

To use the HubSpot Files connector, you must have access to the HubSpot API through a HubSpot developer account and obtain a private app access token. If you do not have a HubSpot account, you can sign up for one here.

Step 1: Create a HubSpot Account

  1. Navigate to the HubSpot website and sign up for an account or log in if you already have one.

  2. Ensure you have a suitable subscription plan. Access to the Files API and private app creation is available on all HubSpot plans, including the free tier; however, certain advanced file management features and higher API rate limits are restricted to users on Starter, Professional, or Enterprise plans.

Step 2: Generate a Private App Access Token

  1. Log in to your HubSpot account.

  2. In the main navigation, click the Settings icon (gear icon) in the top right corner of the page.

  3. In the left sidebar menu, scroll down and navigate to Integrations > Private Apps.

  4. Click Create a private app in the top right corner.

  5. On the Basic Info tab, provide a name and description for your private app.

  6. Navigate to the Scopes tab and select the required scopes for the Files connector. Search for and enable the relevant scopes such as files and files.ui_hidden.read to allow read and write access to the HubSpot Files tool.

  7. Click Create app in the top right corner, then confirm by clicking Continue creating in the dialog that appears.

  8. After the app is created, your access token will be displayed. Click Copy to copy the token to your clipboard.

Tip: You must copy and store this key somewhere safe. It won't be visible again in your account settings for security reasons.

Quickstart

To use the hubspot.files connector in your Ballerina application, update the .bal file as follows:

Step 1: Import the module

Copy
import ballerina/oauth2;
import ballerinax/hubspot.files as hubspotfiles;

Step 2: Instantiate a new connector

  1. Create a Config.toml file and configure the obtained credentials:
Copy
clientId = "<Your_Client_Id>"
clientSecret = "<Your_Client_Secret>"
refreshToken = "<Your_Refresh_Token>"
  1. Create a hubspotfiles:ConnectionConfig and initialize the client:
Copy
configurable string clientId = ?;
configurable string clientSecret = ?;
configurable string refreshToken = ?;

final hubspotfiles:Client hubspotFilesClient = check new({
    auth: {
        clientId,
        clientSecret,
        refreshToken
    }
});

Step 3: Invoke the connector operation

Now, utilize the available connector operations.

Create a new folder

Copy
public function main() returns error? {
    hubspotfiles:FolderInput newFolder = {
        name: "Marketing Assets",
        parentPath: "/campaigns"
    };

    hubspotfiles:Folder response = check hubspotFilesClient->postFilesV3FoldersCreate(newFolder);
}

Step 4: Run the Ballerina application

Copy
bal run

Examples

The hubspot.files connector provides practical examples illustrating usage in various scenarios. Explore these examples, covering the following use cases:

Import

import vishwaj/hubspot.files;Copy

Other versions

0.1.1

0.1.0

Metadata

Released date: 26 days ago

Version: 0.1.0

License: Apache-2.0


Compatibility

Platform: any

Ballerina version: 2201.13.4

GraalVM compatible: Yes


Pull count

Total: 2

Current verison: 1


Weekly downloads


Source repository


Contributors