Example Usage of Data
Practical examples showing how to leverage Onairos data for matching, personalization, and recommendations.
The strategies below used to take hundreds of hours, interviews, developers and costs. We provide it all with a simple API to grow Revenue, Retention and Conversion.
1. Using Onairos Data for Matching
In a dating or social networking app, use Onairos' Traits and Sentiment data to create highly personalized matches based on personality compatibility.
// Match users based on personality traits (scored 70-100)
function findBestMatch(userTraits, potentialMatches) {
return potentialMatches.sort((a, b) => {
const scoreA = getCompatibilityScore(userTraits, a.traits);
const scoreB = getCompatibilityScore(userTraits, b.traits);
return scoreB - scoreA;
})[0];
}
function getCompatibilityScore(userTraits, matchTraits) {
let score = 0;
for (let trait in userTraits.positive_traits) {
if (matchTraits.positive_traits[trait] >= 80) {
score += matchTraits.positive_traits[trait];
}
}
return score;
}
// Example usage
const userTraits = {
positive_traits: { "Creative Problem Solving": 92, "Community Engagement": 85, "Science Enthusiasm": 78 }
};
const potentialMatches = [
{ id: 1, traits: { positive_traits: { "Creative Problem Solving": 88, "Community Engagement": 90, "Science Enthusiasm": 91 } } },
{ id: 2, traits: { positive_traits: { "Creative Problem Solving": 75, "Community Engagement": 89, "Science Enthusiasm": 82 } } }
];
const bestMatch = findBestMatch(userTraits, potentialMatches);
console.log("Best Match:", bestMatch);
We score each potential match based on how closely their strong traits align with the user's traits. This allows the app to recommend matches with compatible personalities.
2. Using Archetype & Nudges for User Profiles
Display the user's archetype as a personality label and surface nudges as personalized tips in your app.
// Display archetype and nudges
const response = await fetchOnairosData(apiUrl, accessToken);
const traits = response.DataAnalysis.personality_traits;
// Show archetype as a profile badge
const archetypeLabel = `The ${traits.archetype}`;
console.log(archetypeLabel);
// "The Creative Explorer"
// Display personalized nudges as tips/cards
traits.nudges.forEach((nudge, i) => {
console.log(`Tip ${i + 1}: ${nudge.text}`);
});
// "Tip 1: You're highly creative — try building a small side project combining two of your interests."
// "Tip 2: Consider dedicating time to structured planning exercises..."
// Use archetype for matching similar personality types
function findSimilarArchetypes(userArchetype, otherUsers) {
return otherUsers.filter(u =>
u.traits.archetype === userArchetype
);
}
3. Using Onairos Data in LLM Personalization
Incorporate personality data into LLM prompts to generate tailored responses based on user characteristics.
// Personalize LLM prompt with full persona context
function personalizeLLMPrompt(persona, basePrompt) {
const traits = persona.DataAnalysis.personality_traits;
const traitList = Object.entries(traits.positive_traits)
.map(([trait, score]) => trait + ': ' + score)
.join(", ");
return `User Archetype: The ${traits.archetype}.
User Personality Traits: ${traitList}.
User Summary: ${traits.user_summary}
${basePrompt}`;
}
// Example usage
const persona = {
DataAnalysis: {
personality_traits: {
positive_traits: { "Creative Problem Solving": 92, "Adventure Seeking": 85, "Science Enthusiasm": 78 },
traits_to_improve: { "Structured Planning": 45, "Routine Consistency": 32 },
user_summary: "You are a curious, creative individual drawn to science and problem-solving.",
top_traits_explanation: "Your traits reflect consistent engagement with creative and technical content.",
archetype: "Creative Explorer",
nudges: [{ "text": "Try building a side project combining two of your interests." }]
}
}
};
const basePrompt = "Suggest an ideal vacation plan based on the user's preferences.";
const personalizedPrompt = personalizeLLMPrompt(persona, basePrompt);
// Includes archetype, traits, and summary for richer LLM context
4. Using Sentiment Data for Content Recommendations
Leverage sentiment scores to recommend content that aligns with the user's current mood and preferences.
// Filter content based on user sentiment
function recommendContent(sentimentData, contentList) {
const positiveContent = contentList.filter(c => c.type === "positive");
const neutralContent = contentList.filter(c => c.type === "neutral");
const averageSentiment = sentimentData.output
.flat()
.reduce((sum, score) => sum + score, 0) / sentimentData.output.length;
return averageSentiment > 0.5 ? positiveContent : neutralContent;
}
// Example
const sentimentData = {
output: [[[0.8]], [[0.9]], [[0.6]], [[0.7]]]
};
const contentList = [
{ id: 1, type: "positive", title: "Uplifting Story" },
{ id: 2, type: "neutral", title: "General News" },
{ id: 3, type: "positive", title: "Motivational Tips" }
];
const recommended = recommendContent(sentimentData, contentList);
// Returns positive content for users with high sentiment scores
5. Personalized Messaging Based on Traits & Sentiment
Combine traits and sentiment data to personalize customer support messages.
// Customize support message based on user profile
function createSupportMessage(persona, sentimentScore) {
const traits = persona.DataAnalysis.personality_traits;
let message = "Thank you for reaching out!";
if (sentimentScore < 0.5) {
message += " We understand things might feel challenging right now.";
}
// Check if a trait exists and has a high score (70-100 scale)
const optimism = traits.positive_traits["Positive Outlook"];
if (optimism && optimism >= 80) {
message += " Given your natural optimism, we're confident you'll overcome this.";
}
// Use archetype for tone
if (traits.archetype.includes("Analyst") || traits.archetype.includes("Thinker")) {
message += " Here's a detailed breakdown of what we're doing to resolve this.";
}
return message;
}
// Example
const persona = {
DataAnalysis: {
personality_traits: {
positive_traits: { "Positive Outlook": 90 },
traits_to_improve: { "Structured Planning": 45 },
archetype: "Strategic Analyst",
nudges: [{ text: "Try breaking large problems into smaller steps." }]
}
}
};
const sentimentScore = 0.4;
const message = createSupportMessage(persona, sentimentScore);
// "Thank you for reaching out! We understand things might feel challenging
// right now. Given your natural optimism, we're confident you'll overcome this.
// Here's a detailed breakdown of what we're doing to resolve this."
Start with the Web Integration or Mobile Integration guides. See Persona Data Model for the complete response schema reference.