hann...
hann...

Reputation: 70

Posting to LinkedIn through API call to post through Zapier

This is mainly a question about the LinkedIn versioned API (https://api.linkedin.com/rest/posts).

I had hoped to use Zapier for a no-code solution, but their LinkedIn posting options are limiting to sharing a link to an article.

So I'm diving into the LinkedIn API documentation, to execute a Zapier custom LinkedIn API call. The reason I'm sticking with Zapier is because it handles the api authorization for me and this way I don't have to struggle with access tokens.

I have 2 seperate wishes:

  1. retrieve a list of my own personal LinkedIn posts
  2. post a new post with text + image on my personal LinkedIn profile

For wish 1 (retrieve a list of my own personal LinkedIn posts) I'm doing

The result of this request is "Failed to create a http request in LinkedIn Raw request failed. Problem executing your request: No virtual resource found"


For wish 2 (post a new post on my personal LinkedIn profile) I tried:

This one gives me the exact same result "No virtual resource found"


I'm obviously doing something wrong, but as most of the resources found online are for v2 of the api, I haven't been able to figure it out.

Should I be able to access this part of the API as a regular user?

When I do a GET request to https://api.linkedin.com/rest/me including the "LinkedIn-Version" header, I get a proper reponse including my profile name & headline, so I think that means the authentication works fine.

Note: I am not an app or registered as a LinkedIn developer. Though working through Zapier does obscure this a bit, I don't know how LinkedIn interprets my custom Zapier request.

I am hoping for some pointers on what I'm doing or assuming wrong here?

Upvotes: 0

Views: 107

Answers (1)

Mateusz Kraiński
Mateusz Kraiński

Reputation: 95

I'm playing around with something similar - I'm trying to create a post on a company page and then repost it on my private account. I managed to get the post creation working fine (there is a dedicated action for that), but I'm struggling with the second step - I need to use the raw API call and that requires my personal urn id as a parameter.

Unfortunately I was not able to resolve this - it looks like it's not possible, explanation follows. But maybe I'm wrong and this will point the next person to a proper solution.

Based on the docs: https://learn.microsoft.com/en-us/linkedin/shared/integrations/people/profile-api#person-id

Each member id is unique to the context of your application only. Sharing a person ID across applications will not work and result in a 404 error.

I'm not sure where you got your urn number from, but if you got it somewhere outside of the zap, it may not work with the zap. But this means that the flow should work as long as we are able to get the personal urn id from within the zap.

But this is where I've failed. Based on some research I did, a call to /v2/userinfo or /rest/me should return it:

But.

  1. /v2/userinfo doesn't work: the error is Raw request failed. Problem executing your request: Not enough permissions to access: userinfo.GET.NO_VERSION. If this is a permission issue, this may be due to how Zapier establishes the oauth session, which is not something we can configure. If I understand correctly, v2 is the old API versioning scheme - the new one is to use /rest/... and provide Linkedin-version header. Trying out /rest/userinfo with the header also doesn't work (Raw request failed. Problem executing your request: No virtual resource found).

  2. using /rest/me returns a response but it looks like the relevant id field is censored by Zapier. Response looks like this :censored:xx:xxxxxxxxxx:. Based on Zapier docs (https://docs.zapier.com/platform/build/oauth)

    Input fields marked as password and all authentication fields with sensitive, private data such as both username and password from OAuth v2 are automatically censored at runtime.

    My guess is that Zapier sees that ID as a sensitive piece of data and censors it automatically. Unfortunately it makes it unusable in subsequent zaps. Hence my conclusion that this may not be possible.

Upvotes: 0

Related Questions