From 3514f90bdc5c3efa3aaee3defc722c6c884ce9b8 Mon Sep 17 00:00:00 2001 From: Thisaru Guruge Date: Thu, 17 Apr 2025 17:35:07 +0530 Subject: [PATCH 1/3] Downgrade The Ballerina Gradle Plugin Version --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 5b88d03..6fa8439 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,5 +3,5 @@ group=io.ballerina.lib version=2.0.0-SNAPSHOT releasePluginVersion=2.8.0 -ballerinaGradlePluginVersion=3.0.0 +ballerinaGradlePluginVersion=2.3.0 ballerinaLangVersion=2201.12.2 From a0d1bc2e908defcfa1e99686a0ae65123c256228 Mon Sep 17 00:00:00 2001 From: Thisaru Guruge Date: Thu, 17 Apr 2025 18:24:00 +0530 Subject: [PATCH 2/3] Rename Package.md to README.md --- ballerina/Package.md | 180 ----------------------------- ballerina/{Module.md => README.md} | 0 2 files changed, 180 deletions(-) delete mode 100644 ballerina/Package.md rename ballerina/{Module.md => README.md} (100%) diff --git a/ballerina/Package.md b/ballerina/Package.md deleted file mode 100644 index bacd761..0000000 --- a/ballerina/Package.md +++ /dev/null @@ -1,180 +0,0 @@ -## Overview - -[HubSpot](https://www.hubspot.com) is an AI-powered customer relationship management (CRM) platform. - -The `ballerinax/module-ballerinax-hubspot.marketing.campaigns` connector offers APIs to connect and interact with the [Hubspot Marketing Campaigns API](https://developers.hubspot.com/docs/guides/api/marketing/campaigns) endpoints, specifically based on the [HubSpot REST API](https://developers.hubspot.com/docs/reference/api/overview) - -## Setup guide - -To use the HubSpot Marketing Campaigns connector, you must have access to the HubSpot API through a HubSpot developer account and a HubSpot App under it. Therefore you need to register for a developer account at HubSpot if you don't have one already. - -### Step 1: Create/Login to a HubSpot Developer Account - -If you have an account already, go to the [HubSpot developer portal](https://developers.hubspot.com/) - -If you don't have a HubSpot Developer Account you can sign up to a free account [here](https://developers.hubspot.com/get-started) - -### Step 2 (Optional): Create a Developer Test Account -Within app developer accounts, you can create a [developer test account](https://developers.hubspot.com/docs/getting-started/account-types#developer-test-accounts) under your account to test apps and integrations without affecting any real HubSpot data. - -> **Note**: These accounts are only for development and testing purposes. In production you should not use Developer Test Accounts. - - 1. Go to Test accounts section from the left sidebar. - -![Test Account](https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-hubspot.marketing.campaigns/main/docs/setup/resources/testAccount.png) - - 2. Click on the Create developer test account button on the top right corner. - -![Development Test Account](https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-hubspot.marketing.campaigns/main/docs/setup/resources/developmentTestAccount.png) - - 3. In the pop-up window, provide a name for the test account and click on the Create button. - -![Create Account](https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-hubspot.marketing.campaigns/main/docs/setup/resources/createAccount.png) - - 4. You will see the newly created test account in the list of test accounts. - -![Test Account Portal](https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-hubspot.marketing.campaigns/main/docs/setup/resources/testAccountPortal.png) - -### Step 3: Create a HubSpot App - - 1. Navigate to the Apps section from the left sidebar and click on the Create app button on the top right corner. - -![App Section](https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-hubspot.marketing.campaigns/main/docs/setup/resources/appSection.png) - - 2. Provide a public app name and description for your app. - -![Naming the App](https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-hubspot.marketing.campaigns/main/docs/setup/resources/namingApp.png) - -### Step 4: Setup Authentication - - 1. Move to the Auth tab. - -![Auth Section](https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-hubspot.marketing.campaigns/main/docs/setup/resources/auth.png) - - 2. In the Scopes section, add the following scopes for your app using the Add new scopes button. - - `marketing.campaigns.read` - - `marketing.campaigns.revenue.read` - - `marketing.campaigns.write` - -![Marketing Scopes](https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-hubspot.marketing.campaigns/main/docs/setup/resources/marketingScopes.png) - - 3. In the Redirect URL section, add the redirect URL for your app. This is the URL where the user will be redirected after the authentication process. You can use `localhost` for testing purposes. Then click the "Create App" button. - -![Redirect URL](https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-hubspot.marketing.campaigns/main/docs/setup/resources/redirectURL.png) - -### Step 5: Get the Client ID and Client Secret - -Navigate to the Auth tab and you will see the `Client ID`, and `Client Secret` for your app. Make sure to save these values. - -![Client ID and Client Secret](https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-hubspot.marketing.campaigns/main/docs/setup/resources/clientId_secretId.png) - -### Step 6: Setup Authentication Flow - -Before proceeding with the Quickstart, ensure you have obtained the Access Token using the following steps: - - 1. Create an authorization URL using the following format: - - ``` - https://app.hubspot.com/oauth/authorize?client_id=&scope=&redirect_uri= - ``` - Replace the ``, ``, and `` with your specific value. - - 2. Paste it in the browser and select your developer test account to intall the app when prompted. - - ![Account Select](https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-hubspot.marketing.campaigns/main/docs/setup/resources/accountSelect.png) - - 3. A code will be displayed in the browser. Copy the code. - - 4. Run the following curl command. Replace the ``, ``, and `` with your specific value. Use the code you received in the above step 3 as the CODE below - - - Linux/macOS - ```bash - curl --request POST \ ---url https://api.hubapi.com/oauth/v1/token \ ---header 'content-type: application/x-www-form-urlencoded' \ ---data 'grant_type=authorization_code&code=&redirect_uri=&client_id=&client_secret=' - ``` - - - Windows - ```bash -curl --request POST ^ ---url https://api.hubapi.com/oauth/v1/token ^ ---header 'content-type: application/x-www-form-urlencoded' ^ ---data 'grant_type=authorization_code&code=&redirect_uri=&client_id=&client_secret=' - ``` - -This command will return the access token necessary for API calls. - -```json -{ - "token_type": "bearer", - "refresh_token": "", - "access_token": "", - "expires_in": 1800 -} -``` - - 5. Store the access token securely for use in your application. - - -## Quickstart - -To use the HubSpot Marketing Campaigns connector in your Ballerina application, update the `.bal` file as follows: - -### Step 1: Import the module - -Import the `ballerinax/hubspot.marketing.campaigns` module and `ballerina/oauth2` module. - -```ballerina -import ballerinax/hubspot.marketing.campaigns as hsmcampaigns; -import ballerina/oauth2; -``` - -### Step 2: Instantiate a new connector - - 1. Create a `Config.toml` file and, configure the obtained credentials in the above steps as follows: - -```toml - clientId = - clientSecret = - refreshToken = -``` - - 2. Instantiate a `hsmcampaigns:ConnectionConfig` with the obtained credentials and initialize the connector with it. - -```ballerina -configurable string clientId = ?; -configurable string clientSecret = ?; -configurable string refreshToken = ?; - -final hsmcampaigns:ConnectionConfig hsmcampaignsConfig = { - auth : { - clientId, - clientSecret, - refreshToken, - credentialBearer: oauth2:POST_BODY_BEARER - } -}; - -final hsmcampaigns:Client hsmCampaignsClient = check new (hsmcampaignsConfig); -``` - -### Step 3: Invoke the connector operation - -Now, utilize the available connector operations. A sample usecase is shown below. - -Retrieve a Marketing Campaign - -```ballerina -public function main() returns error? { - hsmcampaigns:CollectionResponseWithTotalPublicCampaignForwardPaging campaigns = check hsmCampaignsClient->/marketing/v3/campaigns.get(); -} -``` - - -## Examples - -The `HubSpot Marketing Campaigns ` connector provides practical examples illustrating usage in various scenarios. Explore these [examples](https://github.com/ballerina-platform/module-ballerinax-hubspot.marketing.campaigns/tree/main/examples), covering the following use cases: - -1. [Batch of Campaigns](https://github.com/ballerina-platform/module-ballerinax-hubspot.marketing.campaigns/tree/main/examples/batch_of_campaigns) - Fully manage a batch of campaigns -2. [Campaign Lifecycle with Assets](https://github.com/ballerina-platform/module-ballerinax-hubspot.marketing.campaigns/tree/main/examples/campaign_lifecycle_with_assets) - Full life cycle of a campaign associated with assets such as forms diff --git a/ballerina/Module.md b/ballerina/README.md similarity index 100% rename from ballerina/Module.md rename to ballerina/README.md From 43ecdc0024be46ce7dba6b3a88a5b45d05498540 Mon Sep 17 00:00:00 2001 From: Thisaru Guruge Date: Fri, 9 May 2025 13:09:51 +0530 Subject: [PATCH 3/3] Rename Package.md to README.md --- .../workflows/build-with-bal-test-graalvm.yml | 17 ----------------- .github/workflows/trivy-scan.yml | 13 ------------- README.md | 2 -- 3 files changed, 32 deletions(-) delete mode 100644 .github/workflows/build-with-bal-test-graalvm.yml delete mode 100644 .github/workflows/trivy-scan.yml diff --git a/.github/workflows/build-with-bal-test-graalvm.yml b/.github/workflows/build-with-bal-test-graalvm.yml deleted file mode 100644 index 374d64f..0000000 --- a/.github/workflows/build-with-bal-test-graalvm.yml +++ /dev/null @@ -1,17 +0,0 @@ -name: GraalVM Check - -on: - schedule: - - cron: "30 18 * * *" - workflow_dispatch: - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }} - cancel-in-progress: true - -jobs: - call_stdlib_workflow: - name: Run StdLib Workflow - if: ${{ github.event_name != 'schedule' || (github.event_name == 'schedule' && github.repository_owner == 'ballerina-platform') }} - uses: ballerina-platform/ballerina-library/.github/workflows/build-with-bal-test-graalvm-connector-template.yml@2201.10.x - secrets: inherit diff --git a/.github/workflows/trivy-scan.yml b/.github/workflows/trivy-scan.yml deleted file mode 100644 index c29d8f2..0000000 --- a/.github/workflows/trivy-scan.yml +++ /dev/null @@ -1,13 +0,0 @@ -name: Trivy - -on: - workflow_dispatch: - schedule: - - cron: "30 20 * * *" - -jobs: - call_workflow: - name: Run Trivy Scan Workflow - if: ${{ github.repository_owner == 'ballerina-platform' }} - uses: ballerina-platform/ballerina-library/.github/workflows/trivy-scan-template.yml@2201.10.x - secrets: inherit diff --git a/README.md b/README.md index e9849c6..cd36e2f 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,6 @@ # Ballerina HubSpot Marketing Campaigns Connector [![Build](https://github.com/ballerina-platform/module-ballerinax-hubspot.marketing.campaigns/actions/workflows/ci.yml/badge.svg)](https://github.com/ballerina-platform/module-ballerinax-hubspot.marketing.campaigns/actions/workflows/ci.yml) -[![Trivy](https://github.com/ballerina-platform/module-ballerinax-hubspot.marketing.campaigns/actions/workflows/trivy-scan.yml/badge.svg)](https://github.com/ballerina-platform/module-ballerinax-hubspot.marketing.campaigns/actions/workflows/trivy-scan.yml) -[![GraalVM Check](https://github.com/ballerina-platform/module-ballerinax-hubspot.marketing.campaigns/actions/workflows/build-with-bal-test-graalvm.yml/badge.svg)](https://github.com/ballerina-platform/module-ballerinax-hubspot.marketing.campaigns/actions/workflows/build-with-bal-test-graalvm.yml) [![GitHub Last Commit](https://img.shields.io/github/last-commit/ballerina-platform/module-ballerinax-hubspot.marketing.campaigns.svg)](https://github.com/ballerina-platform/module-ballerinax-hubspot.marketing.campaigns/commits/master) [![GitHub Issues](https://img.shields.io/github/issues/ballerina-platform/ballerina-library/module/hubspot.marketing.campaigns.svg?label=Open%20Issues)](https://github.com/ballerina-platform/ballerina-library/labels/module%hubspot.marketing.campaigns)