Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.useparagon.com/llms.txt

Use this file to discover all available pages before exploring further.

Below are all the public functions exposed on the Paragon SDK, which can be accessed as the named paragon export from @useparagon/connect, and the public endpoints of the Paragon REST API. Install Paragon’s JavaScript SDK with:
npm install @useparagon/connect
The SDK can be imported in your client-side JavaScript files as a module:
JavaScript
import { paragon } from '@useparagon/connect';
If you are using an on-premise instance of Paragon, you can call the paragon.configureGlobal function to point the SDK to use the base hostname of your Paragon instance.
JavaScript
import { paragon } from "@useparagon/connect";

// If your login URL is https://dashboard.mycompany.paragon.so:
paragon.configureGlobal({
  host: "mycompany.paragon.so",
});

SDK Methods

.authenticate

paragon.authenticate should be called at the beginning of your application’s lifecycle in all cases. This is to make sure that the userToken is always as fresh as possible, with respect to your user’s existing session on your own site.
JavaScript
await paragon.authenticate(PROJECT_ID, USER_TOKEN);
Arguments:
PROJECT_ID
string
required
You can find your project ID in the Overview tab of any Integration
USER_TOKEN
string
required
See Setup for how to encode your user token
Once paragon.authenticate has been called, you can access the user’s integration state with paragon.getUser. paragon.authenticate only needs to be called when using the Paragon SDK - when making requests to the Paragon REST API, you should instead provide the Paragon User Token in the Authorization header.

.connect

Call paragon.connect to launch your Connect Portal for a specific integration provider. You can find the integrationType identifier you need in the Overview page for the integration.
JavaScript
paragon.connect(integrationType, installOptions);
Arguments:
integrationType
string
required
Type of integration (i.e. “salesforce”, “hubspot”, “googledrive”)
installOptions
InstallOptions
This function must be called after the Paragon SDK has completed authentication. You can await the Promise returned by paragon.authenticate to show a loading state before users are able to access the Connect Portal. You must have an integration configured of this integrationType in your Paragon project for the Connect Portal to appear. Otherwise, this function does nothing. If your integration uses a Field Mapping User Setting, pass the mapping configuration through installOptions. For examples, see Passing dynamic fields through the SDK. You can also connect multiple accounts for the same integration.

Multi Account Authorization


.subscribe

Call paragon.subscribe to subscribe to different events and changes from the Paragon SDK. You can find the possible eventNames below:
Event TypeUsage in paragon.subscribeUsage in paragon.connect
Integration enabled"onIntegrationInstall""onInstall"
Integration disabled"onIntegrationUninstall""onUninstall"
Workflow state change"onWorkflowChange""onWorkflowChange"
Connect Portal opened"onPortalOpen""onOpen"
Connect Portal closed"onPortalClose""onClose"
Subscribing to SDK Events applies to all integrations globally. Specifying callbacks to paragon.connect only applies to a currently open Connect Portal locally.
JavaScript
paragon.subscribe(eventType, callback);
eventType
string
Event type (i.e. “onIntegrationInstall”, “onPortalOpen”) as seen in the table above
callback
(event: Event, user: AuthenticatedConnectUser) => void
callback function that triggers on event
Examples:
type IntegrationInstallEvent = {
  integrationId: string;
  integrationType: VisibleConnectAction;
  credential: Credential;
  credentialId: string;
};

// Using global subscribe
paragon.subscribe(
  "onIntegrationInstall",
  (event: IntegrationInstallEvent, user: AuthenticatedConnectUser) => {
    /* ... */
  }
);
Alternatively, you can subscribe onOpen, onClose, onUninstall , and onWorkflowChange as a one-time event locally.
type IntegrationInstallEvent = {
  integrationId: string;
  integrationType: VisibleConnectAction;
  credential: Credential;
  credentialId: string;
};

// Using local call to paragon.connect
paragon.connect("<integration>", {
  onInstall: (
    event: IntegrationInstallEvent,
    user: AuthenticatedConnectUser
  ) => {
    /* ... */
  },
});

.installIntegration

This function should be used only if you are using your own components to show connected integrations and their status, instead of the Connect Portal.Otherwise, you can use the paragon.connect function.
The paragon.installIntegration can be used to start the connection process for an integration without the Connect Portal appearing over your user interface. You can find the integrationType identifier you need in the Overview page for the integration. This function resolves with the IntegrationInstallEvent in the same format available in paragon.subscribe. You can use this to get the newly created credential by awaiting the returned Promise. This function rejects the returned Promise if the integration is already installed for the authenticated user.
JavaScript
const { credential } = await paragon.installIntegration(integrationType, installOptions);
integrationType
string
required
Type of integration (i.e. “salesforce”, “hubspot”, “googledrive”)
installOptions
InstallOptions
Note: If the integration specified by integrationType requires API keys or post-authentication options, the Connect Portal will still appear to capture those values from your user at that time. The Connect Portal will automatically be dismissed after those values are entered. This function accepts the same optional install options as paragon.connect.

.uninstallIntegration

Call paragon.uninstallIntegration to disconnect an integration for the authenticated user. When an integration is disconnected, workflows for that integration will stop running for the authenticated user and any saved User Settings will be cleared.
JavaScript SDK
await paragon.uninstallIntegration(integrationType);
Arguments:
integrationType
string
required
The short name for the integration (i.e. “salesforce”, “hubspot”). Use the same name as used in paragon.connect.

.getIntegrationMetadata

Call paragon.getIntegrationMetadata to get the name, brandColor, and icon, for any of your active integration providers. This is a great way to create your integrations page!
JavaScript
paragon.getIntegrationMetadata();
Returns:
data
object[]
required
Example Response:
JavaScript
[
  {
    "type": "salesforce",
    "name": "Salesforce",
    "brandColor": "#057ACF",
    "icon": "https://cdn.useparagon.com/2.35.0/dashboard/public/integrations/salesforce.svg"
  },
  {
    "type": "hubspot",
    "name": "Hubspot",
    "brandColor": "#F67600",
    "icon": "https://cdn.useparagon.com/2.35.0/dashboard/public/integrations/hubspot.svg"
  },
  {
    "type": "slack",
    "name": "Slack",
    "brandColor": "#4A154B",
    "icon": "https://cdn.useparagon.com/2.35.0/dashboard/public/integrations/slack.svg"
  }
]

.getIntegrationConfig

Call paragon.getIntegrationConfig to get the user-facing descriptions, User Settings, and Workflows associated with any integration.
JavaScript
paragon.getIntegrationConfig(integrationType);
Arguments:
integrationType
string
required
An integration type string, like salesforce or slack.
Example Response:
JavaScript
{
  "shortDescription": "Send notifications to Slack",
  "longDescription": "Connect your Slack workspace to receive notifications and alerts in Slack. Stay connected to important activity by bringing it all together in your Slack workspace.\n\nOur Slack integration enables you to:\n\n• Receive alerts and notifications in your Slack workspace\n• Notify or DM specific team members based on certain activity",
  "availableUserSettings": [
    {
      "id": "2d5662c9-6750-46c2-8588-2ac904532efb",
      "type": "DYNAMIC_ENUM",
      "title": "Channel",
      "required": false,
      "sourceType": "channels"
    }
  ],
  "availableWorkflows": [
    {
      "id": "2248335c-671c-47e4-b9a0-3641a9f2d301",
      "inputs": [],
      "infoText": "Send a Slack notification when a Task is created",
      "defaultEnabled": false,
      "description": "Send Slack Notification"
    }
  ],
  "hiddenWorkflows": []
}

.getUser

Call paragon.getUser to retrieve the currently authenticated user and their connected integration state.
JavaScript
paragon.getUser();
Example Response:
JavaScript
{
  authenticated: true,
  userId: "xyz",
  integrations: {
    salesforce: {
      configuredWorkflows: {},
      credentialId: "987654-56a7-89b1-cd23-456789abcdef",
      credentialStatus: "VALID",
      enabled: true,
      providerData: {
        instanceURL: "https://mycompany.my.salesforce.com"
      },
      providerId: "1234567890"
    },
    shopify: {
      configuredWorkflows: {},
      enabled: false
    }
  }
}
If the user is not authenticated, you’ll receive back only { authenticated: false } instead. Please check the authenticated property before using the user.integrations field.

.setUserMetadata

Call paragon.setUserMetadata to associate the authenticated user with metadata from your application. This metadata can be accessed with paragon.getUser or retrieved over the API.
JavaScript SDK
paragon.setUserMetadata(metadata);
Arguments:
metadata
object
required
Metadata object to associate with the authenticated user.
Examples:
paragon.setUserMetadata({
  Name: "Sean V",
  Email: "[email protected]",
  apiKey: "key_Y0kBVldPFInxK",
});

.updateIntegrationUserSettings

Call paragon.updateIntegrationUserSettings to update any integration-level User Settings for your Connected User.
JavaScript
paragon.updateIntegrationUserSettings(integrationType, userSettingsUpdate, options);
Arguments:
integrationType
string
required
An integration type string, like salesforce.
userSettingsUpdate
object
required
A partial update object where the keys are the id properties of User Settings objects (which you can get from getIntegrationConfig) and the values are the user’s selection for the matching input type.Any keys that are not included in the object will not be updated.The type for each value will depend on the input type. See Input Types Reference to see the value type for each input.
Example
{
  "1f7474a5-8b8e-4c25-8d44-29f20aec3fe4": "general"
}
options
CredentialConfigOptions | undefined
Optionally specify a Credential and Configuration to target, if using Multi-Account Authorization or Multi-Configuration.
selectedCredentialId
string
The Credential ID (a UUID) of the connected account you want to update, if using Multi-Account Authorization.
selectedConfigurationId
string
The Configuration ID (a UUID or an External ID prefixed with ext:), if using Multi-Configuration.

.getDataSourceOptions

Call paragon.getDataSourceOptions to get configuration details for compound data sources used for dynamic User Settings types in the Headless Connect Portal. Compound data sources, for Field Mapping and Combo Dropdown inputs, have multiple data sources within them (Field Mappings have both Object Types and Field Names as sources). To load options for a data source, see paragon.getFieldOptions.
SDK 2.3.0+: Consider using paragon.getSourcesForInput instead, which provides a simpler way to get all data sources needed for any input type in a single call.
JavaScript
await paragon.getDataSourceOptions(integrationType, sourceType);
Arguments:
integrationType
string
required
An integration type string, like salesforce.
sourceType
string
required
A source type string, which can be found in the sourceType property of a User Setting object from paragon.getIntegrationConfig or from stage.options of PostOptionsStage.
Examples:
await paragon.getDataSourceOptions(
  "salesforce",
  "customObjectMapping",
);

// Returns:
{
  "id": "customObjectMapping",
  "type": "FIELD_MAPPER_DATA_SOURCE",
  "title": "Field Mapping",
  "subtitle": "Allows users to define a field mapping",
  "recordSource": {
    "type": "DYNAMIC_DATA_SOURCE",
    "title": "Record Type",
    "cacheKey": "recordTypes",
  },
  "fieldSource": {
    "type": "DYNAMIC_DATA_SOURCE",
    "title": "Field",
    "cacheKey": "cachedFields",
  },
}

.getFieldOptions

Load options from an integration data source for dynamic User Settings types in the Headless Connect Portal, using the Connected User’s account. paragon.getFieldOptions can only be called for data sources with type DYNAMIC_DATA_SOURCE (for dynamic enum input types).
  • Compound data sources like FIELD_MAPPER_DATA_SOURCE or COMBO_INPUT_DATA_SOURCE are composed of DYNAMIC_DATA_SOURCE-type sources.
  • When rendering Field Mapping or Combo Dropdown inputs, first identify each data source with paragon.getSourcesForInput (or paragon.getDataSourceOptions), and use the returned data source configuration to call paragon.getFieldOptions. See a full example.
This function supports search and pagination; see the parameters for fieldOptions below to learn more.
JavaScript SDK (Field Mapping)
  await paragon.getFieldOptions(fieldOptions);
Arguments:
fieldOptions
FieldOptions
required
Returns:
data
Option[] | Section[]
required
nestedData
object[]
This section is an empty array for all input types except for Default value mapping, which is only supported by Jira: Issue Field Values.
nextPageCursor
string | null
The cursor value to pass as cursor for the next page of results.
Examples:
await paragon.getFieldOptions({
  integration: "slack",
  action: "channels",
  search: "general",
});

// Returns:
{
  "data": [
    {
      "label": "#general",
      "value": "general"
    },
  ],
  "nestedData": [],
  "nextPageCursor": "dGVhbTpDMDUxWjlNSzk4Vw=="
}

.getSourcesForInput

Call paragon.getSourcesForInput to get all the data sources needed to render a dynamic input (e.g. a picklist loaded from integration data from the user’s connected account). The returned data sources can be passed directly to paragon.getFieldOptions using the source parameter to load options for your input, with pagination and search.
JavaScript
const config = paragon.getIntegrationConfig(integrationType, input);
Arguments:
integrationType
string
required
An integration type string, like salesforce.
input
Input
required
The input object from availableUserSettings, availableWorkflows[n].inputs, or stage.options of an install flow stage.
Returns: Returns null for inputs that don’t require a data source (e.g. text inputs). Otherwise, returns one of the following based on the Input Type of the input:
Returned for DynamicEnum and CustomDropdown input types.
kind
const
required
"single" for SingleSource.
source
DynamicDataSource | StaticEnumDataSource
required
The data source for the input. Pass this to paragon.getFieldOptions using the source parameter to load options.
Example:
DynamicEnum input
const config = paragon.getIntegrationConfig("slack");
const input = config.availableUserSettings[0];
// { id: "...", type: "DYNAMIC_ENUM", title: "Channel", sourceType: "channels" }

const sources = paragon.getSourcesForInput("slack", input);
// { kind: "single", source: { type: "DYNAMIC_DATA_SOURCE", cacheKey: "channels", ... } }

if (sources?.kind === "single") {
  const options = await paragon.getFieldOptions({
    integration: "slack",
    source: sources.source,
  });
  // { data: [{ label: "#general", value: "general" }, ...], nextPageCursor: "..." }
}

.setDataSources

Call paragon.setDataSources to register custom data sources for dropdown and field mapping inputs when using the Headless Connect Portal. This can be used in place of passing dropdowns and mapObjectFields inline with paragon.connect, for Headless Connect Portal implementations. Data sources can be registered globally (applied to all integrations) or for specific integrations. When an integration-specific source exists, it takes priority over a global source with the same key. This function should be called once after paragon.setHeadless and before rendering any inputs.
JavaScript
paragon.setDataSources(config);
Arguments:
config
SetDataSourcesConfig
required

.enableWorkflow

Call paragon.enableWorkflow to turn on a workflow for a user by ID.
JavaScript
paragon.enableWorkflow(workflowId);
Arguments:
workflowId
string
required
Workflow ID

.disableWorkflow

Call paragon.disableWorkflow to turn off a workflow for a user by ID.
JavaScript
paragon.disableWorkflow(workflowId);
Arguments:
workflowId
string
required
Workflow ID

.updateWorkflowState

Call paragon.updateWorkflowState to enable or disable workflows for a user.
JavaScript
paragon.updateWorkflowState(workflowStateUpdate, options);
Arguments:
workflowStateUpdate
object
required
A partial update object where keys are workflow IDs and values are true or false. Any workflow IDs not included in this object will not be updated in this call.
on Example
{
  "bb89897b-ec2a-4118-b091-c12713c6bffa": true,
  "487c67e1-bc3f-406e-acc4-085f897dc564": false,
}
options
CredentialConfigOptions | undefined
Optionally specify a Credential and Configuration to target, if using Multi-Account Authorization or Multi-Configuration.
selectedCredentialId
string
The Credential ID (a UUID) of the connected account you want to update, if using Multi-Account Authorization.
selectedConfigurationId
string
The Configuration ID (a UUID or an External ID prefixed with ext:), if using Multi-Configuration.

.updateWorkflowUserSettings

Call paragon.updateWorkflowUserSettings to update any workflow-level User Settings for your Connected User.
JavaScript
paragon.updateWorkflowUserSettings(integrationType, workflowId, userSettingsUpdate, options);
Arguments:
integrationType
string
required
An integration type string, like salesforce.
workflowId
string
required
The ID of the Workflow that the workflow-level User Setting you are modifying belongs to. If you are trying to modify an integration-level User Setting, call paragon.updateIntegrationUserSettings instead.
userSettingsUpdate
object
required
A partial update object where the keys are the id properties of User Settings objects (which you can get from getIntegrationConfig) and the values are the user’s selection for the matching input type.Any keys that are not included in the object will not be updated.The type for each value will depend on the input type. See Input Types Reference to see the value type for each input.
Example
{
  "1f7474a5-8b8e-4c25-8d44-29f20aec3fe4": "general"
}
options
CredentialConfigOptions | undefined
Optionally specify a Credential and Configuration to target, if using Multi-Account Authorization or Multi-Configuration.
selectedCredentialId
string
The Credential ID (a UUID) of the connected account you want to update, if using Multi-Account Authorization.
selectedConfigurationId
string
The Configuration ID (a UUID or an External ID prefixed with ext:), if using Multi-Configuration.

.getCustomWebhookUserManualUrl

If you are using Custom Webhooks with a User-Level URL and Manual Setup, you can use paragon.getCustomWebhookUserManualUrl to construct the user-specific URL that must be registered by your customer in the integration to complete webhook setup. There is no API endpoint available for this method. However, you can construct the user-specific URL without the JavaScript SDK as described in the Custom Webhooks docs.
JavaScript
// Present this value to your user to register this webhook in their account manually
const webhookUrl = paragon.getCustomWebhookUserManualUrl(workflowId, credentialId);
Arguments:
workflowId
string
required
The ID of a Workflow that utilizes this Custom Webhook. If the same Custom Webhook is used in multiple Workflows, any one of these workflows can be used as workflowId.
credentialId
string
If you are using Multi-Account Authorization and there may be more than one account connected for a given integration, pass the credentialId to ensure that received events are routed to the correct account.

.workflow

Call paragon.workflow to trigger a Paragon workflow that sends a custom response back to your app. Note: The workflow must be enabled and use a Request-type trigger.
JavaScript
await paragon.workflow(workflowId, options);
Arguments:
workflowId
string
required
The ID of the workflow to trigger.
options
FetchOptions
Example:
paragon.authenticate(PROJECT_ID, PARAGON_USER_TOKEN);

await paragon.workflow(WORKFLOW_ID, {
  "body": {
    "email": "[email protected]",
    "first_name": "Bowie",
    "last_name": "Foo"
  }
});

.request

Call paragon.request to send an API request to a third-party integration on behalf of one of your users. Every integration in your dashboard has a code example of using paragon.request.
JavaScript
await paragon.request(integrationType, path, requestOptions);
Arguments:
integrationType
string
required
The short name for the integration (i.e. “salesforce” or “googleCalendar”). You can find this string on the Overview tab of the integration you want to access, on your Paragon dashboard.
path
string
required
The path (without the hostname) of the API request you are trying to access. An example might be: “/v1/charges” for Stripe’s charge API or “chat.postMessage” for Slack’s Web API.
requestOptions
object
Optional request options to include:If requestOptions is omitted, the SDK issues a GET request without a body.
The function returns a promise for the request output, which will have a shape that varies depending on the integration and API endpoint. Examples:
await paragon.request('slack', '/chat.postMessage', {
	method: 'POST',
	body: {
		channel: 'CXXXXXXX0' // Channel ID,
		text: 'This message was sent with Paragon Connect :exploding_head:'
	}
});

// -> Responds with { ok: true }, and sends a message :)

.event

App Events can be sent from your application using the Paragon SDK or REST API. In both cases, you must pass two parameters:
  • name - the event name defined in your App Event
  • payload - the event payload that should match the event schema defined in your App Event
See the code examples below for how to send App Events using the Paragon SDK or API.
JavaScript
var eventName = "Contact Created";
var eventPayload = { "name": "Brandon", "email": "[email protected]" };

paragon.event(eventName, payload);
Arguments:
eventName
string
required
The event name defined in your App Event
payload
object
required
The event payload that should match the event schema defined in your App Event
When sending live events from your application, Paragon will not validate that your event payload matches the defined event schema.

.setHeadless

Call paragon.setHeadless to enable or disable Headless mode for the SDK. When headless mode is enabled, the SDK will not render the Connect Portal UI and will instead expose functions for you to build your own UI.
JavaScript
paragon.setHeadless(true);
This should be called once after SDK initialization. See the Headless Connect Portal guide for more details.

API Only

GET project’s integrations

Returns a list of the integrations enabled for the Paragon project by the ID in the URL.
  • Includes the Connect Portal configuration for each integration (as .configs) and the Workflows associated with each integration (as .workflows)
You can use paragon.getIntegrationMetadata and paragon.getIntegrationConfig when using the JavaScript SDK.
HTTP
GET https://api.useparagon.com/projects/PROJECT_ID/sdk/integrations

Authorization: Bearer PARAGON_USER_TOKEN
Content-Type: application/json

// Example response (may include more than is in this list):

[{
  "id": "2f08e65f-d924-42ab-9618-b6023d82ffbd",
  "projectId": "908f4c5e-6394-46a5-9355-3f729edbd160",
  "customIntegrationId": null,
  "type": "slack",
  "isActive": true,
  "configs": [
    {
      "id": "3ebcc179-a1a6-447f-8dc9-5017f40f08ef",
      "values": {
        "overview": "####Our Slack integration enables you to:\n   \n\n• Receive alerts and notifications in your Slack workspace\n• Notify or DM specific team members based on certain activity",
        "sharedMeta": {},
        "accentColor": "#4A154B",
        "description": "Send notifications to Slack",
        "workflowMeta": {}
      }
    },
  ],
  "workflows": [
    {
      "id": "1b22193b-e355-458d-b6a3-5e5516edb588",
      "description": "Send Updates to Slack",
      "projectId": "908f4c5e-6394-46a5-9355-3f729edbd160",
      "integrationId": "2f08e65f-d924-42ab-9618-b6023d82ffbd",
      "steps": []
    }
  ],
  "customIntegration": null,
  "hasCredential": true,
  "connectedUserLimitOnDevCred": 0,
  "connectedUserLimitReached": true,
  "name": "Slack",
  "brandColor": "#4A154B",
  "needPreOauthInputs": false,
  "providerType": "slack",
  "authenticationType": "oauth"
}]
Arguments:
PROJECT_ID
string
required
You can find your project ID in the Overview tab of any Integration
PARAGON_USER_TOKEN
string
required
See Setup for how to encode your user token

GET user’s Connect credentials

Returns a list of the user’s Connect credentials (i.e., the accounts connected and authorized by the end user).
  • The providerId is the authenticated user’s ID assigned by their integration provider (e.g. for a Salesforce integration, this would be the user’s Salesforce user ID)
This method is currently available via REST API only.
HTTP
GET https://api.useparagon.com/projects/PROJECT_ID/sdk/credentials

Authorization: Bearer PARAGON_USER_TOKEN
Content-Type: application/json

// Example response (may include more than is in this list):

[{
  "id": "00da4146-7ac4-4253-a8f7-96849b8137d9",
  "dateCreated": "2021-03-24T12:19:21.511Z",
  "dateUpdated": "2021-03-24T12:19:28.512Z",
  "dateDeleted": null,
  "projectId": "db06d291-ba2c-41c5-9a12-9362abfd6228",
  "integrationId": "95bedc9f-6a22-4855-b08d-e68dc073ad91",
  "personaId": "0563109f-5e71-46c5-8483-1ac8c0913d6c",
  "config": {
    "configuredWorkflows": {
      "3eb95154-3c7b-413c-bf14-ba367d95b53f": {
        "enabled": true,
        "settings": {
					"example-input-id": "example value"
				}
      }
    }
  },
  "isPreviewCredential": false,
  "providerId": "50150244515"
}]
Arguments:
PROJECT_ID
string
required
You can find your project ID in the Overview tab of any Integration
PARAGON_USER_TOKEN
string
required
See Setup for how to encode your user token

UPDATE user’s Connect credential

Updates the user’s connected integration account, including any settings and configured workflows. This endpoint updates by replacement with respect to the config property, so this endpoint should only be used after retrieving the existing value (which can be done by using the above endpoint: Get user’s Connect credentials). Alternatively, you can use the SDK to update User Settings or workflow enablements:
HTTP
PATCH https://api.useparagon.com/projects/PROJECT_ID/sdk/credentials/CREDENTIAL_ID

Authorization: Bearer <Paragon User Token>
Content-Type: application/json

// Body: Example showing WORKFLOW_ID being enabled
{
    "config": {
        "configuredWorkflows": {
            ...
            WORKFLOW_ID: {
                "enabled": true,
                "settings": {}
            }
        },
        "sharedSettings": {...}
    }
}
Arguments:
PROJECT_ID
string
required
You can find your project ID in the Overview tab of any Integration
CREDENTIAL_ID
string
required
The ID of the Connect credential to update. Retrieve it from the /sdk/credentials endpoint.
PARAGON_USER_TOKEN
string
required
See Setup for how to encode your user token
config
object
required
The configuration object to update. This will replace the existing config property entirely, so you must provide the full existing value with your intended changes applied.
Note: In the above example, the existing value for config must be provided in full, with the intended changes applied. This is because config will be updated by replacement.

Headless Connect installFlow

Use installFlow when implementing the Headless Connect Portal to guide your user through the installation process for an integration. InstallFlowStage: These are the possible install flow stages received in the onNext callback of InstallFlow that should be rendered by your app to guide the user through the installation process.
In the AccountTypeStage, the user should be prompted with a list of account types that they can choose from.If you want to skip this stage, pass the first account type option (or "default") to paragon.installFlow.setAccountType to move to the next stage.
Example (Salesforce)
{
  "stage": "accountType",
  "options": [
    { "id": "default", "accountDescription": "Production Account" },
    { "id": "sandbox", "accountDescription": "Sandbox Account"}
  ]
}
stage
const
"accountType" for AccountTypeStage.
options
AccountType[]
The list of account types that the user can choose from.

.installFlow.start

Call paragon.installFlow.start to begin an install flow for an integration. See an example call.
JavaScript
paragon.installFlow.start(integrationType, options);
Arguments:
integrationType
string
required
The integration type string, like salesforce.
options
object
required

.installFlow.setAccountType

Call paragon.installFlow.setAccountType when the user selects an account type in the AccountTypeStage.
JavaScript
paragon.installFlow.setAccountType(accountType);
Arguments:
accountType
string
required
The account type to set. This should be the id property of the Account Type option that the user selected.

.installFlow.setPreOptions

Call paragon.installFlow.setPreOptions when the user finishes providing inputs in the PreOptionsStage.
JavaScript
await paragon.installFlow.setPreOptions(values);
This returns a Promise that resolves when the values are saved. Upon success, the install flow will move to the next stage and call onNext. If there is no stage after the PreOptionsStage, the install flow will call onComplete. Arguments:
values
object
required
The values to set for the inputs in the PreOptionsStage.This should be an object, where the keys are ids of the inputs in the PreOptionsStage, and the values are the values that the user provided for each input.
Example (Shopify)
{
  "SHOP_NAME": "my-shop"
}

.installFlow.setPostOptions

Call paragon.installFlow.setPostOptions when the user finishes providing inputs in the PostOptionsStage.
JavaScript
await paragon.installFlow.setPostOptions(values);
This returns a Promise that resolves when the values are saved. Upon success, the install flow will be completed and call onComplete. Arguments:
values
object
required
The values to set for the inputs in the PostOptionsStage.This should be an object, where the keys are ids of the inputs in the PostOptionsStage, and the values are the values that the user provided for each input.
Example (Jira)
{
  "JIRA_CLOUD_ID": "my-jira-cloud-id"
}

.installFlow.cancel

Call paragon.installFlow.cancel if your user abandons the integration connection process during an active install flow. This function resets the state for installFlow to begin again at another time.
JavaScript
paragon.installFlow.cancel();
If your user has completed an OAuth connection but has not completed required post-OAuth options, this function will remove the credential with status "PENDING" automatically by calling paragon.uninstallIntegration.However, if the page has been refreshed or the SDK has been reloaded since the pending credential was connected, you will need to call paragon.uninstallIntegration manually to disconnect the pending credential from your user.

External File Picker

You can use the Paragon SDK to allow your user to select files from a File Storage integration in your app. The SDK provides an ExternalFilePicker class to load any necessary JavaScript dependencies into your page and authenticate with your user’s connected account. Supported integrations for ExternalFilePicker:

.ExternalFilePicker

Construct a new instance of an ExternalFilePicker for an integration given by integrationType. Any required JS dependencies do not start loading until picker.init is called.
JavaScript
const picker = new paragon.ExternalFilePicker(integrationType, options);
Arguments:
integrationType
string
required
Type of integration (i.e. “googledrive”, “onedrive”, “sharepoint”, “box”)
options
object
Example:
JavaScript
const picker = new paragon.ExternalFilePicker("googledrive", {
  allowedTypes: ["application/pdf"],
  allowMultiSelect: false,
  onFileSelect(files) {
    console.log("User picked files", files);
  },
});

picker.init

Initialize a file picker with required configuration initConfig. Required configuration varies per integration; see integration-specific documentation for specific details. This function loads required JS dependencies into the page, if they have not already been loaded. Other methods, like picker.open and picker.getInstance, cannot be called until the Promise returned by picker.init is resolved.
JavaScript
await picker.init(initConfig);
Arguments:
initConfig
object
required
Example:
JavaScript
await picker.init({
  developerKey: "AIzaS...",
});

picker.open

Presents the file picker in your app. Selected files or other events will be received in the callbacks you specified in the constructor.
JavaScript
picker.open();

picker.getInstance

Returns a reference to the third-party JS library object that this file picker is using. This object can be used for additional integration-specific customization.
JavaScript
const instance = picker.getInstance();