Skip to content

Tan-Software/automate-linkedin-posting

Repository files navigation

automate-linkedin-posting

License: MIT Python CI Code style: Ruff

Schedule and publish LinkedIn posts from a .docx file via the official LinkedIn UGC Posts API. A small command-line helper that generates dated .docx drafts, runs in the background, and posts them automatically when their scheduled time arrives.

Français · English


English

What and why

A no-frills CLI to:

  1. generate a .docx post template named with the target publication date and time;
  2. run a background watcher that, every hour, scans scheduled_posts/ and publishes any document whose timestamp falls within plus or minus one hour of now on LinkedIn;
  3. test that your ACCESS_TOKEN and URN are valid.

The goal is to author posts in a familiar Word/LibreOffice editor instead of LinkedIn's web textarea, and to time-shift their publication.

Quick start

git clone https://github.com/Tan-Software/automate-linkedin-posting.git
cd automate-linkedin-posting
python -m venv .venv && source .venv/bin/activate    # Windows: .venv\Scripts\activate
pip install -r requirements.txt
cp .env.example .env                                  # then fill in ACCESS_TOKEN and URN
python main.py

You will be prompted to:

  • 1 — generate a new .docx draft (you pick its publication date/time).
  • 2 — launch the background scheduler (publishes drafts as their slot arrives).
  • 3 — run a connectivity test against the LinkedIn API.

Configuration

Variables are read from .env:

Variable Description
ACCESS_TOKEN LinkedIn API access token (w_member_social scope)
URN Member URN of the publishing account (the part after urn:li:person:)

See LinkedIn's official guide for how to obtain a token.

Project layout

automate-linkedin-posting/
├─ main.py                          # entry point and choice menu
├─ libs/
│  ├─ welcome.py                    # CLI prompt
│  ├─ generate_scheduled_post.py    # produces a dated .docx in scheduled_posts/
│  └─ post_on_linkedin.py           # background watcher + LinkedIn UGC publish
├─ requirements.txt
├─ .env.example
└─ ruff.toml

Tests and quality

The repository ships a Ruff configuration and a GitHub Actions workflow that runs ruff check and ruff format --check on every push and pull request.

Local checks:

pip install ruff
ruff check .
ruff format --check .

Français

Ce que c est et pourquoi

Un petit utilitaire en ligne de commande pour :

  1. générer un modèle .docx nommé d après la date et l heure de publication souhaitée ;
  2. lancer un superviseur en arrière-plan qui scrute scheduled_posts/ toutes les heures et publie sur LinkedIn les documents dont l horodatage tombe dans la fenêtre plus ou moins une heure ;
  3. tester que ACCESS_TOKEN et URN fonctionnent.

L idée est de rédiger ses posts dans Word/LibreOffice plutôt que dans l éditeur web de LinkedIn, et d en différer la publication.

Démarrage rapide

git clone https://github.com/Tan-Software/automate-linkedin-posting.git
cd automate-linkedin-posting
python -m venv .venv && source .venv/bin/activate    # Windows : .venv\Scripts\activate
pip install -r requirements.txt
cp .env.example .env                                  # puis renseignez ACCESS_TOKEN et URN
python main.py

Trois choix vous sont proposés :

  • 1 — générer un nouveau brouillon .docx (vous choisissez sa date/heure de publication).
  • 2 — lancer le superviseur en arrière-plan (publie les brouillons à leur créneau).
  • 3 — lancer un test de connexion à l API LinkedIn.

Licence

Distribué sous licence MIT.

Pour aller plus loin

Auteur

Tansoftware - Tanguy Chénier · LinkedIn · Tan-Software · Compte personnel (derniers outils) · tansoftware.com

About

CLI Python pour planifier et publier automatiquement des posts LinkedIn depuis des fichiers .docx via l API LinkedIn UGC.

Topics

Resources

License

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages