Skip to main content

Introduction

Onboarding users onto WattShift is an important part of our optimization services. Each user should be onboarded in order for us to account for rate plans, DER programs, and other relevant data.

Onboarding Options

WattShift offers two ways to onboard users:
  1. User Interface Based Onboarding (documented on this page): Redirect users to WattShift’s onboarding flow where they complete the process through our user interface.
  2. API Based Onboarding: Programmatically onboard homes using our API endpoints. See the API Based Onboarding guide for details.

Generating Onboarding URL

To onboard the user, you will need to redirect them to our onboarding flow. The following endpoint will generate an onboarding URL for the user–
async function getWattshiftOnboardingUrl() {
  const { url, homeId } = await wattshiftApiCall(
    "https://api.wattshift.com/v1/onboarding/url/generate",
    {
      userId: "user id",
      redirectUrl: "https://yourbackend.com/redirecturi",
      enableThirdPartyDevice: false, // set to false if you control your own devices.
      hvacs: [
        {
          name: "user id thermostat",
          enabled: true,
          defaultMode: "HEAT",
          tempUnits: "F",
          maxTemp: "75",
          minTemp: "65",
          defaultTemp: "70",
          deviceType: "Hvac",
          canHeat: true,
          canCool: false,
          targetTemp: 70,
          currentTemp: 70,
        },
      ],
    },
  );
  return { url, homeId };
}
The URL’s domain will always be https://app.wattshift.com but this endpoint will provide a sessionToken that is temporary and tied to your API Key
The userId is the unique identifier of the user in your system, which will be used to query the user’s data once the onboarding flow is complete.