Working with invitations
This page describes how to create workflows for sending and withdrawing connection requests, and retrieving, accepting, and ignoring invitations on LinkedIn.
Each example below has its Node SDK call in the Node tab, and the label over each completion says what that call returns.
Each example below has its Python SDK call in the Python tab, and the label over each completion says what that call returns.
Each example below has its CLI command in the CLI tab, and the label over each completion says what the command prints.
Sending connection request
To send a connection request from your account to another person, you need to include st.sendConnectionRequest action in your workflow. Here's an example:
Workflow:
{
"actionType": "st.sendConnectionRequest",
"personUrl": "https://www.linkedin.com/in/person1",
"note": "Hi, I’d like to connect with you to discuss potential collaboration.",
"email": "example1@gmail.com"
}Completion:
Completion – the method returns no data; a failed action comes back in errors:
Completion – with --json the CLI prints {"success": true, "data": null}, or the action's error:
{
"actionType": "st.sendConnectionRequest",
"success": true
}Withdrawing connection request
To withdraw the connection request sent from your account, you need to include st.withdrawConnectionRequest action in your workflow. Here's an example:
Workflow:
{
"actionType": "st.withdrawConnectionRequest",
"personUrl": "https://www.linkedin.com/in/person1",
"unfollow": true
}Completion:
Completion – the method returns no data; a failed action comes back in errors:
Completion – with --json the CLI prints {"success": true, "data": null}, or the action's error:
{
"actionType": "st.withdrawConnectionRequest",
"success": true
}Retrieving pending connection requests
To retrieve a list of pending connection requests sent from your account, you need to include st.retrievePendingRequests action in your workflow. Here's an example:
Workflow:
{
"actionType": "st.retrievePendingRequests"
}Completion:
Completion – result() returns its data in data, and a failed action in errors:
Completion – with --json the CLI prints its data as data, or the action's error:
{
"actionType": "st.retrievePendingRequests",
"success": true,
"data": [
{
"name": "John Doe",
"urn": "urn:li:member:123456789",
"publicUrl": "https://www.linkedin.com/in/johndoe",
"headline": "Founder & CEO at Example Company"
},
{
"name": "Jane Smith",
"urn": "urn:li:member:234567890",
"publicUrl": "https://www.linkedin.com/in/janesmith",
"headline": "CTO at Tech Solutions"
},
{
"name": "Carlos Santos",
"urn": null,
"publicUrl": "https://www.linkedin.com/in/carlossantos",
"headline": "Product Manager at Startup Hub"
}
]
}Retrieving invitations
Use st.retrieveInvitations to read all incoming connection, company-follow, and newsletter-subscription invitations from the invitation manager. The action is root-only and does not support then.
💡 To react to new connection requests as they arrive instead of polling this action on a schedule, enable network monitoring with
st.syncNetworkand consumeconnectionRequestReceivedevents.
Workflow:
{
"actionType": "st.retrieveInvitations"
}Completion:
Completion – result() returns its data in data, and a failed action in errors:
Completion – with --json the CLI prints its data as data, or the action's error:
{
"actionType": "st.retrieveInvitations",
"success": true,
"data": [
{
"invitationType": "connect",
"name": "John Doe",
"urn": "urn:li:member:123456789",
"publicUrl": "https://www.linkedin.com/in/johndoe",
"headline": "Founder & CEO at Example Company",
"note": "I would like to connect."
},
{
"invitationType": "companyFollow",
"name": "Jane Smith",
"urn": "urn:li:member:234567890",
"publicUrl": "https://www.linkedin.com/in/janesmith",
"companyUrl": "https://www.linkedin.com/company/example-company",
"companyName": "Example Company"
},
{
"invitationType": "newsletterSubscribe",
"name": "Carlos Santos",
"urn": null,
"publicUrl": "https://www.linkedin.com/in/carlossantos",
"newsletterUrl": "https://www.linkedin.com/newsletters/example-1234567890",
"newsletterName": "Example Newsletter"
}
]
}Use the type-specific URL from each item when accepting or ignoring it:
invitationType | Required target |
|---|---|
connect | personUrl, using the item's publicUrl value |
companyFollow | companyUrl |
newsletterSubscribe | newsletterUrl |
Accepting an invitation
Use st.acceptInvitation with the invitation type and exactly one matching target URL.
{
"actionType": "st.acceptInvitation",
"invitationType": "connect",
"personUrl": "https://www.linkedin.com/in/johndoe"
}For a company-follow invitation:
{
"actionType": "st.acceptInvitation",
"invitationType": "companyFollow",
"companyUrl": "https://www.linkedin.com/company/example-company"
}For a newsletter-subscription invitation:
{
"actionType": "st.acceptInvitation",
"invitationType": "newsletterSubscribe",
"newsletterUrl": "https://www.linkedin.com/newsletters/example-1234567890"
}A successful completion contains "success": true and no data.
Ignoring an invitation
st.ignoreInvitation uses the same target contract:
{
"actionType": "st.ignoreInvitation",
"invitationType": "connect",
"personUrl": "https://www.linkedin.com/in/johndoe"
}Change invitationType and the URL field together for company-follow or newsletter-subscription invitations. A successful completion contains "success": true and no data.
This page provides examples of workflows and their completions. For detailed constraints, parameters, and results, refer to the corresponding action documentation pages.