APIs & Integrations

soccery387
Participant

3rd Party API Key/Authentication

We've created an app which are a series of Custom Workflow Actions.  Right now everything works well, but we have hard-coded the OAuth API Key for the 3rd party technology.

 

We need the ability to capture the OAuth API Key for each installation.  It doesn't make sense to make it an input field on the workflow. 

 

What should we do here?  Is there a way to add it as a text field in the App Settings and then it's passed in with the workflow?

0 Upvotes
6 Replies 6
himanshurauthan
Thought Leader | Elite Partner
Thought Leader | Elite Partner

3rd Party API Key/Authentication

Hello @soccery387 

you can add the OAuth API Key as a configuration option in the app settings, and then access it in the custom workflow actions through the context object.

To do this, you can define the API key as a required configuration option in the manifest.json file for your app, and then retrieve its value in the custom workflow actions using the context.appKey property. The context object is passed as an argument to each action and contains information about the installation and context of the app.

below is an example of manifest.json file:

// manifest.json
{
"configuration": {
"apiKey": {
"type": "string",
"label": "OAuth API Key",
"required": true
}
}
}

// custom workflow action
async function myAction(inputs, options, context) {
const apiKey = context.appKey.apiKey;
// Use the apiKey in your code here
}

By using this method, you can securely store the API key in the app settings and retrieve it when needed in the custom workflow actions.

Thanks & Reagrds
Huimanshu Rauthan

Digital Marketing & Inbound Expert In Growth Hacking Technology
soccery387
Participant

3rd Party API Key/Authentication

@himanshurauthan thank you for your response.  I might be missing something, but where is that manifest.json being sent/put in the Hubspot App? 

0 Upvotes
himanshurauthan
Thought Leader | Elite Partner
Thought Leader | Elite Partner

3rd Party API Key/Authentication

The manifest.json file is a required file for all HubSpot apps and is included in the root directory of your app. The file is used to define the metadata and configuration options for your app, and is used by the HubSpot platform to understand the capabilities and settings of your app.

 

To submit your app to the HubSpot App Marketplace, you will need to zip the entire app directory and upload it to the Marketplace. During the submission process, the manifest.json file will be read and the configuration options will be used to create a settings page for your app in the HubSpot portal.

 

Once your app is installed, users will be able to access the settings page and set the values for the configuration options defined in the manifest.json file, including the OAuth API Key. The values set in the app settings can then be accessed in your custom workflow actions using the context.appKey property, as described in my previous answer.

Digital Marketing & Inbound Expert In Growth Hacking Technology
0 Upvotes
himanshurauthan
Thought Leader | Elite Partner
Thought Leader | Elite Partner

3rd Party API Key/Authentication

The manifest.json file is used to define the configuration options for a Hubspot app. When you create an app in Hubspot, you can specify the configuration options that the app requires by including them in the manifest.json file. The Hubspot platform will then display these options in the app configuration page so that the app user can enter their own values. The myAction function would then use these configuration options to interact with the Hubspot API and perform the desired actions.

Digital Marketing & Inbound Expert In Growth Hacking Technology
0 Upvotes
soccery387
Participant

3rd Party API Key/Authentication

Thank you @Jaycee_Lewis and thank you @JBeatty and @himanshurauthan in advance for any guidance you can provide!

0 Upvotes
Jaycee_Lewis
Community Manager
Community Manager

3rd Party API Key/Authentication

Hey there, @soccery387 👋 Let's see if the community has any experience here — @JBeatty @himanshurauthan do you have any experience here? 

 

Thank you! — Jaycee

linkedin

Jaycee Lewis

Developer Community Manager

Community | HubSpot

0 Upvotes