SnapTrade provides two main types of messages to facilitate the integration of its services. These messages include
ERROR messages, as well as a
CLOSED message for users who decide not to continue with the connection process. The way in which these messages can be accessed depends on the implementation being used.
Implementation 1 - Using the snaptrade-react SDK(iframe implementation):
Accessing messages is straight forward for partners who use the
snaptrade-react SDK. The SDK provides access to the messages through callback functions. There are three different callbacks available to handle the different types of messages:
onSuccess- This function is executed when a user successfully connects their institution, and it returns the authorization ID associated with the new connection.
onError- This function is triggered when a user encounters an error while attempting to connect to their institution. The function returns an object containing both an error code, status code, and a detailed description of the error.
onExit- This function is triggered when a user closes the modal or exits the second tab (opened for making an oAuth connection) without successfully connecting to their institution.
Implementation 2 - Not using the snaptrade-react SDK:
- Using React Native in WebView: In this scenario, partners can use the
WebViewcomponent to display a webpage, and then use the
onMessageprop to listen for message events.