@@ -9,8 +9,9 @@ async function searchPeopleExample(): Promise<void> {
99 try {
1010 console . log ( '🚀 Linked API searchPeople example starting...' ) ;
1111 await standardExample ( linkedapi ) ;
12+ await standardExampleWithCustomSearchUrlExample ( linkedapi ) ;
1213 await salesNavigatorExample ( linkedapi ) ;
13-
14+ await salesNavigatorWithCustomSearchUrlExample ( linkedapi ) ;
1415 } catch ( error ) {
1516 if ( error instanceof LinkedApiError ) {
1617 console . error ( '🚨 Linked API Error:' , error . message ) ;
@@ -56,6 +57,33 @@ async function standardExample(linkedapi: LinkedApi): Promise<void> {
5657 }
5758}
5859
60+
61+ async function standardExampleWithCustomSearchUrlExample ( linkedapi : LinkedApi ) : Promise < void > {
62+ const searchParams = {
63+ customSearchUrl : "https://www.linkedin.com/search/results/people/?geoUrn=%5B%22103644278%22%5D&keywords=Bill%20Gates" ,
64+ } ;
65+
66+ console . log ( '🔍 Searching people with custom search URL...' ) ;
67+ const workflowId = await linkedapi . searchPeople . execute ( searchParams ) ;
68+ console . log ( '🔍 Workflow started:' , workflowId ) ;
69+ const searchResult = await linkedapi . searchPeople . result ( workflowId ) ;
70+
71+ if ( searchResult . data ) {
72+ const results = searchResult . data ;
73+ console . log ( '✅ People search completed' ) ;
74+ console . log ( `📊 Found ${ results . length } people` ) ;
75+ results . forEach ( ( person , index ) => {
76+ console . log ( ` ${ index + 1 } . ${ person . name } ` ) ;
77+ console . log ( ` Headline: ${ person . headline } ` ) ;
78+ console . log ( ` Location: ${ person . location } ` ) ;
79+ console . log ( ` URL: ${ person . publicUrl } ` ) ;
80+ } ) ;
81+ }
82+ if ( searchResult . errors . length > 0 ) {
83+ console . error ( '🚨 Errors:' , JSON . stringify ( searchResult . errors , null , 2 ) ) ;
84+ }
85+ }
86+
5987async function salesNavigatorExample ( linkedapi : LinkedApi ) : Promise < void > {
6088 const nvSearchParams = {
6189 term : 'product manager' ,
@@ -69,7 +97,7 @@ async function salesNavigatorExample(linkedapi: LinkedApi): Promise<void> {
6997 } ,
7098 } ;
7199
72- console . log ( '\n🎯 Searching people with Sales Navigator...' ) ;
100+ console . log ( '\n🎯 Searching people with Sales Navigator custom search URL ...' ) ;
73101 const workflowId = await linkedapi . nvSearchPeople . execute ( nvSearchParams ) ;
74102 console . log ( '🔍 Sales Navigator workflow started:' , workflowId ) ;
75103 const nvResults = await linkedapi . nvSearchPeople . result ( workflowId ) ;
@@ -90,6 +118,32 @@ async function salesNavigatorExample(linkedapi: LinkedApi): Promise<void> {
90118 }
91119}
92120
121+ async function salesNavigatorWithCustomSearchUrlExample ( linkedapi : LinkedApi ) : Promise < void > {
122+ const nvSearchParams = {
123+ customSearchUrl : "https://www.linkedin.com/sales/search/people?query=(recentSearchParam%3A(doLogHistory%3Atrue)%2CspellCorrectionEnabled%3Atrue%2Ckeywords%3ABill%2520Gates)" ,
124+ } ;
125+
126+ console . log ( '\n🎯 Searching people with Sales Navigator...' ) ;
127+ const workflowId = await linkedapi . nvSearchPeople . execute ( nvSearchParams ) ;
128+ console . log ( '🔍 Sales Navigator workflow started:' , workflowId ) ;
129+ const nvResults = await linkedapi . nvSearchPeople . result ( workflowId ) ;
130+
131+ if ( nvResults . data ) {
132+ const results = nvResults . data ;
133+ console . log ( '✅ Sales Navigator people search completed' ) ;
134+ console . log ( `📊 Found ${ results . length } people` ) ;
135+ results . forEach ( ( person , index ) => {
136+ console . log ( ` ${ index + 1 } . ${ person . name } ` ) ;
137+ console . log ( ` Position: ${ person . position } ` ) ;
138+ console . log ( ` Location: ${ person . location } ` ) ;
139+ console . log ( ` URL: ${ person . hashedUrl } ` ) ;
140+ } ) ;
141+ }
142+ if ( nvResults . errors . length > 0 ) {
143+ console . error ( '🚨 Errors:' , JSON . stringify ( nvResults . errors , null , 2 ) ) ;
144+ }
145+ }
146+
93147if ( require . main === module ) {
94148 searchPeopleExample ( ) ;
95149}
0 commit comments