Integrate Onairos Web

A single line of code can augment your application to meet the needs of every individual user.

Updated 27 December 2024
webintegrationjavascriptreact

Integrate Onairos Web

In the following guide, we will show you how A Single Line Of Code can augment your application to meet the needs of every individual user!

What is Onairos?

Onairos is used to ask users to learn information about them from their Digital Personality, in order for you as developers to deliver the best products and services, tailored to that specific user.

Learn more about Onairos →

Create a Developer Account

Create a Developer account to access Onairos services. Register your domain to ensure secure API access.

Go to Developer Dashboard →

Installation

npm install onairos

Import the package as a default import:

import Onairos from 'onairos';

One Line of Code

Instantiate the Onairos object to add the Onairos button onto your application which asks the user for the Persona Data:

<OnairosButton
  className=""
  AppName="YourAppName"
  onResolved={handleComplete}
  requestData={{
    personality_traits: {
      name: "Personality Analysis",
      description: "Deep analysis of your Personality for fashion recommendations",
      reward: "10% discount from next basket"
    },
    sentiment_analysis: {
      name: "Interest Analysis", 
      description: "Understanding your interests and preferences for fashion recommendations",
      reward: "1 free recommended item"
    }
  }}
  debug={true}  // Enable for development
  testMode={true}  // Enable for testing
  auto={true}  // 🚀 MAGIC: Auto-fetch data without managing API call manually
/>

Button Props

Prop Type Required Description
webpageNameStringYesApp Display Name
requestDataJSONYesUser Request data object
textColorStringNo'black' | 'white'
textLayoutStringNo'right' | 'left' | 'below' | 'none'
autoFetchBooleanNoAuto-fetch user data on consent
onCompleteFunctionNoCallback: (data, error?) => void
inferenceDataJSONIf autoFetchInference Input Data
proofModeBooleanNoReturn ZK proof after receiving data

Request Data Object

Create the Request Object which Users will authorize in the overlay popup:

{
  "personality_traits": {
    "name": "Fashion Personality Analysis",
    "description": "Deep analysis of your Personality for fashion recommendations",
    "reward": "10% discount from next basket"
  },
  "sentiment_analysis": {
    "name": "Recent Interest and Themes", 
    "description": "Understanding your interests and preferences for fashion recommendations",
    "reward": "1 free recommended item"
  }
}

Request Types

  • personality_traits — A distillation of the user's most unique traits and personality
  • sentiment_analysis — You provide text/image input and we provide a score of how much the user liked or disliked that item

Individual Request Fields

  • name: Name of your request
  • description: Description to display to users about your request
  • reward: Reward given to user for granting data request
That's it!

Users can now receive data in the onComplete function. Check out our Demo to see an example Onairos integration.

If you set autoFetch = false, you will need to manually fetch the user data using the Manual API Call guide.