Connect Reference

HumanConnect.open argument properties

Before invoking the function HumanConnect.open(options) to launch Connect, you can supply the following parameters for the options object argument:

AttributeDescription
clientIdYour application's clientId. If you don't have one, please reach out to open a developer account
clientUserIdCan be an email address or any UTF-8 string to identify the user
token(required) Session token initially retrieved from Human API's authentication service
onCloseA Javascript function with this signature: function close(response){...}
onConnectSourceA Javascript function with this signature: function (response){...}
onDisconnectSourceA Javascript function with this signature: function (response){...}
HumanConnect.open({
  token : "YOUR_TOKEN", // "session_token" or "id_token"
  onClose : function(response) {
  	console.log("User closed Connect", response);
  },
  onConnectSource : function(response) {
  	console.log("User connected a source", response);
  },
  onDisconnectSource : function(response) {
  	console.log("User disconnected a source", response);
  }
});

Human Connect session response during user activity

After the user adds or removes data sources and closes Connect, your onClose callback will be invoked with a response argument. The response object is as follows:

PropertyTypeDescription
statusStringIdentifies whether the session terminated normally (SUCCESS) or abnormally : SESSION_TOKEN_INVALID, SESSION_TOKEN_EXPIRED or MISSING_SESSION_TOKEN
sessionResultsObjectIdentifies details about the data sources which the user connected or disconnected
sessionResults.connectedSourcesArray[Object]Identifies data sources connected by the user during the session. The array can be empty if the user did not connect any source
sessionResults.disconnectedSourcesArray[Object]Identifies data sources disconnected by the user during the session. The array can be empty if the user did not disconnect any source
currentConnectionsArray[Object]Identifies active data sources for the user, including sources which were connected in previous sessions

See below for an example response:

{
  "status": "SUCCESS",
  "sessionResults": {
    "connectedSources": [
      {
        "name": "Starfleet Pharmacy",
        "id": "5b1daf3f079c652eaf41fd23"
      },
      {
        "name": "Cleveland Clinic",
        "id": "54dc427aaa6b4cb7d6203061"
      }
    ],
    "disconnectedSources": [],
  },
  "currentConnections": [
    {
      "name": "Starfleet Pharmacy",
      "id": "5b1daf3f079c652eaf41fd23"
    },
    {
      "name": "Cleveland Clinic",
      "id": "54dc427aaa6b4cb7d6203061"
    }]
}

📘

Does the response payload look different for onConnectSource and onDisconnectSource?

The main difference lies in the "response.status". When onConnectSource is invoked, "response.status"="CONNECTED_SOURCE". When onDisconnectSource is invoked, "response.status"="DISCONNECTED_SOURCE".