Callbacks

Learn how to configure callbacks in Link.

Callbacks are used in Link when a user performs one action that triggers another action.

Whenever a user creates a new account on Link, the onAccountCreated callback is invoked with the accountId and userId parameters. Store those IDs on your database and use them to retrieve the user's employment data from the Argyle API.

The onAccountUpdated callback is invoked when a user updates their credentials for an existing account.

When Argyle Link is initialized for a new user (in other words, userToken was not specified), a new user is created just before the user tries to connect their first account. This is when the onUserCreated callback is invoked with an object containing a userId and a userToken.

You should save the user ID on your database to be able to reference the user's accounts and request their user tokens from the API.

Attributes


onPayDistributionSuccess func optional

A callback function invoked after a successful pay distribution update flow.

The function will be passed an object containing accountId, userId, and linkItemId.


onPayDistributionError func optional

A callback function invoked after an error occurs during the pay distribution update flow.

The function will be passed an object containing accountId, userId, and linkItemId.


onCantFindLinkItemClicked func optional

An optional callback that is triggered when the user selects the Can't find your income source? button in Argyle Link.

When this callback is triggered, Link closes and the callback function receives the user’s search query.

To enable this user flow, you must define the onCantFindLinkItemClicked callback in your implementation and also select the corresponding Callback experience type in Customizer.


onAccountCreated func optional

A callback function invoked immediately after a user clicks connect and a new account is created. The callback will be invoked before authenticating the account with the Link item.

The function will be passed an object containing accountId, userId, and linkItemId.


onAccountConnected func optional

A callback function invoked every time a new account is successfully authenticated with a Link item, including any multi-factor authentication requests. If your linkItems list contains only one Link item, it is safe to close Argyle Link at this point.

The function will be passed an object containing accountId, userId, and linkItemId.


onAccountUpdated func optional

A callback function invoked when a user updates their account credentials.

The function will be passed an object containing accountId, userId, and linkItemId.


onAccountRemoved func optional

A callback function invoked when a user removes an account.

The function will be passed an object containing accountId, userId, and linkItemId.


onUserCreated func optional

A callback function invoked when a new user is created. The function will be passed an object containing userId and userToken. The user object is created on the first attempt of a new user to connect an account.


onError func optional

A callback function invoked when Link encounters an internal problem that breaks the flow for the user.

The function will be passed the type of the error that occurred.

Possible values: INVALID_LINK_ITEMS, INVALID_PD_CONFIG, INVALID_LINK_KEY, INVALID_USER_TOKEN, GENERIC

For more details and troubleshooting, see Link Errors.


onAccountError func optional

A callback function invoked every time an account fails to authenticate with a Link item.

The function will be passed an object containing accountId, userId, and linkItemId.


onClose func optional

A callback function invoked immediately after the user closes Link.


onTokenExpired func optional

A callback function invoked when the userToken expires.

The function will be passed another function as a parameter, which you should call with your new userToken as an argument.

Instead of using this callback, we advise checking the validity of the current token before initializing Link and generating a new one if needed.


onUIEvent func optional

The onUIEvent callback is invoked when specific UI events are activated on Link. These events are passed with a data object containing linkItemId, accountId, userID, and deepLink.

The events include:

  • The user reaches the Success screen after selecting and successfully submitting the “Can’t find your income source?” form.
  • The user reaches the Success screen after successfully uploading documents.
  • The user deleted documents.
  • The user opened the Document Status screen after they have already uploaded documents.
  • The user opened the Form Status screen after they have already submitted a form.

Also, some events have specific properties. Refer to Link Analytics to see all event-specific properties and the screen where they are activated.


onExitIntroClicked func conditionally required

This callback is associated to the secondary button on the Intro screen. Upon receiving this event, you can initiate a backup flow for your users.


onFormSubmitted func optional

This callback is invoked when a user submits a form. This callback contains the accountId and userId.


onDocumentsSubmitted func optional

This callback is invoked when a user completes the document upload flow. This callback contains the accountId and userId.