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
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
connectionIdstringThe ID of the succesfully created or updated ConnectionYes

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.

CallbackParametersDescription
OnEventExitEvent Type, MetadataSubscribe to any exit event.
OnExitSuccessMetadataSusbcribe to the exited.successful event.
OnExitAbortMetadataSusbcribe to the exited.aborted event.
OnExitErrorMetadataSusbcribe to the exited.error event.

Link to this section#Examples

Link to this section#Authenticate the Connector

Quiltt.authenticate('<SESSION_TOKEN>')

Link to this section#Open the Connector

Quiltt.connect('<CONNECTOR_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.onEvent(onExitSuccessCallback)

connector.open()

Link to this section#API Reference

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