Main white everlink logo
text_snippet Examples
Coming soon
text_snippet Examples
Coming soon

Create ultra-contactless token communication


flash_on You should have a token based web app.

Everlink provides Javascript functionality in the form of the Everlink library. Add Everlink to your project directly from our CDN using a script tag:

 <script src=""></script>

This will expose the Everlink library. Initiate the class with your Everlink appID, which you can find in the account page. You will not be able to use the library without a valid appID:

 const everlink = new Everlink(appID);

An error will be thrown if you attempt to make a call to the server with an invalid appID. It is possible to add a function to run when an error occurs if desired using:

 everlink.onError = () => {
 // do stuff when an error occurs


There are two parts to the functionality of the Everlink library, emitting audio codes and listening for them, generally performed by the business and the patron, respectively.


startListening() is an asynchronous function that will gain access to the user's microphone and begin listening for an authorisation sequence. When it hears the correct sound it will send this to our servers and return a token corresponding to the sound.

There are two ways of accessing this token. The onTokenFromAudio method allows you to declare a function that will run when the token is returned, taking in the token as a parameter.

 everlink.onTokenFromAudio = (token) => {
 // do stuff using the token

 await everlink.startListening();

Alternatively, startListening will also return the token:

 const token = await everlink.startListening();
 // do stuff using the token

This function will keep listening for a sound until it receives a token from the server or is stopped with stopListening(). It is also not possible to call startListening() again until either a token is returned, or stopListening() is called.


stopListening() is a synchronous function that will cause Everlink to stop listening and disconnect from the microphone. For example, with startListening() already running, call:


Emitting audio codes

Emitting the audio code for authorisation can be done one of two ways. Either the audio associated with a token can be kept constant or it can change every few seconds. The token will change less often.


startPlaying() is an asynchronous function that will access the Everlink database and use a token to retrieve the audio code to be played. This function will use a changing audio code. Call the function with:

 await everlink.startPlaying();

You can access new tokens when generated using the method onNewTokenGenerated. This will allow you to use the token for your own database:

 everlink.onNewTokenGenerated = (token) => {
 // do stuff when a new token is generated


If you wish to play audio with a particular token, it is possible to do this using playFromToken(). The audio playing will change as normal but the token will remain the same until it has expired:

  await everlink.playFromToken(‘exampleToken12345’);

Errors will be thrown if either the appID is invalid or the token is in the incorrect format. Passing a null variable or an expired token will cause the function to generate a new token and play using that. Again, the token can be accessed using onNewTokenGenerated.

Both playFromToken() and startPlaying() will continue playing audio until stopped with stopPlaying(). It is not possible to call an Everlink function to play audio until the existing audio has been stopped.


stopPlaying() is a synchronous function that will stop the audio being played and allow another emitting function to be called. Call this with:


Below is an example app showing how to use Everlink's functions:

 * Copyright 2021 Everlink. All rights reserved.
 * You may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * Unless required by applicable law or agreed to in writing, software distributed under
 * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
 * ANY KIND, either express or implied. See the License for the specific language governing
 * permissions and limitations under the License.
  <script src=""></script>
      <h1>My Sample Token App</h1>
      <button id="recordButton">Record</button>
      <button id="stopButton">Stop</button>
      <button id="playButton">Play</button>
      <button id="playConstant">Play Constant</button>
      <button id="stopPlaying">Stop Playing</button>

      const everlink = new Everlink('myAppID12345');

      everlink.onError = () => {

      everlink.onTokenFromAudio = (token) => {
          console.log('token from audio: ', token);

      everlink.onNewTokenGenerated = (token) => {
          console.log('new token generated: ', token);

      const playConstantSound = (token) => {

      const stopPlaying = document.getElementById('stopPlaying');
      stopPlaying.addEventListener('click', everlink.stopPlaying);

      const recordButton = document.getElementById('recordButton');
      recordButton.addEventListener('click', everlink.startListening);

      const stopButton = document.getElementById('stopButton');
      stopButton.addEventListener('click', everlink.stopListening);

      const playConstant = document.getElementById('playConstant');
      playConstant.addEventListener('click', playConstantSound);

      const playButton = document.getElementById('playButton');
      playButton.addEventListener('click', everlink.startPlaying);