Event Notifications

Webhooks

Webhooks

Smile uses webhooks to notify your application in real time when an event happens in our servers that is related to your environment.

Event notifications can be sent when a new user is created, an account is successfully connected, an employment document is uploaded, an invitation is sent, or when new any new type data is added such as a user's identity, income, employment, and others. Check out the list of available events that you can subscribe to in our Webhooks reference page.

These are sent via a secure channel, using HTTPS from a static IP address, with the data being sent in JSON format. These also come with a signature for you to validate the authenticity of the payload.

📘

Note

Our static IP address is 18.142.61.230. You can whitelist this IP address in your back-end to ensure that your application receives event notifications coming from Smile.

Webhooks are particularly useful for getting notifications about asynchronous events, and either executing actions in your backend system when any of these events happen, or knowing when to refresh your front-end system to display any new data.

For detailed implementation steps, visit our Webhooks reference page for more information.

Callbacks

Smile also uses callbacks to notify your application in real time of frontend-related events that happen in your environment.

Via callbacks, you can react or perform other actions once your user performs a supported action using the Wink Widget. Listening to events such as account connection, token expiry, or closing of the widget can help your native application manage and react to your user's actions.

List of Callbacks

CallbackDataDescription
onAccountCreatedaccountId, userId, providerIdFired when the account linking process has been initiated
onAccountConnectedaccountId, userId, providerIdFired when the account linking process has completed successfully
onAccountRemovedaccountId, userId, providerIdFired when the account access has been revoked by the user
onTokenExpired-Fired when the Link token has expired
onClosereasonFired when the Wink Widget has been closed by the user
onAccountErroraccountId, userId, providerId, errorCodeFired when the user account linking results in an error.
onUploadsCreateduploads, userIdFired when the user has submitted documents to be uploaded via the Wink Widget.
onUploadsRemoveduploads, userIdFired when the user has removed/revoked uploaded documents via the Wink Widget.
onUIEventeventName, eventTime, mode, userId, account, archiveFired whenever a new widget screen is shown to the user. See list of screens below.

Example Events

onAccountCreated

Fired when the account linking process has been initiated by the user such as through sending their login credentials. This does not surface the user's login credentials.

onAccountCreated: ({
    accountId,
    userId,
    providerId
}) => {
    console.log('Account created: ', accountId, ' User ID:', userId, ' Provider ID:', providerId)
},
PropertyTypeDescription
accountIdstringAccount Id that the user is attempting to connect to
userIdstringUser Id of the end user on the Smile Network
providerIdstringProvider Id that the user is attempting to connect to

onAccountConnected

Fired when the account linking process has completed successfully, and the user is shown the success connection screen.

onAccountConnected: ({
    accountId,
    userId,
    providerId
}) => {
    console.log('Account connected: ', accountId, ' User ID:', userId, ' Provider ID:', providerId)
},
PropertyTypeDescription
accountIdstringAccount Id that the user has connected to
userIdstringUser Id of the end user on the Smile Network
providerIdstringProvider Id that the user has connected to

onAccountRemoved

Fired when the account access has been revoked by the user.

onAccountRemoved: ({
    accountId,
    userId,
    providerId
}) => {
    console.log('Account removed: ', accountId, ' User ID:', userId, ' Provider ID:', providerId)
},
PropertyTypeDescription
accountIdstringAccount Id that the user has removed
userIdstringUser Id of the end user on the Smile Network
providerIdstringProvider Id of the account that the user has removed

onTokenExpired

Fired when the Link token has expired. You may then call the Refresh Token API to refresh the user's token.

onTokenExpired: () => {
    console.log('Token expired');
},

onClose

Fired when the Wink Widget has been closed by the user via the close icon or exit buttons.

The reason parameter can be any one of the following values:

  • close - the user clicked the Close icon in the upper right corner of the page to close the SDK
  • exit - the user clicked the "Done" button on the Successful Connection screen to close the SDK
  • error - the user clicked the Exit button on the error page to close the SDK
onClose: ( reason ) => {
    console.log('Widget closed. Reason: ', reason )
},

onAccountError

Fired when the user account linking results in an error. The full list of errors can be seen at the Get Account API reference.

onAccountError: ({
    accountId,
    userId,
    providerId,
    errorCode
}) => {
    console.log('Account error: ', accountId, ' User ID:', userId, ' Provider ID:', providerId, 'Error Code:', errorCode)
},
PropertyTypeDescription
accountIdstringAccount Id that the user is attempting to connect to
userIdstringUser Id of the end user on the Smile Network
providerIdstringProvider Id that the user is attempting to connect to
errorCodestringError code for the error

onUploadsCreated

Fired when the user has submitted documents to be uploaded via the Wink Widget.

onUploadsCreated: ({ uploads, userId }) => {
    console.log('Uploads: ', uploads, ' User ID:', userId);
},
PropertyTypeDescription
uploadsobjectContains specific information about the upload
userIdstringUser Id of the end user on the Smile Network

onUploadsRemoved

Fired when the user has removed/revoked uploaded documents via the Wink Widget.

onUploadsRemoved: ({ uploads, userId }) => {
    console.log('Uploads: ', uploads, ' User ID:', userId);
},
PropertyTypeDescription
uploadsobjectContains specific information about the upload
userIdstringUser Id of the end user on the Smile Network

onUIEvent

Fired whenever a new widget screen is shown to the user.

onUIEvent: ({ eventName, eventTime, mode, userId, account, archive }) => {
    console.log('Event Name: ', eventName, ', Event Time: ', eventTime, ', mode: ', mode, ', User ID: ', userId, ', Account: ', account, ', Archive: ', archive);
},
PropertyTypeDescription
eventNamestringName of the event, i.e. LoginPageOpened
eventTimestringTime of the event
modestringMode of the Wink Widget currently running, i.e. SANDBOX or PRODUCTION
userIdstringUser Id of the end user on the Smile Network
accountobjectContains specific account-related information relevant to the event, i.e. providerId or accountId. Note that these are Ids specific to Smile Network
archiveobjectContains specific archive-related information relevant to the event, i.e. fileType

For the list of event names, see the table below:

Event NameDescriptionEvent-specific Properties
ConsentPageOpenedThe user opened the consent screen
ProviderListPageOpenedThe user opened the provider list screen
LoginPageOpenedThe user opened the login screenproviderId
MfaPageOpenedThe user opened the Multi-Factor Authentication screenproviderId
ConnectSuccessPageOpenedThe user opened the account connected success screenproviderId, accountId
AccountRevokePageOpenedThe user opened the account connection status screen / revoke screenproviderId, accountId
LoginOptionsPageOpenedThe user opened the alternative login options screen
EmployerSurveyPageOpenedThe user opened the employer survey screen
FileTypeListPageOpenedThe user opened the document type selection screen (i.e. to select what type of document they wish to upload, such as SSS records, Income Tax Records, etc.)
FileTypePageOpenedThe user opened the document upload screen
ArchiveSuccessPageOpenedThe user has successfully uploaded a file and has opened the success screen
RevokeArchivePageOpenedThe user opened the archive status screen / delete screen