Skip to content

linkedin for OMI Web Personas #1752#1780

Merged
mdmohsin7 merged 14 commits intoBasedHardware:mainfrom
harshithsunku:feature/Omi-1752-linkedin-web-personas
Feb 26, 2025
Merged

linkedin for OMI Web Personas #1752#1780
mdmohsin7 merged 14 commits intoBasedHardware:mainfrom
harshithsunku:feature/Omi-1752-linkedin-web-personas

Conversation

@harshithsunku
Copy link
Copy Markdown
Contributor

@harshithsunku harshithsunku commented Feb 9, 2025

Fixes #1752

Added LinkedIn Integration to OMI Personas

Overview

Added LinkedIn profile integration alongside existing Twitter support, enabling users to create AI personas from either platform.

Key Changes

  •  Added LinkedIn API integration
  • ️ Created new components for better code organization:
    • ChatbotList
    • Header
    • Footer
    • InputArea
    • `Profiles '
  •  Updated UI to support both Twitter and LinkedIn profiles
  •  Added LinkedIn-specific data handling:
    • Profile information
    • Connection & follower counts
    • Professional history
    • Skills and posts

Technical Implementation

// New LinkedIn profile fetching
const fetchLinkedinProfile = async (handle: string) => {
  const profileResponse = await fetch(`https://${process.env.NEXT_PUBLIC_LINKEDIN_API_HOST}/profile-data-connection-count-posts?username=${encodedHandle}`, {
  // Process LinkedIn profile data
}

Testing Coverage ✅

  • Twitter-only profiles
  • LinkedIn-only profiles
  • Dual-platform profiles

Environment Variables Added

NEXT_PUBLIC_LINKEDIN_API_HOST=
NEXT_PUBLIC_LINKEDIN_API_KEY=

image

image

Snip from firebase:
image

Pop Up if profile exists in both platforms

image

Flow Diagram for Profile selection and creation

graph TD
    A[User Enters Handle] --> B{Is Profile exist?}
    B -->|Not Found| C{Check Platform Availability?}
    B -->|Found| D{Where Does it Exist?}
    C -->|Twitter Only| E[Create Twitter Profile]
    C -->|LinkedIn Only| F[Create LinkedIn Profile]
    C -->|Both Available| G[fetch and create both]
    C -->|Not Available| H[Show Error: Profile Not Found]
    D -->|Twitter Only| I{Is Linkedin Available?}
    I -->|No, Route to twitter chat|R
    I -->|Yes|S
    D -->|Both| K{Select platform twitter/linkedin?}
    D -->|LinkedIn Only| J{Is Twitter Available?}
    S -->K
    J -->|Yes|T
    J -->|No, Route to Linkedin Chat|R
    T -->K
    K -->|Based on user selection linnked or twitter| R
    E --> L[Route to New Chat]
    F --> L
    G --> M{Selected Platform twitter/linkedin?}
    M -->|LinkedIn/Twitter based on selection| L
    R[Route to chat]
    S[Fetch and create Linkedin]
    T[Fetch and create Twitter]
Loading

Flow Diagram of Code for Profile selection

graph TD
    A[User enters Handle] -->B[Scrape handle ONLY if Not exists in DB,For both twitter and linkedin scrape and save in DB]
    B --> C{Check Platform Avalibality?}
    C -->|if hanle not found| E[toast error profile not exists]
    C -->|Only Twitter| D[Route to Chat]
    C -->|Only Linkedin| D
    C -->|Both platform for same handle| F{Popup to select twitter or linkedin}
    F -->|twitter or linkedin based on selection| D
Loading

Test Case: Twitter URL Only
Input Example: https://x.com/harshithsunku
Expected Outcome: Extracts clean handle as harshithsunku. Only fetchTwitterProfile is called. Retrieves the Twitter docId and redirects to chat without displaying a platform modal.
Status: PASS
Comment: Verified that when a Twitter URL is provided, only the Twitter profile is fetched, even if the same handle exists for LinkedIn.

Test Case: LinkedIn URL Only
Input Example: https://linkedin.com/in/harshithsunku
Expected Outcome: Extracts clean handle as harshithsunku. Only fetchLinkedinProfile is called. Retrieves the LinkedIn docId and redirects to chat without displaying a platform modal.
Status: PASS
Comment: Verified that when a LinkedIn URL is provided, only the LinkedIn profile is fetched, ignoring the Twitter branch even if it exists.

Test Case: Plain Handle (Ambiguous, Multi-platform)
Input Example: harshithsunku or @harshithsunku
Expected Outcome: Extracts the clean handle as harshithsunku. Both fetchTwitterProfile and fetchLinkedinProfile are triggered. If both API calls succeed, a modal is shown for platform selection.
Status: PASS
Comment: Verified that plain handle input triggers both API calls, and a modal prompts the user when the profile exists on multiple platforms.

Test Case: Handle with Only Twitter Profile Exists
Input Example: x
Expected Outcome: Extracts clean handle as x. fetchTwitterProfile succeeds while fetchLinkedinProfile fails. Retrieves Twitter docId and redirects to chat without showing a modal.
Status: PASS
Comment: Verified that if only the Twitter profile is available, the process continues with Twitter exclusively and bypasses modal selection.

Test Case: Handle with Only LinkedIn Profile Exists
Input Example: nik-shevchenko-08565b18b
Expected Outcome: Extracts clean handle as nik-shevchenko-08565b18b. fetchLinkedinProfile succeeds while fetchTwitterProfile fails. Retrieves LinkedIn docId and redirects to chat without showing a modal.
Status: PASS
Comment: Verified that if only the LinkedIn profile is available, the process continues with LinkedIn exclusively and bypasses modal selection.

Test Case: Profile Already Exists in Database
Input Example: Valid handle/URL (any format)
Expected Outcome: A success toast is displayed, showing a modal or redirecting to chat.
Status: PASS
Comment: Verified that when a profile already exists in the database, a success message is shown, and the user is either redirected to chat or shown a modal.

@harshithsunku harshithsunku changed the title Initial commit For linkedin scrapping in OMI Personas linkedin scrapping for OMI Web Personas #1752 Feb 9, 2025
@harshithsunku harshithsunku changed the title linkedin scrapping for OMI Web Personas #1752 linkedin for OMI Web Personas #1752 Feb 9, 2025
@harshithsunku harshithsunku marked this pull request as ready for review February 9, 2025 16:47
@harshithsunku harshithsunku marked this pull request as draft February 9, 2025 17:27
@harshithsunku harshithsunku marked this pull request as ready for review February 9, 2025 17:54
@beastoin
Copy link
Copy Markdown
Collaborator

1/ how do you handle the profile creation / navigation when the user simply types @x then hit the create ai persona button ? consider 2 cases: one for the new user and for an existing user.

@harshithsunku

@harshithsunku
Copy link
Copy Markdown
Contributor Author

1/ how do you handle the profile creation / navigation when the user simply types @x then hit the create ai persona button ? consider 2 cases: one for the new user and for an existing user.

@harshithsunku

Hi @beastoin ,

Kindly refer to the "Flow Diagram for Profile Selection" and check the screenshot in the description above.

Thanks.

@beastoin
Copy link
Copy Markdown
Collaborator

1/ could you simplify the diagram? the complexity level of this simple task should not be that high.

man, if you are using an AI to generate the diagram for your code, you have to make sure your code is super good and backed by the diagram from your brain.

forgive me if you drew it yourself 🤯

@harshithsunku

@harshithsunku
Copy link
Copy Markdown
Contributor Author

1/ could you simplify the diagram? the complexity level of this simple task should not be that high.

man, if you are using an AI to generate the diagram for your code, you have to make sure your code is super good and backed by the diagram from your brain.

forgive me if you drew it yourself 🤯

@harshithsunku

Hi @beastoin ,

The diagram was created manually—yes, the old-fashioned way! ✍️

It was the initial design to ensure all scenarios were covered before diving into the actual code.

The final code is now sleek, simple, and handles all the scenarios from the previous flow diagram.

Kindly refer to the final code flow diagram. It’s as simple as it gets! 😃

Thanks!

@kodjima33
Copy link
Copy Markdown
Collaborator

kodjima33 commented Feb 12, 2025

@harshithsunku can you host it anywhere and give a link? i want to test scraping of posts

@harshithsunku
Copy link
Copy Markdown
Contributor Author

harshithsunku commented Feb 13, 2025

@harshithsunku can you host it anywhere and give a link? i want to test scraping of posts

Hi @kodjima33 ,

I've shared the link over a mail please check.

Thanks.

@beastoin
Copy link
Copy Markdown
Collaborator

1/ ✅ ok
2/ could you support the link as well, besides the handle. e.g https://x.com/_thinx -> X @_thinx, https://www.linkedin.com/in/thinx/ -> LinkedIn @THINX

@harshithsunku

@harshithsunku
Copy link
Copy Markdown
Contributor Author

harshithsunku commented Feb 15, 2025

1/ ✅ ok
2/ could you support the link as well, besides the handle. e.g https://x.com/_thinx -> X @_thinx, https://www.linkedin.com/in/thinx/ -> LinkedIn @THINX

@harshithsunku

Hi @beastoin , @kodjima33 .

Good suggestion! I had considered this during the initial design/implementation but didn’t add it since it wasn’t part of the original request.

I’ll include this support now.

I’m currently on a business travell and will be back on Saturday, February 22nd. I’ll get this done by February 23rd.

Thanks for your understanding!

Regards,
Harshith

@harshithsunku
Copy link
Copy Markdown
Contributor Author

1/ ✅ ok 2/ could you support the link as well, besides the handle. e.g https://x.com/_thinx -> X @_thinx, https://www.linkedin.com/in/thinx/ -> LinkedIn @THINX

@harshithsunku

Hi @beastoin, @kodjima33,

I have added support for the link as well. Kindly verify using the link shared via email.
Updated the PR with URL changes as well and UT cases in description.

Regards,
Harshith

@beastoin
Copy link
Copy Markdown
Collaborator

2/ could you improve the code quality ? these code block looks messy https://github.com/BasedHardware/omi/pull/1780/files#diff-237e4bc2a7e642164212ab39111544957f2cc77d56606e6ddc91a8f52a2d381fR150-R204 ; imaging we have instagram, threads, ..., and more.

3/ resolve conflicts pls sir.

@harshithsunku

@kodjima33
Copy link
Copy Markdown
Collaborator

kodjima33 commented Feb 26, 2025

@harshithsunku need this merged today or will have to reassign or do ourselves, what's the status?

@harshithsunku
Copy link
Copy Markdown
Contributor Author

@harshithsunku need this merged today or will have to reassign or do ourselves, what's the status?

Hi @kodjima33 ,

Everything is done from my side.

I've addressed the comments, resolved conflicts, and the PR is ready for merge.

Regards,
Harshith

@mdmohsin7 mdmohsin7 merged commit af7b549 into BasedHardware:main Feb 26, 2025
@mdmohsin7 mdmohsin7 mentioned this pull request Feb 26, 2025
@beastoin
Copy link
Copy Markdown
Collaborator

beastoin commented Mar 4, 2025

hey @harshithsunku , could you check with the https://x.com/bilawalsidhu , the personas.omi.me told me that "No profile found for the given handle"

@harshithsunku
Copy link
Copy Markdown
Contributor Author

hey @harshithsunku , could you check with the https://x.com/bilawalsidhu , the personas.omi.me told me that "No profile found for the given handle"

Hi @beastoin ,

I have just verified the deployment on my PR commit. (This deployment is based on the PR commit before merging to the main branch: https://omi-two.vercel.app/).

It is working fine, and I am able to add a new Twitter handle to personas.

I guess some other commit might have caused this issue after my PR merge.

Currently, I am out of station and will be able to look into this after 8 PM IST today.

Regards,
Harshith.

@harshithsunku
Copy link
Copy Markdown
Contributor Author

hey @harshithsunku , could you check with the https://x.com/bilawalsidhu , the personas.omi.me told me that "No profile found for the given handle"

Hi @beastoin ,

I've just checked, and it seems to be working.
I just saw that a commit has already been made to fix this issue.

Regards,
Harshith.

Glucksberg pushed a commit to Glucksberg/omi-local that referenced this pull request Apr 28, 2026
Fixes BasedHardware#1752 

# Added LinkedIn Integration to OMI Personas

## Overview
Added LinkedIn profile integration alongside existing Twitter support,
enabling users to create AI personas from either platform.

## Key Changes
-  Added LinkedIn API integration
- ️ Created new components for better code organization:
  - `ChatbotList`
  - `Header`
  - `Footer`
  - `InputArea`
  - `Profiles '
-  Updated UI to support both Twitter and LinkedIn profiles
-  Added LinkedIn-specific data handling:
  - Profile information
  - Connection & follower counts
  - Professional history
  - Skills and posts

## Technical Implementation
```typescript
// New LinkedIn profile fetching
const fetchLinkedinProfile = async (handle: string) => {
  const profileResponse = await fetch(`https://${process.env.NEXT_PUBLIC_LINKEDIN_API_HOST}/profile-data-connection-count-posts?username=${encodedHandle}`, {
  // Process LinkedIn profile data
}
```

## Testing Coverage ✅
- Twitter-only profiles
- LinkedIn-only profiles
- Dual-platform profiles

## Environment Variables Added
```env
NEXT_PUBLIC_LINKEDIN_API_HOST=
NEXT_PUBLIC_LINKEDIN_API_KEY=
```

![image](https://github.com/user-attachments/assets/1a57ba31-72b5-4687-a8f0-9f1ea9b7f341)


![image](https://github.com/user-attachments/assets/b907a16e-2d08-481b-a6fa-4a03f83382ed)

Snip from firebase:

![image](https://github.com/user-attachments/assets/462fcb66-aa4a-4662-8a57-5c88e07cf215)

## Pop Up if profile exists in both platforms

![image](https://github.com/user-attachments/assets/62889164-2ba1-45b5-8c3b-afc6e75aff24)


## Flow Diagram for Profile selection and creation
```mermaid
graph TD
    A[User Enters Handle] --> B{Is Profile exist?}
    B -->|Not Found| C{Check Platform Availability?}
    B -->|Found| D{Where Does it Exist?}
    C -->|Twitter Only| E[Create Twitter Profile]
    C -->|LinkedIn Only| F[Create LinkedIn Profile]
    C -->|Both Available| G[fetch and create both]
    C -->|Not Available| H[Show Error: Profile Not Found]
    D -->|Twitter Only| I{Is Linkedin Available?}
    I -->|No, Route to twitter chat|R
    I -->|Yes|S
    D -->|Both| K{Select platform twitter/linkedin?}
    D -->|LinkedIn Only| J{Is Twitter Available?}
    S -->K
    J -->|Yes|T
    J -->|No, Route to Linkedin Chat|R
    T -->K
    K -->|Based on user selection linnked or twitter| R
    E --> L[Route to New Chat]
    F --> L
    G --> M{Selected Platform twitter/linkedin?}
    M -->|LinkedIn/Twitter based on selection| L
    R[Route to chat]
    S[Fetch and create Linkedin]
    T[Fetch and create Twitter]
```

## Flow Diagram of Code for Profile selection
```mermaid
graph TD
    A[User enters Handle] -->B[Scrape handle ONLY if Not exists in DB,For both twitter and linkedin scrape and save in DB]
    B --> C{Check Platform Avalibality?}
    C -->|if hanle not found| E[toast error profile not exists]
    C -->|Only Twitter| D[Route to Chat]
    C -->|Only Linkedin| D
    C -->|Both platform for same handle| F{Popup to select twitter or linkedin}
    F -->|twitter or linkedin based on selection| D
  ```
  
Test Case: Twitter URL Only
Input Example: https://x.com/harshithsunku
Expected Outcome: Extracts clean handle as harshithsunku. Only fetchTwitterProfile is called. Retrieves the Twitter docId and redirects to chat without displaying a platform modal.
Status:  PASS
Comment: Verified that when a Twitter URL is provided, only the Twitter profile is fetched, even if the same handle exists for LinkedIn.

Test Case: LinkedIn URL Only
Input Example: https://linkedin.com/in/harshithsunku
Expected Outcome: Extracts clean handle as harshithsunku. Only fetchLinkedinProfile is called. Retrieves the LinkedIn docId and redirects to chat without displaying a platform modal.
Status: PASS
Comment: Verified that when a LinkedIn URL is provided, only the LinkedIn profile is fetched, ignoring the Twitter branch even if it exists.

Test Case: Plain Handle (Ambiguous, Multi-platform)
Input Example: harshithsunku or @harshithsunku
Expected Outcome: Extracts the clean handle as harshithsunku. Both fetchTwitterProfile and fetchLinkedinProfile are triggered. If both API calls succeed, a modal is shown for platform selection.
Status: PASS
Comment: Verified that plain handle input triggers both API calls, and a modal prompts the user when the profile exists on multiple platforms.

Test Case: Handle with Only Twitter Profile Exists
Input Example: x
Expected Outcome: Extracts clean handle as x. fetchTwitterProfile succeeds while fetchLinkedinProfile fails. Retrieves Twitter docId and redirects to chat without showing a modal.
Status: PASS
Comment: Verified that if only the Twitter profile is available, the process continues with Twitter exclusively and bypasses modal selection.

Test Case: Handle with Only LinkedIn Profile Exists
Input Example: nik-shevchenko-08565b18b
Expected Outcome: Extracts clean handle as nik-shevchenko-08565b18b. fetchLinkedinProfile succeeds while fetchTwitterProfile fails. Retrieves LinkedIn docId and redirects to chat without showing a modal.
Status: PASS
Comment: Verified that if only the LinkedIn profile is available, the process continues with LinkedIn exclusively and bypasses modal selection.

Test Case: Profile Already Exists in Database
Input Example: Valid handle/URL (any format)
Expected Outcome: A success toast is displayed, showing a modal or redirecting to chat.
Status: PASS
Comment: Verified that when a profile already exists in the database, a success message is shown, and the user is either redirected to chat or shown a modal.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add linkedin for omi web personas

4 participants