Callbacks

Stay informed when events in Link occur, and simplify taking additional action.


Callbacks are activated by events in Link. They return event-specific information that can help automate taking additional related action.

Callbacks are not designed to be a primary source of analytics information. For detailed metrics on step-by-step conversion success rates, visit the Conversion area of Console's Dashboard or contact your customer success manager.

Callback formats#

Although optional, adding callbacks is simple. Just add a few lines of code to your Link initialization.

Below are example Link initializations that include every callback:

1<!DOCTYPE html>
2<html>
3  <head>
4    <meta charset="utf-8" />
5    <!-- This is needed in order to apply proper scaling on mobile devices -->
6    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
7  </head>
8
9  <body>
10    <script src="https://plugin.argyle.com/argyle.web.v5.js"></script>
11    <script type="text/javascript">
12      const linkInstance = Argyle.create({
13        userToken: 'USER_TOKEN',
14        sandbox: true, // Set to false for production environment.
15        // (Optional) Callback examples:
16        onAccountConnected: (payload) => console.log('onAccountConnected', payload),
17        onAccountCreated: (payload) => console.log('onAccountCreated', payload),
18        onAccountError: (payload) => console.log('onAccountError', payload),
19        onAccountRemoved: (payload) => console.log('onAccountRemoved', payload),
20        onDDSError: (payload) => console.log('onDDSError', payload),
21        onDDSSuccess: (payload) => console.log('onDDSSuccess', payload),
22        onCantFindItemClicked: (payload) => console.log('onCantFindItemClicked', payload),
23        onClose: () => console.log('onClose'),
24        onDocumentsSubmitted: (payload) => console.log('onDocumentsSubmitted', payload),
25        onFormSubmitted: (payload) => console.log('onFormSubmitted', payload),
26        onUIEvent: (payload) => console.log('onUIEvent', payload),
27        onError: (payload) => console.log('onError', payload),
28        onTokenExpired: (updateToken) => {
29          console.log('onTokenExpired');
30          // Generate a new user token.
31          // updateToken("<New user token>")
32        },
33      });
34      linkInstance.open();
35      // linkInstance.close() // Manually close Link (typically the user closes Link).
36    </script>
37  </body>
38</html>

Account callbacks#

onAccountConnected#

Invoked when an account is successfully authenticated (including MFA) to an Item.

Returns:

1AccountData (
2    "accountId": String,
3    "userId": String,
4    "itemId": String
5)

onAccountCreated#

Invoked when a user clicks Connect in Link, which creates an account for the user.

This callback is invoked before account authentication (successful or unsuccessful) to an Item.

Returns:

1AccountData (
2    "accountId": String,
3    "userId": String,
4    "itemId": String
5)

onAccountError#

Invoked if an account fails to authenticate to an Item.

Returns:

1AccountData (
2    "accountId": String,
3    "userId": String,
4    "itemId": String
5)

onAccountRemoved#

Invoked when a user revokes access to a connected account.

Returns:

1AccountData (
2    "accountId": String,
3    "userId": String,
4    "itemId": String
5)

Deposit switching callbacks#

onDDSError#

Invoked when an error occurs during deposit switching.

Returns:

1AccountData (
2    "accountId": String,
3    "userId": String,
4    "itemId": String
5)

onDDSSuccess#

Invoked after a successful deposit switch.

Returns:

1AccountData (
2    "accountId": String,
3    "userId": String,
4    "itemId": String
5)

User flow callbacks#

onCantFindItemClicked#

Invoked when the user selects "If no results" in Link, which is shown only if you selected the Callback fallback experience when customizing any type of Link Flow in Console.

This callback closes Link and returns the user's search query.

The onCantFindItemClicked callback will always precede the onClose callback.

onClose#

Invoked when the user closes Link. No values returned.

onDocumentsSubmitted#

Invoked when the user selects Submit after uploading documents through Link's document upload workflow.

Returns:

1FormData (
2    "accountId": String,
3    "userId": String
4)

onFormSubmitted#

Invoked when a response form is submitted through Link's "If no results" experience (configurable via Flows in Console).

Returns:

1FormData (
2    "accountId": String,
3    "userId": String
4)

onUIEvent#

Invoked when specific UI events occur in Link.

This callback and its event-specific return values are detailed in-depth in our Tracking guide.

Operational callbacks#

onError#

Invoked when Link encounters an internal problem that breaks the flow for the user.

Returns:

1LinkError (
2    "userId": String,
3    "errorType": String (enum),
4    "errorMessage": String,
5    "errorDetails": String
6)
  • userId — ID of the user.
  • errorType — Which Link error occurred.
  • errorMessage — The error message shown to the user.
  • errorDetails - The "error details" of the Link error.

onTokenExpired#

Invoked when a user token expires (iOS, Android, React Native, Flutter) or 5 minutes before a user token expires (Web).

After a user token expires, any additional actions taken by the user during the same Link session will result in an invalid_user_token error.

This callback provides another function as a parameter, which can be used to update the user token for the user's current Link session. This prevents having to close and re-initialize Link for the user.

To use this function:

  1. Create a new user token
  2. Call the function with the user token as the argument
Updating Argyle status...
© 2024 Argyle Systems Inc.argyle.com