Widget API: Drift Meetings

Updated 2 months ago ​by Sara Pion

If you  want to use the scheduling feature in your Drift profile, you can use this configuration to set up your calendar!

First make sure 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 Meetings

  • Trigger a meeting- scheduleMeeting(driftUserId)

If you have Drift Meetings enabled, you can use api.scheduleMeeting(driftUserId) to programmatically trigger the scheduling card flow.

 

<script>
drift.on("ready", function(api) {
  api.scheduleMeeting(driftUserId); /* <-- your Drift User ID here */
});
</script>

You'll need your Drift User ID to use this API. Don't know yours? Just ask us.

A more complex example, where we trigger the API when a button on the page is clicked.

<button id="schedule-meeting-button">
  Book a meeting with me
</button>
<script>
(function() {
  var driftUserId = 6;
  var $button = document.getElementById("schedule-meeting-button");
  $button.addEventListener("click", function() {
    drift.on("ready", function(api) {
      api.scheduleMeeting(driftUserId);
    });
  });
})();
</script>

Was this article helpful?

Can’t find what you’re looking for?

Talk To Us