How to Embed Truto Link SDK
Truto allows you to integrate its system within your application using a frontend SDK. This provides your users a seamless experience when connecting their SaaS applications with Truto.
Steps to Embed Truto Link SDK
Generate a Link Token: In order for the SDK to function, it requires a Link Token that needs to be generated from your backend server.
Implement the SDK in your Application: Once you have the Link Token, you can implement the Truto frontend SDK in your application. To install Truto frontend SDK to embed the linking workflow click here. This will open a popup window with an interface for the user to connect their account.
Install the frontend SDK
npm install @truto/truto-link-sdk
# yarn add @truto/truto-link-sdk
Initiate the connection workflow using the SDK
The SDK will create a popup window with the same interface as the magic-link connection workflow allowing the customer to connect their account.
import authenticate from '@truto/truto-link-sdk';
// token received from the server
const linkToken = 'bc8084a0-d745-46bd-9ca8-a9bedee9b8c6';
// authenticate opens a new window with the Truto Link UI, and returns a promise
// which resolves after your customer has successfully connected their account.
// It rejects if the customer closes the window or if there was an error while connecting their account.
authenticate(linkToken).then((response) => {
console.log(response);
// { result: 'success', integration: 'copper' }
}).catch((error) => {
console.log(error);
})
Note: Truto also provides a 'Magic Link' feature. You can check it here. It is a one-time connection link you can share with your customers to connect their SaaS applications with Truto. Once the connection is complete, an 'Integrated Account' is created in your Truto account for that customer.