Managing Accounts
Introduction
Flows and Accounts
A Flow can involve multiple apps, and accounts need to be added for those apps. Until now, your users could only add accounts when setting up the integration. Integry now supports treating app accounts as a first-party entity.
Set up first, use later
This feature allows end-users to add their accounts independent of an integration. They will be able to set up accounts first, and use them in integrations later.
Configuration
To use the new account management feature, call the renderAccountConnectionModal
method. This will render a modal window where a list of apps will be shown. The apps shown are filtered according to the following rules:
- The app is not your own app
- The app is used in one or more published Flows that are inside any active deployment
- If a
deploymentId
is specified, the app is in a published Flow inside that particular deployment
Code Sample
<body>
<div id="my-integry-container"></div>
</body>
<!-- ... -->
<script>
window.addEventListener('DOMContentLoaded', async function () {
const sdkInstance = new IntegryJS({
appId: '<app_id>',
deploymentId: '<deployment_id>',
userId: '<user_id>',
hash: '<hash>',
});
// initialize integration view in our container
sdkInstance.renderAccountConnectionModal({
deploymentId: '<deployment_id>',
});
});
</script>
The configuration object is optional.
Applicable Events
Two SDK events are involved in the account management feature.
did-add-authorization
This event is emitted when the account is added successfully and is verified using a protected API call.
mySDKInstance.eventEmitter.on('did-add-authorization', (data) => {
/**
* data:
* identity: string;
* authorizationId: number;
* flowId?: number;
* alreadyExists: boolean;
*/
});
did-fail-authorization-verification
This event is emitted when Integry tries to use the account that was added in a protected API call and the call fails to produce a 200 OK
.
mySDKInstance.eventEmitter.on('did-fail-authorization-verification', (data) => {
/**
* data:
* identity: string;
* authorizationId: number;
* flowId?: number;
* alreadyExists: boolean;
*/
});
The SDK shows a default prompt showing success or failure of the account addition process. To hide this prompt and show your own by leveraging the SDK events, you can set the following property in the userConfig
object:
userConfig: {
hideAppConnectionModal: true;
}