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 payroll 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

AttributeTypeDescription
onPayDistributionSuccessfunc optionalA callback function invoked after a successful pay distribution update flow.

This callback function provides accountId, userId, and linkItemId.
onPayDistributionErrorfunc optionalA callback function invoked after an error occurs during the pay distribution update flow.

This callback function provides accountId, userId, and linkItemId.
onCantFindLinkItemClickedfunc optionalAn 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.
onAccountCreatedfunc optionalA 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.

This callback function provides accountId, userId, and linkItemId.
onAccountConnectedfunc optionalA 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.

This callback function provides accountId, userId, and linkItemId.
onAccountUpdatedfunc optionalA callback function invoked when a user updates their account credentials.

This callback function provides accountId, userId, and linkItemId.
onAccountRemovedfunc optionalA callback function invoked when a user removes an account.

This callback function provides accountId, userId, and linkItemId.
onUserCreatedfunc optionalA callback function invoked when a new user is created.

This callback function provides userId and userToken. The user object is created on the first attempt of a new user to connect an account.
onErrorfunc optionalA callback function invoked when Link encounters an internal problem that breaks the flow for the user.

This callback function provides 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.
onAccountErrorfunc optionalA callback function invoked every time an account fails to authenticate with a Link item.

This callback function provides accountId, userId, and linkItemId.
onClosefunc optionalA callback function invoked immediately after the user closes Link.
onTokenExpiredfunc optionalA callback function invoked when the userToken expires.

This callback function provides another function as a parameter, which you should call with your new userToken as an argument.

We recommend generating a new userToken every time Link is initialized for a user.
onUIEventfunc optionalThe onUIEvent callback is invoked when specific UI events are activated on Link. These event callbacks provide a data object that contains 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.
onExitIntroClickedfunc optional conditionally requiredThis callback is associated to the secondary button on the Intro screen. Upon receiving this event, you can initiate a backup flow for your users.
onFormSubmittedfunc optionalThis callback is invoked when a user submits a form.

This callback function provides accountId and userId.
onDocumentsSubmittedfunc optionalThis callback is invoked when a user completes the document upload flow.

This callback function provides accountId and userId.
onCreditBureauFormSubmittedfunc optionalA callback function invoked after a user submits their SSN and DOB values in a Credit bureau workflow.

This callback function provides accountId and userId.