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 Type | Description |
---|---|
exited.successful | The user successfully completed the flow. |
exited.aborted | The user closed the Connector before completing the flow. |
exited.errored | The user experienced an error during the flow. |
Link to this section#Event Metadata
All events will return a Metadata object with additional context:
Property | Type | Description | Optional |
---|---|---|---|
connectorId | string | The ID of the Connector emiting the event. | No |
connectionId | string | The 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.
Callback | Parameters | Description |
---|---|---|
OnEventExit | Event Type, Metadata | Subscribe to any exit event. |
OnExitSuccess | Metadata | Susbcribe to the exited.successful event. |
OnExitAbort | Metadata | Susbcribe to the exited.aborted event. |
OnExitError | Metadata | Susbcribe 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.