Events
The SDK emits a number of different events when it loads, a user connects an account, sets up an integration, etc. You can leverage these events to plug in your own logic in the user journey.
Note: Events emitted by the SDK are scoped to the instance on which the eventEmitter
object is configured. There is no possiblilty of naming collision with global events, or even with the same event subscribed on multiple SDK instances.
This article lists all the events that can be leveraged, and explains how to subscribe and unsubscribe to/from them.
Marketplace initialized
eventEmitter.on('ready')
Fired when the SDK finishes initialization by authorizing the client. This event is not fired if the credentials provided are incorrect.
Account connected
eventEmitter.on('did-add-authorization')
Fired when an authorization is added successfully in the flow setup form. You can use the alreadyExists
key to check if a user is adding a previously connected account again.
Account disconnected
eventEmitter.on('did-remove-authorization')
Fired when an authorization is deleted in the flow setup form.
Integration created
eventEmitter.on('did-save-integration')
Fired when an integration is saved successfully. If a user edits an existing integration and saves it, this will fire again.
Integration enabled
eventEmitter.on('did-enable-integration')
Fired when an integration is enabled using the toggle on integrations listing screen.
Integration disabled
eventEmitter.on('did-disable-integration')
Fired when an integration is disabled using the toggle on integrations listing screen.
Integration renamed
eventEmitter.on('did-rename-integration')
Fired when an integration is renamed.
Integration deleted
eventEmitter.on('did-delete-integration')
Fired when an integration is deleted successfully.
Subscribe to an event
Call eventEmitter.on('<event_name>')
method to subscribe to an event.
For example, here's how you would subscribe to the did-save-integration event to get the callback URL you need to run the integration.
Unsubscribe from an event
Call eventEmitter.unsub('<event_name>')
method to unsubscribe from an event.
Here's an example:
Last updated