Widget API: Drift Welcome Message

Updated 2 months ago ​by Sara Pion

If you would like to hide the welcome message on some pages, show or hide the welcome message based on your company's online or offline status, or completely hide the welcome message, this document is for you! Using our Widget API you an call these actions in your own code.

First, make sure that the Drift Widget is initialized and ready for use

<script
drift.on('ready',function(api, payload) {
 // interact with the api here
})
</script>
Here is an example using our Widget API

Drift welcome message

  • Show- api.showWelcomeMessage()

    • This will open the default welcome message based on your site’s settings.

    • You can also pass some additional parameters to further customize the welcome message. All parameters are optional.

  • Show welcome OR away-api.showWelcomeOrAwayMessage()

    • This will show the proper message based on your organization's current online / offline status.

  • Hide- api.hideWelcomeMessage()

    • This will hide the welcome message and reset its state.

 

api.showWelcomeMessage({ 
    message:undefined,
  
// a string. replaces the default welcome message with a custom one.
  
 avatarUrl:undefined 
// a url. replaces the default avatar with a custom one.
  
})

Was this article helpful?

Can’t find what you’re looking for?

Talk To Us