Quiltt Logo

JavaScript API

For full control over your experience, Quiltt exposes a JavaScript API to programmatically interact with the Connector.

Documentation

The JavaScript API is written in TypeScript and is fully typed. The complete TypeScript interface is available on Github.

Link to this section#Events

The Connector emits a number of events that can be used to customize the user experience and integrate with your application.

Event TypeDescription
loadedThe Connector has loaded successfully.
exited.successfulThe user successfully completed the flow.
exited.abortedThe user closed the Connector before completing the flow.
exited.erroredThe user experienced an error during the flow.

Link to this section#Event Metadata

All events will return a Metadata object with additional context:

PropertyTypeDescriptionOptional
connectorIdstringThe ID of the Connector emiting the event.No
profileIdstringThe ID of the Profile using the Connector.Yes
connectionIdstringThe ID of the succesfully created or updated Connection.Yes

Link to this section#Subscribing to Events

To handle these events in your application, you can attach the appropriate callback functions to your Connector instance. See the HTML5 and React guides for more information.

CallbackArgumentsDescription
OnEventeventType, metadataRuns on all events.
OnExiteventType, metadataRuns on all Exit events.
OnLoadmetadataRuns on the loaded event.
OnExitSuccessmetadataRuns on the exited.successful event.
OnExitAbortmetadataRuns on the exited.aborted event.
OnExitErrormetadataRuns on the exited.error event.

Link to this section#Examples

Link to this section#Authenticate the Connector

Quiltt.authenticate('<SESSION_TOKEN>')

Link to this section#Launch the Connector

Quiltt.connect('<CONNECTOR_ID>').open()

Link to this section#Repair a Connection

Quiltt.reconnect('<CONNECTOR_ID>', { connectionId: '<ERRORED_CONNECTION_ID>'}).open()

Link to this section#Set up a callback

const connector = Quiltt.connect('<CONNECTOR_ID>')
const onExitSuccessCallback = (metadata) => {
  console.log('Successfully created Connection: ', metadata.connectionId)
}

connector.onExitSuccess(onExitSuccessCallback)
connector.open()

Link to this section#API Reference

See the JavaScript API Reference for a complete list of functions, types and event callbacks.