The Integry JS SDK requires an App-Key and a hash of App-Secret and User-ID to authenticate calls.
You can view and copy your App-Key and App-Secret from .
User-ID is a unique string identifier for a user in your app. Function Calls and Integrations are associated to a user ID.
If your app has workspaces/accounts and you want integrations to be shared across all users in a workspace/account, use the workspace/account ID as the user ID.
const userId = "USER_ID"; // Your user's ID
const appKey = "YOUR_INTEGRY_APP_KEY";
const hash = "YOUR_GENERATED_HASH";
const integry = new IntegryJS({
appKey,
hash,
user: {
userId: userId,
},
options: {
title: "Apps", //Only relevant if you call showApps()
tags: [],
debug: false,
},
payloads: {
},
});
Emits event
This method emits a ready event if the access credentials are valid.
Listening to Events
Subscribe to an event
Call eventEmitter.on('<event_name>') method​.
integry.eventEmitter.on('app-connected', (data) => {
//do something here
});
Events emitted by the SDK are scoped to the instance on which the eventEmitter object is configured. There is no possibility of naming collision with global events, or even with the same event subscribed on multiple SDK instances.
Unsubscribe from an event
Call eventEmitter.unsub('<event_name>') method.
integry.eventEmitter.on('app-disconnected', (data) => {
//do something here
});
Error Handling
All methods in the Integry JS SDK return Promises. It is recommended to always include .catch() to handle errors gracefully. Here is an example:
integry.connectApp("slack").then((connectedAccountId) => {
console.log("Connected to Slack with account ID:", connectedAccountId);
}).catch((error) => {
console.error("An error occurred:", error);
});
Specifies the mode in which the marketplace will be rendered. Allowed values: IntegryJS.RenderModes.MODAL, IntegryJS.RenderModes.INLINE. Defaults to MODAL if not specified.
false
containerId
string
The ID of the HTML container in which the marketplace content will be rendered.
true if renderMode=IntegryJS.RenderModes.INLINE
layout
string
Specifies the layout. Allowed values: IntegryJS.Layouts.WIDE, IntegryJS.Layouts.NARROW. Defaults to WIDE if not specified.
false
fetchAll
boolean
Determines whether all apps should be fetched at once or retrieved using pagination.
Default:false (uses pagination).
When true, the method fetches all available apps in a single request instead of making paginated API calls.
Use case: Set fetchAll: true if you need to load all the apps at once.
false
useLoadMoreButton
boolean
If set to true, the app list will disable infinite scroll and instead display a "Load More" button at the bottom. Users will need to manually click this button to fetch additional apps.
When false, more results will be automatically loaded as the user scrolls to the end of the list.
false
Emits events
app-connected
Fired when the user successfully connects an app. It includes the app details along with an array of connected_accounts sorted by modified_at in descending order.
Fired when the user disconnects an app. It includes the app details along with an array of remaining connected_accounts(if any) sorted by modified_at in descending order.
Specifies the mode in which the marketplace will be rendered. Allowed values: IntegryJS.RenderModes.MODAL, IntegryJS.RenderModes.INLINE. Defaults to MODAL if not specified.
false
containerId
string
The ID of the HTML container in which the marketplace content will be rendered.
true if renderMode=IntegryJS.RenderModes.INLINE
layout
string
Specifies the layout. Allowed values: IntegryJS.Layouts.WIDE, IntegryJS.Layouts.NARROW. Defaults to WIDE if not specified.
false
Emits events
app-connected
Fired when the user successfully connects an app. It includes the app details along with an array of connected_accounts sorted by modified_at in descending order.
Fired when the user disconnects an app. It includes the app details along with an array of remaining connected_accounts(if any) sorted by modified_at in descending order.
Invokes a UI flow to prompt the user to authenticate with the specified app. After the user connects, Integry verifies that it can access their account. It also refreshes the token, if needed.
integry.connectApp("slack").then((connectedAccountId) => {
console.log("Connected to Slack with account ID:", connectedAccountId);
}).catch((error) => {
console.error("Failed to connect to Slack:", error);
});
Method parameters
Name
Type
Description
Example
Required
appName
string
The name of the app you want the user to connect.
slack
true
Returns
This method returns a connectedAccountId (string).
Disconnect an app
disconnectApp(appName, connectedAccountId)
Disconnects the user's connected account for an app.
integry.disconnectApp("slack").then(() => {
console.log("Successfully disconnected from Slack");
}).catch((error) => {
console.error("Failed to disconnect from Slack:", error);
});
Method parameters
Name
Type
Description
Example
Required
appName
string
The name of the app to disconnect.
slack
true
connectedAccountId
string
The ID of the connected account to delete.
1234
true if the user has multiple connected accounts of this app
Returns
This method returns a Promise which resolves if the account is disconnected.
Check if app is connected
isAppConnected(appName)
Checks if the user has connected the specified app.
integry.isAppConnected("slack").then((result) => {
if(result) {
console.log("User has connected Slack.");
} else {
console.log("User has not connected Slack.");
}
}).catch((error) => {
console.error("Failed to determine auth status:", error);
});
Method parameters
Name
Type
Description
Example
Required
appName
string
The name of the app.
slack
true
Returns
This method returns a boolean result. It will be true if the user has one (or more) connected account(s) with this app.
Get connected accounts of an app
getConnectedAccounts(appName)
Returns a user's connected accounts for an app.
Method parameters
Name
Type
Description
Example
Required
appName
string
The name of the app.
slack
true
Returns
This method returns an array of connected_accounts.
Invokes the specified function of an app with the provided parameters. Integry will automatically include your user's authentication credentials when making the onwards API call.
Integry will not execute the function if the user has not connected an account, or the parameters passed are invalid. These function calls will not show in the Function Calls log.
const params = {
channel: "random",
message: "hello world from the other side"
};
integry.invokeFunction("slack-post-message", params).then((result) => {
console.log("Received response from Slack:", result);
}).catch((error) => {
console.error("Failed to invoke function:", error);
});
Method parameters
Name
Type
Description
Example
Required
functionName
string
The name of the function to execute
slack-post-message
true
params
object
An object containing the function parameters.
{"limit":5}
true
connectedAccountId
string
The connected account to use for executing the action. Only use if the user has connected multiple accounts.
43654
false
Sample params object for pipedrive-add-a-person function call:
{
"name": "Sample contact"
}
The functions which fetch data from an app will often return pages of data and allow you to fetch further data by making subsequent calls. These functions use cursor-based pagination via the next_page parameter that is returned in the result (if there are more pages).
Sample params object for pipedrive-get-all-persons function call with next_page:
If Integry executes the function, this method returns a result object with following keys:
network_code: HTTP response status code of the onwards API call made by Integry.
output: HTTP response body of the onwards API call made by Integry.
next_page: The cursor for the next page. It will only be present in responses of functions that support paginated calls. If there are no more pages, it will be empty.
If Integry does not execute the function, this method returns a result object with following keys:
error: Summary of the error.
error_details[]: Detailed errors for individual fields (if applicable).
Sample responses for pipedrive-add-a-person and pipedrive-get-all-persons:
// Function name: pipedrive-add-a-person
// Outcome: Validation error
{
"network_code": "400",
"output": {
"success": false,
"error": "Validation failed: owner_id: User not found or not accessible.",
"code": "ERR_SCHEMA_VALIDATION_FAILED"
}
}
// Function name: pipedrive-add-a-person
// Outcome: Error -- app was not connected
{
"error": "Could not call the function due to invalid input. Please see `error_details` for further information.",
"error_details": [
"User has not connected their Pipedrive account. To connect an account, please call following SDK method: `connect('pipedrive')`"
]
}
// Function name: pipedrive-add-a-person
// Outcome: Error -- required parameter was missing
{
"error": "Could not call the function due to invalid input. Please see `error_details` for further information.",
"error_details": {
"name": "This parameter is required and must not be null or empty"
}
}
In rare cases where Integry is unable to determine if there are more pages, it will respond with a next_page cursor. Your subsequent call will return an empty output[] and next_page cursor since there are no more pages.
Get a function
getFunction(functionName)
Gets the signature for a specific function to understand the parameters.
integry.getFunction("slack-post-message").then((result) => {
console.log("Function signature:", result);
}).catch((error) => {
console.error("Failed to get function signature:", error);
});
Method parameters
Name
Type
Description
Example
Required
functionName
string
The name of the function to execute
slack-post-message
true
Returns
This method returns a result object with the function's signature.
{
"name": "slack-post-message",
"description": "Post a message in a channel",
"parameters": {
"type": "object",
"properties": {
"text": {
"type": "string",
"description": "The content of the message."
},
"channel": {
"type": "string",
"description": "The channel to send the message in. Call `slack-list-conversations` to get the available values."
},
"as_user": {
"type": "boolean",
"description": "(Legacy) Pass true to post the message as the authed user instead of as a bot. Defaults to false. Can only be used by classic apps."
},
"attachments": {
"type": "string",
"description": "A JSON-based array of structured attachments, presented as a URL-encoded string."
},
"blocks": {
"type": "array",
"description": "A JSON-based array of structured blocks, presented as a URL-encoded string.",
"items": {
"type": "string"
}
},
"icon_emoji": {
"type": "string",
"description": "Emoji to use as the icon for this message. Overrides icon_url."
},
"icon_url": {
"type": "string",
"description": "URL to an image to use as the icon for this message."
},
"link_names": {
"type": "boolean",
"description": "Find and link user groups. No longer supports linking individual users; use syntax shown in Mentioning Users instead."
},
"metadata": {
"type": "string",
"description": "JSON object with event_type and event_payload fields, presented as a URL-encoded string. Metadata you post to Slack is accessible to any app or user who is a member of that workspace."
},
"mrkdwn": {
"type": "boolean",
"description": "Disable Slack markup parsing by setting to false. Enabled by default."
},
"parse": {
"type": "string",
"description": "Change how messages are treated."
},
"reply_broadcast": {
"type": "boolean",
"description": "Used in conjunction with thread_ts and indicates whether reply should be made visible to everyone in the channel or conversation. Defaults to false."
},
"thread_ts": {
"type": "string",
"description": "Provide another message's ts value to make this message a reply. Avoid using a reply's ts value; use its parent instead."
},
"unfurl_links": {
"type": "boolean",
"description": "Pass true to enable unfurling of primarily text-based content."
},
"unfurl_media": {
"type": "boolean",
"description": "Pass false to disable unfurling of media content."
},
"username": {
"type": "string",
"description": "Set your bot's user name."
}
},
"required": [
"text",
"channel"
]
}
}
Show flows in your workspace. You can filter by app. Coming soon!
Show a flow (Coming soon)
showFlow(flowID, renderMode, containerID, layout)
Show a flow in your workspace. Coming soon!
Create an integration (Coming soon)
createIntegration(flowID, mappings)
Create an integration of a flow in your workspace. Coming soon!
Edit an integration (Coming soon)
editIntegration(flowID)
Edit an integration of a flow in your workspace. Coming soon!
Trigger an integration (Coming soon)
triggerIntegration(integrationID, payload)
Trigger an integration of a flow in your workspace. Coming soon!
Call IntegryJS(authentication) with theApp-Key, and User-ID to create an instance of the Integry object.
Some SDK methods emit events (eg. , ) that you can leverage to manipulate the user journey.
Integry supports like Slack, Hubspot, or Jira.
Renders a marketplace-style listing of apps. You can customize the .
Note: If you want to directly connect an app, use.
Renders the app page with connected accounts and flows. You can customize the .
Use this to connect apps if you are not using .
If you use connectApp()to enable your users to connect multiple accounts for an app, you will need to use this ID when you , and .
If your users have connected multiple accounts, use to get their IDs.
Shows a function's parameters (with pre-filled values, if provided). The user can provide/modify the values. Take the output of this method to .
Use it as params to .
Integry will execute the function if the user has already connected their account for the function app, and all required parameters (if any) are provided in params. These function calls will show in the Function Calls log in .