Sometimes, it is useful to check whether an end-user’s connection is working. For example, you might want to display a “connection status” indicator in your app’s UI.

To do this, you can use the health check endpoint to check whether the specified connection can connect and process requests end-to-end. If an error occurs, we strongly recommend displaying the error property error.userFacingMessage to your end-user in your app’s UI because it contains instructions for how your end-user can resolve the error.

import Conductor from "conductor-node";

const conductor = new Conductor({ apiKey: "YOUR_SECRET_KEY" });

async function main() {
  try {
    await conductor.qbd.healthCheck({
      conductorEndUserId: "end_usr_1234567abcdefg",
    });
  } catch (error) {
    // Update your app's UI to display `error.userFacingMessage`, which explains
    // that the connection is failing and how to resolve the error.
  }
}

main();