logo

NJP

ServiceNow and LinkedIn Integration

Import · Apr 03, 2020 · article

image

Create an Application in LinkedIn developer account: We need to create an Application in LinkedIn developer account to get the following information — Application credentials, and Permissions (Link)

( ServiceNow as a consumer and Linkedin as Provider).

imageimage

Configure OAuth Profile in ServiceNow:

Steps —

Navigate to SystemOAuth > Application Registry and click on NEW select Connect to a third part OAuth provider.

image

Complete the form,

The client id and Client secret — You need to copy and paste it from the LinkedIn Developer Application.

Default Grant Type — Authorization Code

Authorization URL — https://www.linkedin.com/oauth/v2/authorization

Token URL — https://www.linkedin.com/oauth/v2/accessToken

(LinkedIn API Docs)

To get the Authorization permissions, we need to mention all the three permissions from the Linkedin Application to the OAuth Entity Scopes.

And same for the Automatically created default OAuth Entity Profile.

image

image

image

Create Rest Messages in ServiceNow:

To get the token and Profile detail, We need to create a get rest message.

steps —

Open System Webservices> Outbound> Rest Message

Click New,

Complete the form,

Endpoint URL: GET https://api.linkedin.com/v2/me

Authentication type : OAuth2.0

OAuth profile: LinkedSN default_profile (already created in previous steps.)

After submitting the form a default Get message will be created.

image

Now Click on Get OAuth Token.

A new window will open, Where you need to provide Your Linked Account Credentials.

On the successful attempt, The Access token will be generated, and the Validity of token will show as Info message on the form.

Now, open the default Get Method, Click on Test. A new window pop-up showing the Test Run results; in the response, we can find the integrated profile details, i.e., First name, Last name, Language.

image

Bonus — To create a post on LinkedIn,

Create Post HTTP method,

Complete the form,

End Point: https://api.linkedin.com/v2/ugcPosts

Content: {

“author”: “urn:li:person:<>”,

“lifecycleState”: “PUBLISHED”,

“specificContent”: {

“com.linkedin.ugc.ShareContent”: {

“shareCommentary”: {

“text”: “This is Test Post!”

},

“shareMediaCategory”: “NONE”

}

},

“visibility”: {

“com.linkedin.ugc.MemberNetworkVisibility”: “PUBLIC”

}

Medium Article Link -- (Link)

image

View original source

https://www.servicenow.com/community/developer-articles/servicenow-and-linkedin-integration/ta-p/2321608