@@ -37,10 +37,11 @@ async function checkConnectionStatus(linkedapi: LinkedApi, personUrl: string): P
3737 personUrl : personUrl ,
3838 } ;
3939
40- const workflowId = await linkedapi . checkConnectionStatus . execute ( statusParams ) ;
41- console . log ( '🔍 Connection status workflow started:' , workflowId ) ;
40+ const workflow = await linkedapi . checkConnectionStatus . execute ( statusParams ) ;
41+ console . log ( '🔍 Connection status workflow started:' , workflow . workflowId ) ;
42+ console . log ( '💬 Workflow message:' , workflow . message ) ;
4243
43- const statusResult = await linkedapi . checkConnectionStatus . result ( workflowId ) ;
44+ const statusResult = await linkedapi . checkConnectionStatus . result ( workflow . workflowId ) ;
4445 if ( statusResult . data ) {
4546 console . log ( '✅ Connection status check completed' ) ;
4647 console . log ( `📊 Connection status: ${ statusResult . data . connectionStatus } ` ) ;
@@ -59,10 +60,11 @@ async function sendConnectionRequest(linkedapi: LinkedApi, personUrl: string): P
5960 email : 'example@gmail.com' ,
6061 } ;
6162
62- const workflowId = await linkedapi . sendConnectionRequest . execute ( requestParams ) ;
63- console . log ( '📤 Send connection request workflow started:' , workflowId ) ;
63+ const workflow = await linkedapi . sendConnectionRequest . execute ( requestParams ) ;
64+ console . log ( '📤 Send connection request workflow started:' , workflow . workflowId ) ;
65+ console . log ( '💬 Workflow message:' , workflow . message ) ;
6466
65- const requestResult = await linkedapi . sendConnectionRequest . result ( workflowId ) ;
67+ const requestResult = await linkedapi . sendConnectionRequest . result ( workflow . workflowId ) ;
6668 if ( requestResult . errors . length > 0 ) {
6769 console . error ( '🚨 Errors:' , JSON . stringify ( requestResult . errors , null , 2 ) ) ;
6870 } else {
@@ -74,10 +76,11 @@ async function sendConnectionRequest(linkedapi: LinkedApi, personUrl: string): P
7476async function retrievePendingRequests ( linkedapi : LinkedApi ) : Promise < void > {
7577 console . log ( '\n📋 Retrieving pending connection requests...' ) ;
7678
77- const workflowId = await linkedapi . retrievePendingRequests . execute ( ) ;
78- console . log ( '📋 Retrieve pending requests workflow started:' , workflowId ) ;
79+ const workflow = await linkedapi . retrievePendingRequests . execute ( ) ;
80+ console . log ( '📋 Retrieve pending requests workflow started:' , workflow . workflowId ) ;
81+ console . log ( '💬 Workflow message:' , workflow . message ) ;
7982
80- const pendingResults = await linkedapi . retrievePendingRequests . result ( workflowId ) ;
83+ const pendingResults = await linkedapi . retrievePendingRequests . result ( workflow . workflowId ) ;
8184 if ( pendingResults . data ) {
8285 const pendingRequests = pendingResults . data ;
8386 console . log ( '✅ Pending requests retrieval completed' ) ;
@@ -101,10 +104,11 @@ async function withdrawConnectionRequest(linkedapi: LinkedApi, personUrl: string
101104 unfollow : true ,
102105 } ;
103106
104- const workflowId = await linkedapi . withdrawConnectionRequest . execute ( withdrawParams ) ;
105- console . log ( '🔙 Withdraw connection request workflow started:' , workflowId ) ;
107+ const workflow = await linkedapi . withdrawConnectionRequest . execute ( withdrawParams ) ;
108+ console . log ( '🔙 Withdraw connection request workflow started:' , workflow . workflowId ) ;
109+ console . log ( '💬 Workflow message:' , workflow . message ) ;
106110
107- const withdrawResult = await linkedapi . withdrawConnectionRequest . result ( workflowId ) ;
111+ const withdrawResult = await linkedapi . withdrawConnectionRequest . result ( workflow . workflowId ) ;
108112 if ( withdrawResult . errors . length > 0 ) {
109113 console . error ( '🚨 Errors:' , JSON . stringify ( withdrawResult . errors , null , 2 ) ) ;
110114 } else {
@@ -125,10 +129,11 @@ async function retrieveConnections(linkedapi: LinkedApi): Promise<void> {
125129 } ,
126130 } ;
127131
128- const workflowId = await linkedapi . retrieveConnections . execute ( connectionsParams ) ;
129- console . log ( '👥 Retrieve connections workflow started:' , workflowId ) ;
132+ const workflow = await linkedapi . retrieveConnections . execute ( connectionsParams ) ;
133+ console . log ( '👥 Retrieve connections workflow started:' , workflow . workflowId ) ;
134+ console . log ( '💬 Workflow message:' , workflow . message ) ;
130135
131- const connectionsResults = await linkedapi . retrieveConnections . result ( workflowId ) ;
136+ const connectionsResults = await linkedapi . retrieveConnections . result ( workflow . workflowId ) ;
132137
133138 if ( connectionsResults . data ) {
134139 const connections = connectionsResults . data ;
@@ -146,13 +151,14 @@ async function retrieveConnections(linkedapi: LinkedApi): Promise<void> {
146151 }
147152
148153 // Example 2: Retrieve recent connections using since (returns connectedAt field)
149- const recentWorkflowId = await linkedapi . retrieveConnections . execute ( {
154+ const recentWorkflow = await linkedapi . retrieveConnections . execute ( {
150155 since : '2025-01-01' ,
151156 limit : 10 ,
152157 } ) ;
153- console . log ( '👥 Retrieve recent connections workflow started:' , recentWorkflowId ) ;
158+ console . log ( '👥 Retrieve recent connections workflow started:' , recentWorkflow . workflowId ) ;
159+ console . log ( '💬 Workflow message:' , recentWorkflow . message ) ;
154160
155- const recentResults = await linkedapi . retrieveConnections . result ( recentWorkflowId ) ;
161+ const recentResults = await linkedapi . retrieveConnections . result ( recentWorkflow . workflowId ) ;
156162
157163 if ( recentResults . data ) {
158164 const connections = recentResults . data ;
@@ -177,10 +183,11 @@ async function removeConnection(linkedapi: LinkedApi, personUrl: string): Promis
177183 personUrl : personUrl ,
178184 } ;
179185
180- const workflowId = await linkedapi . removeConnection . execute ( removeParams ) ;
181- console . log ( '❌ Remove connection workflow started:' , workflowId ) ;
186+ const workflow = await linkedapi . removeConnection . execute ( removeParams ) ;
187+ console . log ( '❌ Remove connection workflow started:' , workflow . workflowId ) ;
188+ console . log ( '💬 Workflow message:' , workflow . message ) ;
182189
183- const removeResult = await linkedapi . removeConnection . result ( workflowId ) ;
190+ const removeResult = await linkedapi . removeConnection . result ( workflow . workflowId ) ;
184191 if ( removeResult . errors . length > 0 ) {
185192 console . error ( '🚨 Errors:' , JSON . stringify ( removeResult . errors , null , 2 ) ) ;
186193 } else {
@@ -191,4 +198,4 @@ async function removeConnection(linkedapi: LinkedApi, personUrl: string): Promis
191198
192199if ( require . main === module ) {
193200 connectionsExample ( ) ;
194- }
201+ }
0 commit comments