More Info
Cordova

Before getting started, if you are deleveloping on IOS visit the Apple Health docs and follow the Enable HealthKit section to configure HealthKit.

Installation

cordova plugin add https://github.com/metriport/cordova-sdk

You’ll need to ensure that the MetriportSDK pod is installed as well.

cd platforms/ios
pod install

Usage

To use our SDK, go to your index.html and add:

<body>
  ...
  <button id="show-widget">Open widget</button>
  ...
</body>

Then, in your js file add:

index.js
document.getElementById("show").addEventListener("click", () =>
  metriportconnectwidget.show({
    clientApiKey: "CLIENT_API_KEY",
    token: "CONNECT_TOKEN",
  })
);

Ensure you use your Client Key here, and not your Secret Key. You can read more about the differences between the two in our API Keys guide.

As per the guide, we recommend to store your Client Key in environment secrets, and not commit it in plain text to your repository.

As per the Quickstart guide, you’ll need to generate a token on your server before opening the Connect Widget. You can read more about this here.

Apple Health

For details about receiving Apple Health data via webhooks, see the guide here.