1.0.0 • Published 5 months ago
opengig-linkedin-wrapper v1.0.0
opengig-linkedin-wrapper
A TypeScript wrapper for LinkedIn integration using Unipile SDK that provides a clean and type-safe interface for handling LinkedIn operations.
Features
- Connection Management (send/withdraw requests, check status)
- Messaging (single and bulk messages)
- Profile Operations (basic profile, work experience, education, skills)
- Search Functionality (by company, school)
- Type-safe interfaces
- Easy initialization and configuration
Installation
npm install opengig-linkedin-wrapper
# or
yarn add opengig-linkedin-wrapper
Configuration
Initialize the wrapper with your Unipile credentials:
import { UnipileWrapper } from 'opengig-linkedin-wrapper';
const unipileWrapper = new UnipileWrapper({
baseUrl: 'YOUR_UNIPILE_BASE_URL',
accessToken: 'YOUR_UNIPILE_ACCESS_TOKEN'
});
Usage Examples
Connection Management
import { ConnectionService } from 'opengig-linkedin-wrapper';
const connectionService = new ConnectionService(unipileWrapper);
// Send connection request
await connectionService.sendConnectionRequest({
accountId: 'your_account_id',
linkedinIdentifier: 'target_linkedin_id'
});
// Check connection status
const status = await connectionService.getConnectionStatus({
accountId: 'your_account_id',
linkedinIdentifier: 'target_linkedin_id'
});
// Withdraw connection request
await connectionService.withdrawConnectionRequest({
accountId: 'your_account_id',
invitationId: 'invitation_id'
});
Messaging
import { MessagingService } from 'opengig-linkedin-wrapper';
const messagingService = new MessagingService(unipileWrapper);
// Send single message
await messagingService.sendSingleMessage({
accountId: 'your_account_id',
linkedinIdentifier: 'target_linkedin_id',
message: 'Hello! Would you like to connect?'
});
// Send bulk message
await messagingService.sendBulkMessage({
accountId: 'your_account_id',
linkedinIdentifiers: ['id1', 'id2', 'id3'],
message: 'Hello everyone!'
});
Profile Operations
import { ProfileService } from 'opengig-linkedin-wrapper';
const profileService = new ProfileService(unipileWrapper);
// Connect LinkedIn account
await profileService.connectLinkedinAccount({
uniqueIdentifier: 'user123',
successRedirectUrl: 'https://your-app.com/success',
failureRedirectUrl: 'https://your-app.com/failure',
notifyUrl: 'https://your-app.com/webhook'
});
// Get basic profile
const basicProfile = await profileService.getBasicUserProfile({
accountId: 'your_account_id',
linkedinIdentifier: 'target_linkedin_id'
});
// Get work experience
const experience = await profileService.getUserWorkExperience({
accountId: 'your_account_id',
linkedinIdentifier: 'target_linkedin_id'
});
// Get education
const education = await profileService.getUserEducation({
accountId: 'your_account_id',
linkedinIdentifier: 'target_linkedin_id'
});
// Get skills
const skills = await profileService.getUserSkills({
accountId: 'your_account_id',
linkedinIdentifier: 'target_linkedin_id'
});
Search Operations
import { SearchService } from 'opengig-linkedin-wrapper';
const searchService = new SearchService(unipileWrapper);
// Search people by company
const companyResults = await searchService.searchPeopleByCompanyName({
accountId: 'your_account_id',
query: 'Google'
});
// Search people by school
const schoolResults = await searchService.searchPeopleBySchoolName({
accountId: 'your_account_id',
query: 'Stanford University'
});
Error Handling
The wrapper uses standard Promise rejections for error handling. You can handle errors using try/catch:
try {
await profileService.getBasicUserProfile({
accountId: 'your_account_id',
linkedinIdentifier: 'target_linkedin_id'
});
} catch (error) {
console.error('Error fetching profile:', error);
}
TypeScript Support
The package is written in TypeScript and includes type definitions. You get full type safety and IDE support out of the box.
import type {
ConnectionRequestParams,
SendMessageParams,
ProfileParams,
SearchParams
} from 'opengig-linkedin-wrapper';
Dependencies
- unipile-node-sdk: ^1.0.0
- axios: ^1.6.0
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
MIT
1.0.0
5 months ago