Welltory integration
Mark avatar
Written by Mark
Updated over a week ago

Overview

What it is

Welltory's free integration program allows you to track users’ stress, energy, productivity, and other health data, along with interpretations of the data.

Who it’s for

Any app that wants to help users stay on top of their game with deep body insights. For example:

  • if you are an app for professional traders, partner with us to let users to measure their stress levels before the stock market opens — it may affect their decision making

  • if you are a personalized workout app, use our info to recommend the best type of workout for your users depending on their energy levels

  • if you are a team management app, monitor your team’s stress levels to avoid the risk of burnout and compromising your work environment

If you are not sure if Welltory integration partnership is right for you, don’t hesitate to contact us.

How it works

The integration lets you redirect users to Welltory to take measurements. After the measurement is taken, Weltory redirects the user back and sends you the results, which you can use as you see fit.

All data is shared via DDS (direct data sharing), which enables direct mobile app interactions without any SDKs and APIs.

DDS is based on universal links.

Download our demo app to see how the integration works

In order to see the integration work in action, we have created a “Welltory DDS Demo” application. It simulates the logic of a partner application associated with Welltory. With it, you can see how the user will be navigated to the AppStore or Google Play, the process of measurement, a request for sharing, as well as return to the application and an example of the presentation of the results. In addition, you can view the source code of the integration.

The DDS Demo application is available for iOS and Android

How to integrate

To get access to the Integration program, please fill out the request form first.

After we process your request, our support team will contact you with further instructions.

We offer partnerships free of charge.

Integration flow

Welltory integration flow is as follows:

Measurement request and results sharing — the partner application requests Welltory to make a measurement and expects to receive results data.

Welltory under the hood:

1. Receiving a request

2. Measurement processing

3. Navigating the user to a measurement results screen, requesting to share data with the partner app

4. Navigating the user to the partner application, transferring measurement results and its interpretations.

Technical details

iOS

The measurement request is made by launching a universal link from the partner application

Universal link flow varies depending on whether the user has Welltory installed or not. This only changes the progress of the universal link call, but does not change the behaviour of the partner application.

Universal link flow for the first measurement with Welltory:

  • Open universal link

  • Operation system opens the link in a browser

  • Welltory server redirects user to the AppStore

  • User installs Welltory 

  • Welltory performs a measurementRetargeting limitations: If the user has the Welltory app installed within the last 90 days using the first measurement link, the measurement will not start automatically.

Universal link flow for for all subsequent measurements with Welltory:

  • Open universal link

  • Operation system launches Welltory

  • Welltory performs a measurement

The measurement is considered first if there are no prior successful measurements.

Important: Universal link is different for the first and subsequent requests.

Input parameters

In both cases (the first and following requests), request parameters are the same:

Universal link looks as follows: [request_Link]?source=[Your App]&callback=[Encoded_Callback_URL]

Where:

  • source - partner application’s name

  • callback - partner application’s universal link (is a URL-encoded link, may contain GET parameters)

Important: we DO NOT save parameters in our Database

A callback link will be launched to pass the measurement result and user control back to the partner application. Welltory will append the measurement result parameters to your callback url.

First measurement request with Welltory

Link for the first measurement request, when it's not known if the user has the Welltory app installed:

  • [FIRST_LAUNCH_LINK]

Request example:

  • Without parameters [FIRST_LAUNCH_LINK]?source=YourApp&callback=https%3A%2F%2Fwww.yourapp.com%2Fdds%2F

  • With parameters [FIRST_LAUNCH_LINK]?source=YourApp&callback=https%3A%2F%2Fwww.yourapp.com%2Fdds%2F%3Fparam_1%3D123

Subsequent measurement requests with Welltory

Link for every subsequent measurement request, when you assume that the Welltory app is installed:

Request example:

Measurement results

A set of scores that gives the user important body insights

Color interpretations:

  • green = Good

  • yellow = Normal

  • red = Bad

Color interpretation is not available if the measurement is low quality or the result is ambiguous. In this case, the corresponding score will take the value 0.

Universal link is used to send results back to the partner app and call the partner app on iOS.

Making a measurement request, partner's application must pass a callback parameter that specifies callback universal link.

This callback universal link is called after measuring and performing calculations. Welltory will append the result parameters to your callback url:

Thus, if the original callback universal link is: https://yourapp.com/dds/ 

Third-party application requirements

To receive measurements results from Welltory, partner application should support universal links.

Android

The measurement request is executed by sending URI intent.

Important: The intent link changes depending on whether Welltory is installed or not.

Input parameters

In both (the first and subsequent requests) cases request parameters are the same:

source=<Application name>&callback=<Package name>/<Activity name>&<params>

  • source - Your application name. Will be displayed in Welltory interfaces.

  • callback - The application identifier, to pass result dataImportant: Activity should have android:exported=”true” configuration

  • <params> - [optionally] list of parameters to pass with measurement resultsImportant: we DON’T save parameters in a database

Example: source=YourApp&callback=com.package.name/com.package.name.activity&param3=123&param4=Hello

First measurement request with Welltory

Link for the first measurement request, when it's not known if the user has the Welltory app installed:

Request example:

Subsequent measurement requests with Welltory

Link for every subsequent measurement request, when you assume that the Welltory app is installed:

  • welltory://branch/Measurement/Start/<utf_8_encoded_params>,

where: utf_8_encoded_params is a list of parameters encoded with URLEncoder.encode(params, "UTF-8").

Request example:

  • Request example: welltory://branch/Measurement/Start/source%3DYourApp%26callback%3Dcom.welltory.dds.android%2Fcom.welltory.dds.android.MainActivity%26param1%3Dtest_param1

Important: Execute Intent with  FLAG_ACTIVITY_NEW_TASK and FLAG_ACTIVITY_CLEAR_TOP flags, to avoid a duplication of partner application instances.

String callBackActivity = String.format(Locale.getDefault(), "%s/%s",
 
       activity.getPackageName(), activity.getClass().getName());
 
String params = String.format(Locale.getDefault(),
 
       "source=%s&callback=%s¶m1=test_param1", "DemoApp", callBackActivity);
 
Intent intent = null;
 
try {
 
   String encodedParams = URLEncoder.encode(params, "UTF-8");
 
   intent = new Intent(Intent.ACTION_VIEW, Uri.parse("welltory://branch/Measurement/Start/" + encodedParams));
 
   if (intent.resolveActivity(activity.getPackageManager()) == null) {
 
       intent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=com.welltory.client.android&referrer=" + encodedParams));
 
   }
 
} catch (UnsupportedEncodingException e) {
 
   e.printStackTrace();
 
}
 
if (intent != null) {
 
   intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
 
   activity.startActivity(intent);
 
}

Measurement results

A set of scores that gives the user important body insights

Color:

  • green = Good

  • yellow = Normal

  • red = Bad

Color interpretation is not available if the measurement is low quality or the result is ambiguous. In this case, the corresponding score will take the value 0.

After startActivity call, partner application should expect for results in onNewIntent or onCreate function (if Android will kill application’s activity). 

Measurement results could be fetched from Intent by calling Intent.getFloatExtra

Example

@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
resultView.setText(parseIntent(intent));
}
 
private String parseIntent(Intent data) {
if (data != null && data.hasExtra("stress")) {
    return String.format(Locale.getDefault(), "productivity=%s\nrmssd=%s\nenergy=%s\npower=%s\nstress=%s\nsdnn=%s",
            data.getFloatExtra("productivity", -1),
            data.getFloatExtra("rmssd", -1),
            data.getFloatExtra("energy", -1),
            data.getFloatExtra("power", -1),
            data.getFloatExtra("stress", -1),
            data.getFloatExtra("sdnn", -1));
} else {
    return null;
}
}
Did this answer your question?