Skip to content

LinkedIn APIs were used to automate your post, which was then combined with a JSON API for a random meme pulled from Reddit, which is maintained by @D3vd and set up using GitHub action.

License

DSDmark/LinkedinAutomation

Repository files navigation

LinkedinAutomation 💤

GitHub tag (latest by date) GitHub GitHub language count GitHub last commit Run Node.js Script

Automate your post using LinkedIn APIs with random memes API from Reddit.

Purpose 😑

Linkedin APIs were used to automate your post, which was then combined with a JSON API for a random meme pulled from Reddit, which is maintained by @D3vd and set up using GitHub action.

📓 you can also write that script in bash or python which is well suited for that type of work.

How to install 😒

You can utilise that script by Using Nodejs.

here is by using Nodejs.

  1. Click on the green Clone button or choose Download ZIP.
  2. Find the downloaded zipped file on your pc and extract it.
  3. Install nodejs and NPM in your local system.
  4. Open the Root Directory, navigate to LinkedinAutomation using the command cd LinkedinAutomation and use either npm install or pnpm install to install all dependencies.
  5. After that, configure these values in the .env file:
BASE_URL=https://api.linkedin.com/v2
MEMES_URL=https://meme-api.com/gimme
CLIENT_ID=
CLIENT_SECRET=
REDIRECT_URI=
ACCESS_TOKEN=
  1. Then run npm start or pnpm start. Now you can see this output:
LinkedIn post created successfully: { id: 'urn:li:share:7078778985983164433' }

which is show your post is created successfully.

How to automate using github-actions.

You can always set that script in your local system by using corn job to upload posts on LinkedIn or you can use github-action for this work.

here is to set GitHub action to run that script with a fixed interval of time.

  1. Go to your action tab and create action and paste that code:
name: Run Node.js Script

on:
  push:
   branches: master
  schedule:
    - cron: "0 */24 * * *"      

env:
  ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
  BASE_URL: ${{ secrets.BASE_URL }}
  CLIENT_ID: ${{ secrets.CLIENT_ID }}
  CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }}
  MEMES_URL: ${{ secrets.MEMES_URL }}
  REDIRECT_URI: ${{ secrets.REDIRECT_URI }}

jobs:
  run-script:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout code
        uses: actions/checkout@v3

      - name: Set up Node.js
        uses: actions/setup-node@v3
        with:
          node-version: "16"

      - name: Install dependencies
        run: npm install

      - name: Run script
        run: node src/main.js
  1. you can set interval which you want to upload your post on linkedin by seting cron: "0 */24 * * *" in above action.
  2. Go to your repo setting and open that section and set these envroments:
env:
  ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
  BASE_URL: ${{ secrets.BASE_URL }}
  CLIENT_ID: ${{ secrets.CLIENT_ID }}
  CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }}
  MEMES_URL: ${{ secrets.MEMES_URL }}
  REDIRECT_URI: ${{ secrets.REDIRECT_URI }}

like this:

image

Now your script is good to go.


Here you can quickly start with that repo 👼

Edit on CodeSandbox


LinkedinAutomation preview 👀

LinkedinAutomation perview

If you have any issues with that Application feel free to let me know 🙃!

If you are more interested. check out 🥺 the collection of DSDmark


About

LinkedIn APIs were used to automate your post, which was then combined with a JSON API for a random meme pulled from Reddit, which is maintained by @D3vd and set up using GitHub action.

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Sponsor this project