Event names contained in the onMessage handler call methods that correspond to their name by prepending with "on" and using camel case. So, to execute code upon receipt of the launch
event, use the onLaunch()
method. The complete
event uses the onComplete()
method. Etc.
eventData
object in it's response.
eventData = { name: eventName, CONNECTComplete: bool, CONNECTType: string, inquiryId: guid, inquiryType: string, accountToken: guid, account: { bankId: int, bankName: string, accountType: string, accountNickname: string, last4Digits: string } }
const CONNECT = new RIBBITConnect({ target: 'ribbit', // id of any element within the </body> which you want CONNECT to initialize within token: '{Session Token}', // see documentation on how to get a session token }); CONNECT.open(); CONNECT.onExit((eventData) => { const message = { type: 'EXIT', eventData}; console.log({message}); //window.ReactNativeWebView.postMessage(JSON.stringify(eventData)) CONNECT.close(); }); CONNECT.onComplete((eventData) => { if(eventData && eventData.CONNECTComplete) { let inquiryType = eventData.inquiryType; let inquiryId = eventData.inquiryId; // Save these values to return insights results alert('Successfully linked to ' + eventData.account.bankName + ' (...' + eventData.account.last4Digits + ')'); } });
settings.webhookUrl
to CONNECT when initializing the session. launch
and complete
events will be sent if a webhook URL is provided. To enable other events, you must specify those events in CONNECT settings.{ "sessionToken": "CONNECT Session Token", "eventDate": "2022-01-01T12:00:00.0000000Z", "eventName": "complete", "customerId": "Customer or Reference ID", "merchantId": 12345, "connectComplete": true, "connectType": "BankLOGIN", "inquiryId": "BankLOGIN+ InquiryID", "inquiryType": "BankLOGIN+", "account": { "bankId": 12345, "bankName": "Full Bank Name", "accountNickname": "Sample Checking Account", "accountType": "Checking", "accountToken": "00000000-xxxx-xxxx-xxxx-000000000000", "last4Digits": "1234" } }
inquiryType
will be either null (no verification), "BankLOGIN+", or "BankVERIFY+". The inquiryId
will be either a BankLOGIN+ or BankVERIFY+ inquiryId.