How to send a post to LinkedIn - Why do a proof of concept (POC) - Serverless SaaS Build Series 1.4

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
in this video we're going to be building a proof of concept to make sure that we can solve the biggest challenge that is part of this sas solution [Music] hi guys my name is sam with complete coding where our aim is to make you into the best aws and serverless developers that you can be in this video we're going to be tackling the biggest challenge that may get in the way of us building our solution and that is how do we actually post a post to linkedin so the reason that we're doing this proof of concept now is that if we don't know how we're going to do this part then we may end up spending hours and hours or even days of time building out the rest of the solution and then it's all going to waste if we can't do this step if you're building your own sas applications then when you're designing it work out what you know you can do and what areas there are question marks about and if you have those questions about what is actually possible do something like this where you prove that you can get it to work in the most basic form so that you don't waste time on building the rest of your solution without being able to deliver the functionality that you need so let's jump onto the computer and i'll show you how i've done this for this linkedin posting so to make sure i could do this what i did is i went on to the linkedin developers and i have created myself a new app i've actually gone ahead and filled out all of the details and to create an app you actually need to associate it with a linkedin page so to do that i had to go into linkedin and i've made myself the post planning guru linkedin page which of course needed a little image which i knocked together in canva for now this is super simple i didn't want to waste any time on doing anything fancy but with this linkedin page which i am an admin of now i'm able to create this app and verify that this app that i'm creating which is also called post planning guru is associated with this linkedin page so what i can do is verify this and go through this process and then i'll have a linkedin app connected to a linkedin web page so all this is doing is saying is the post planning guru linkedin page giving access to this post planning guru app i'm going to click verify and that has been done so i can go back into here and say i am done and if i try refreshing this page let's see if that's worked perfect that has been verified so in here now i have an authorized app and inside auth i can use the client id and this client secret to interact with the linkedin apis to be able to do some requests so the next step we need to do is go into products and what i'm going to be requesting is both the share on linkedin as well as the marketing developer platform so the share on linkedin will allow me to create a post to linkedin as a user and then the marketing developer platform will allow me to share as a organization or a pe page later on so as you can see the share on linkedin is already done but the marketing developer platform there's some extra steps i need to go through to get that working but for the mvp all we need is this share on linkedin so that means we can continue so now we want to actually try accessing this share on linkedin and the way that we do that is using oauth to allow a user to log in to this application the way we're going to be doing this to prove first of all is just manually doing it by the urls so the first thing we need to do is set authorized redirect url so this is just a url to send the user once they've logged in and it needs to end in auth linkedin callback and i'm just using dev.example.com as that does work for now then what we need to do is actually create the oauth url so if i go over into postman i've actually started to set this up so it's going to be a url of linkedin oauth v2 authorization and then the parameters on it are a response type of code the client id you can get from the auth section just there you need to paste your redirect url which is the one we've just entered i'm going to then have a state and this state is just a random string which you can use inside your app to verify that this request has actually come from you so i'm using complete coding sas product as my random string for now and then the scope and this scope is what are the users um allowing you to do when they authorize with your app and to start with we're going to be going with w member social which allows us to create posts comments and likes on behalf of the user there are other ones such as reading the user's profile being able to read the stats on posts that they have created as well as sharing as a page but we want to do those later down the line and for now this is all we need so what i'm going to do is copy this whole url head into a browser and paste that and what will happen is i'm redirected to this linkedin page so i'm going to log in and i've got my password saved up here and when i sign in it now says are you giving post planning guru the permission to create modify and delete posts comments and reactions on your behalf which is what that are our member profile was i'm going to hit allow and i then get redirected to this dev app this now means that we have some extra information and if i make sure to copy this url as this has a code in it and that code is vital for allowing us to actually make the api requests in the future so what i'm going to do is i'm going to copy that and head back into postman to create a new request so the next thing we need to do is actually get a token which we can then use to create our posts to get this token we need to hit linkedin oauth v2 slash access token we're accessing an authorization code what we need to do is put the code from the last request in here and then your client id and your client secret into here and then make that request so i'll copy my code across from another tab so there's my code my client id i'm going to get from my authentication tab like that and then i'm going to do the same with my client secret and now that i've pasted all of those in here if i hit send i get a response https so after a little bit of tinkering around i realized i need to change this to dev dot example as that matches the one on the account and change it from www dot to https linkedin once i'd done those two things i made the request and i get sent back this access token this access token you need to keep very safe as this now allows anyone to hit an api with this access token which will then create a post on the account that you have authorized it with what i'm going to do is copy this and we can actually check inside our linkedin app what this token has access to do if you go into your app on the right hand side is this token inspector if you click on that and paste in your token hit inspect you can see that it is the permissions to do right member social it was created about two minutes ago and that is exactly what we expect so after quite a bit of frustration trying to get this working i realized that i had to go slightly off from the tutorial i was following and in products i had to also add this sign in with linkedin so that is an extra thing i needed to add to the product with that i could then go through the process again this time in here re-adding this our light profile again and with this our light profile getting a new authorization key with that key i was then able to hit the linkedin api v2 me and what this does is it gets a very basic version of my profile information and the key for us is the id with this id i could then use that in a post so if i look at the body of this you can see in here that i am creating a post as author person colon my id and then some extra config in here which is all copied from the tutorial i was following and finally i get a 201 created and a uri for my shared post so if i go into linkedin and if i go to my profile we can now scroll down to activity and actually look at my last post which is exactly what i've just posted from postman this means that the whole process is working and i can programmatically create a post to linkedin so now that we know that this all works what we can do is actually start the build as everything that we want to do we know that we can do so in the next video we'll be actually looking at the setup of the databases and that will actually be the first section of the actual build of our product in this video we have looked at linkedin and the apis that they have and we've proven that we can set up a linkedin app we can have a way of a user authenticating that the app can post on their behalf and then once we've got that we can get some tokens and then actually generate a post on the user's behalf this is one of the big challenges that was in the way of getting this product built and now that we know we can do it we can crack on with the rest of the project so in the next video what we're going to be doing is talking about the databases that we're going to need and getting started with the full build of our solution so if you're excited for that video make sure to subscribe down below and turn on the bell notifications so you get notified when i upload that video and so thank you and i'll see you in that next video
Info
Channel: Complete Coding
Views: 460
Rating: undefined out of 5
Keywords: AWS, serverless, Serverless Framework, NodeJS
Id: C8xLMLqsrBY
Channel Id: undefined
Length: 14min 22sec (862 seconds)
Published: Wed Apr 21 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.