Javascript SDK: Methods and objects

This page details the available methods that can be used to manage the hashmail widget


The track method allows you to show and hide the widget, depending on the props passed


This method can be used to trigger the hashmail widget to open and show the full UI. This method is useful to spotlight the widget if an important message is triggered. A good example is a critical alert (e.g. liquidations), where it is important for the user to read the message immediately


This method will collapse the widget (if open) into the closed state

window.hashmail.track('hide') //to hide
window.hashmail.track('show') //to show


The identify method is to be called every time a wallet is connected to your application. This is a critical method which tells the widget to load messages sent by you to that wallet address

Once invoked, users will be able to see the notifications/messages in the widget. The widget is now in an 'identified' state

window.hashmail.identify(<wallet-address>) // this method should be triggered when the user has connected their wallet.



This method should be called whenever a user log in to the website and also when the website is loaded/mounted so that if a user is already logged in, the widget is configured.

The first time a wallet address connects to your dapp, users are mandatorily asked to consent to receiving communications. This is to ensure compliance to GDPR and other similar regulations. Read more on our compliance section


To return the widget to an anon state, you can use the disconnect method. This will remove any connected wallet addresses. You should call this method whenever a user disconnects the wallet.



This method is used to disable the widget on the website. Use this only if you do not want to display the widget icon. This method is to be used sparingly, only on pages that do not require a connected wallet (e.g. docs)



This method is used to enable the widget on the website. Use this to show the widget icon (in case you had disabled it)