Integra LinkedIn come canale marketing con pubblicazione da WhatsApp #2

Closed
opened 2026-04-16 18:18:07 +02:00 by forgejo-admin · 3 comments

Obiettivo

Integrare LinkedIn come sistema di marketing all'interno di swarmbot, consentendo agli utenti di pubblicare messaggi/post su LinkedIn direttamente inviando un comando tramite WhatsApp.

Contesto

Attualmente swarmbot supporta la comunicazione via WhatsApp, ma manca la capacità di interagire con piattaforme di marketing esterne. LinkedIn è una piattaforma fondamentale per il marketing professionale e B2B. Permettere la pubblicazione di contenuti direttamente da WhatsApp renderebbe il flusso di lavoro molto più rapido e accessibile.

Requisiti funzionali

  • Integrazione LinkedIn API: Implementare l'autenticazione OAuth 2.0 con LinkedIn e l'utilizzo delle LinkedIn Share API / UGC Post API per la pubblicazione di contenuti.
  • Comando WhatsApp per pubblicazione: L'utente deve poter inviare un messaggio su WhatsApp con un comando (es. /linkedin post <testo>) per pubblicare un post su LinkedIn.
  • Supporto contenuti multimediali: Permettere l'inclusione di immagini e link nei post pubblicati.
  • Anteprima prima della pubblicazione: Prima di pubblicare, swarmbot deve mostrare un'anteprima del post e chiedere conferma all'utente.
  • Gestione multi-profilo: Supportare la pubblicazione su pagine aziendali LinkedIn oltre che sul profilo personale.
  • Notifica di conferma: Dopo la pubblicazione, inviare un messaggio di conferma su WhatsApp con il link al post pubblicato.

Requisiti tecnici

  • Implementare un modulo LinkedInService che gestisca l'autenticazione e la pubblicazione.
  • Aggiungere un handler per i comandi WhatsApp relativi a LinkedIn.
  • Salvare in modo sicuro i token OAuth di LinkedIn (refresh token).
  • Gestire la scadenza e il rinnovo automatico dei token.
  • Aggiungere test unitari e di integrazione.

Comandi WhatsApp proposti

Comando Descrizione
/linkedin post <testo> Pubblica un post di testo su LinkedIn
/linkedin post <testo> + immagine Pubblica un post con immagine
/linkedin preview <testo> Mostra un'anteprima del post senza pubblicare
/linkedin status Verifica lo stato della connessione LinkedIn
/linkedin connect Avvia il flusso di connessione OAuth con LinkedIn

Criteri di accettazione

  • L'utente può autenticarsi con LinkedIn tramite OAuth 2.0
  • L'utente può pubblicare un post di testo su LinkedIn inviando un comando WhatsApp
  • L'utente riceve un'anteprima prima della pubblicazione e deve confermare
  • L'utente riceve conferma con link al post dopo la pubblicazione
  • I token sono salvati in modo sicuro e rinnovati automaticamente
  • Sono presenti test unitari e di integrazione
## Obiettivo Integrare LinkedIn come sistema di marketing all'interno di swarmbot, consentendo agli utenti di pubblicare messaggi/post su LinkedIn direttamente inviando un comando tramite WhatsApp. ## Contesto Attualmente swarmbot supporta la comunicazione via WhatsApp, ma manca la capacità di interagire con piattaforme di marketing esterne. LinkedIn è una piattaforma fondamentale per il marketing professionale e B2B. Permettere la pubblicazione di contenuti direttamente da WhatsApp renderebbe il flusso di lavoro molto più rapido e accessibile. ## Requisiti funzionali - **Integrazione LinkedIn API**: Implementare l'autenticazione OAuth 2.0 con LinkedIn e l'utilizzo delle LinkedIn Share API / UGC Post API per la pubblicazione di contenuti. - **Comando WhatsApp per pubblicazione**: L'utente deve poter inviare un messaggio su WhatsApp con un comando (es. `/linkedin post <testo>`) per pubblicare un post su LinkedIn. - **Supporto contenuti multimediali**: Permettere l'inclusione di immagini e link nei post pubblicati. - **Anteprima prima della pubblicazione**: Prima di pubblicare, swarmbot deve mostrare un'anteprima del post e chiedere conferma all'utente. - **Gestione multi-profilo**: Supportare la pubblicazione su pagine aziendali LinkedIn oltre che sul profilo personale. - **Notifica di conferma**: Dopo la pubblicazione, inviare un messaggio di conferma su WhatsApp con il link al post pubblicato. ## Requisiti tecnici - Implementare un modulo `LinkedInService` che gestisca l'autenticazione e la pubblicazione. - Aggiungere un handler per i comandi WhatsApp relativi a LinkedIn. - Salvare in modo sicuro i token OAuth di LinkedIn (refresh token). - Gestire la scadenza e il rinnovo automatico dei token. - Aggiungere test unitari e di integrazione. ## Comandi WhatsApp proposti | Comando | Descrizione | |---|---| | `/linkedin post <testo>` | Pubblica un post di testo su LinkedIn | | `/linkedin post <testo> + immagine` | Pubblica un post con immagine | | `/linkedin preview <testo>` | Mostra un'anteprima del post senza pubblicare | | `/linkedin status` | Verifica lo stato della connessione LinkedIn | | `/linkedin connect` | Avvia il flusso di connessione OAuth con LinkedIn | ## Criteri di accettazione - [ ] L'utente può autenticarsi con LinkedIn tramite OAuth 2.0 - [ ] L'utente può pubblicare un post di testo su LinkedIn inviando un comando WhatsApp - [ ] L'utente riceve un'anteprima prima della pubblicazione e deve confermare - [ ] L'utente riceve conferma con link al post dopo la pubblicazione - [ ] I token sono salvati in modo sicuro e rinnovati automaticamente - [ ] Sono presenti test unitari e di integrazione
Author
Owner

🔄 L'agente ha preso in carico questa issue.

🔄 L'agente ha preso in carico questa issue.
Author
Owner

Task completato - Modulo linkedin_service.py creato e integrato nel webhook. Bug di concorrenza corretto con lock PID-based e TimeoutStartSec=infinity nel servizio systemd.

Task completato - Modulo linkedin_service.py creato e integrato nel webhook. Bug di concorrenza corretto con lock PID-based e TimeoutStartSec=infinity nel servizio systemd.
Author
Owner

Task fallito!

Errore:

Exit code: -15
● [18:39:20] Continue 15811a6d-063e-4ffa-b580-e731f71b3d4d
The user wants me to integrate LinkedIn as a marketing system within swarmbot. Let me first explore the codebase to understand the project structure, existing patterns, and how to best implement this feature.

Let me start by finding the swarmbot project and understanding its structure.
● [18:39:27] Update Todos 8 item(s)

  󰄗 Explore swarmbot codebase structure and existing patterns
  󰄱 Implement LinkedInService module (OAuth 2.0 + publishing)
  󰄱 Add WhatsApp command handler for LinkedIn commands
  󰄱 Implement secure token storage and auto-refresh
  󰄱 Implement preview and confirmation flow
  󰄱 Add multi-profile support (personal + company pages)
  󰄱 Add unit and integration tests
  󰄱 Verify everything works (build + tests)

● [18:39:44] SAGE [Agent] Explore the swarmbot codebase thoroughly. I need to understand:
1. The overall project structure (directories, main files)
2. What language/framework is used
3. How WhatsApp integration works (message handling, command parsing)
4. How existing services are structured (patterns for auth, API calls, etc.)
5. How configuration/environment variables are managed
6. How token storage/credentials are handled
7. Existing test patterns and test framework
8. Package manager and build system

Search broadly in /root and common project locations like /root/swarmbot, /root/app, /opt, /home, etc. Find the project root and give me a comprehensive overview.
● [18:39:48] Search for 'swarmbot' at .
● [18:39:48] Search for 'swarmbot' at /opt
● [18:39:48] Search for 'swarmbot' at /home
● [18:39:56] Search for '.' at /opt
● [18:40:00] Search for '.' at /opt/swarmbot
● [18:40:00] Search for '.' at /opt/forgejo-whatsapp-bot
● [18:40:06] Read /opt/swarmbot/README.md
● [18:40:06] Read /opt/swarmbot/bot/forgejo_wa_bot.py
● [18:40:06] Read /opt/swarmbot/agent/forgejo_agent.py
● [18:40:06] Read /opt/swarmbot/webhook/forgejo_webhook.py
● [18:40:06] Read /opt/swarmbot/webhook/machines.yaml.example
● [18:40:06] Read /opt/swarmbot/evolution-api/docker-compose.yaml
● [18:40:06] Read /opt/swarmbot/utils/set-poll-interval
● [18:40:15] Read /opt/swarmbot/systemd/forgejo-wa-bot.service
● [18:40:15] Read /opt/swarmbot/systemd/forgejo-wa-bot.timer
● [18:40:15] Read /opt/swarmbot/systemd/forgejo-agent.service
● [18:40:15] Read /opt/swarmbot/systemd/forgejo-agent.timer
● [18:40:19] Read /opt/swarmbot/systemd/forgejo-webhook.service
● [18:40:19] Read /opt/swarmbot/systemd/forgejo.service
● [18:40:19] Read /opt/swarmbot/nginx/forgejo.conf
● [18:40:19] Read /opt/swarmbot/forgejo/app.ini
● [18:40:26] Read /opt/forgejo-whatsapp-bot/forgejo_wa_bot.py
● [18:40:26] Read /opt/forgejo-whatsapp-bot/forgejo_agent.py
● [18:40:26] Read /opt/forgejo-whatsapp-bot/forgejo_webhook.py
● [18:40:26] Read /opt/forgejo-whatsapp-bot/linkedin_service.py
● [18:40:26] Read /opt/forgejo-whatsapp-bot/machines.yaml
● [18:40:26] Read /opt/forgejo-whatsapp-bot/state.json
● [18:40:26] Read /opt/forgejo-whatsapp-bot/retries.json
● [18:40:35] Search for '.' in '*test*' files at /opt
● [18:40:35] Search for '.' in '*requirements*' files at /opt
● [18:40:35] Search for '.' in '*.env*' files at /opt
● [18:40:35] Search for '.' in '*setup*' files at /opt
● [18:40:35] Search for '.' in '*pyproject*' files at /opt
● [18:40:35] Search for '.' in '*.cfg' files at /opt
● [18:40:52] Read /opt/forgejo-whatsapp-bot/conversation_id.txt
● [18:40:52] Read /opt/forgejo-whatsapp-bot/whatsapp_conversation_id.txt
● [18:40:52] Search for '.' in '*.txt' files at /opt/forgejo-whatsapp-bot
Excellent! Now I have a comprehensive understanding of the codebase. Let me summarize the key findings:

1. The project is at /opt/swarmbot/ (source) and /opt/forgejo-whatsapp-bot/     
   (deployed runtime)
2. It's Python3.9+ with Flask, requests, pyyaml3. LinkedIn integration already  
   partially exists in the deployed version at                                  
   /opt/forgejo-whatsapp-bot/linkedin_service.py (604 lines) and e
❌ Task fallito! **Errore:** ``` Exit code: -15 ● [18:39:20] Continue 15811a6d-063e-4ffa-b580-e731f71b3d4d The user wants me to integrate LinkedIn as a marketing system within swarmbot. Let me first explore the codebase to understand the project structure, existing patterns, and how to best implement this feature. Let me start by finding the swarmbot project and understanding its structure. ● [18:39:27] Update Todos 8 item(s) 󰄗 Explore swarmbot codebase structure and existing patterns 󰄱 Implement LinkedInService module (OAuth 2.0 + publishing) 󰄱 Add WhatsApp command handler for LinkedIn commands 󰄱 Implement secure token storage and auto-refresh 󰄱 Implement preview and confirmation flow 󰄱 Add multi-profile support (personal + company pages) 󰄱 Add unit and integration tests 󰄱 Verify everything works (build + tests) ● [18:39:44] SAGE [Agent] Explore the swarmbot codebase thoroughly. I need to understand: 1. The overall project structure (directories, main files) 2. What language/framework is used 3. How WhatsApp integration works (message handling, command parsing) 4. How existing services are structured (patterns for auth, API calls, etc.) 5. How configuration/environment variables are managed 6. How token storage/credentials are handled 7. Existing test patterns and test framework 8. Package manager and build system Search broadly in /root and common project locations like /root/swarmbot, /root/app, /opt, /home, etc. Find the project root and give me a comprehensive overview. ● [18:39:48] Search for 'swarmbot' at . ● [18:39:48] Search for 'swarmbot' at /opt ● [18:39:48] Search for 'swarmbot' at /home ● [18:39:56] Search for '.' at /opt ● [18:40:00] Search for '.' at /opt/swarmbot ● [18:40:00] Search for '.' at /opt/forgejo-whatsapp-bot ● [18:40:06] Read /opt/swarmbot/README.md ● [18:40:06] Read /opt/swarmbot/bot/forgejo_wa_bot.py ● [18:40:06] Read /opt/swarmbot/agent/forgejo_agent.py ● [18:40:06] Read /opt/swarmbot/webhook/forgejo_webhook.py ● [18:40:06] Read /opt/swarmbot/webhook/machines.yaml.example ● [18:40:06] Read /opt/swarmbot/evolution-api/docker-compose.yaml ● [18:40:06] Read /opt/swarmbot/utils/set-poll-interval ● [18:40:15] Read /opt/swarmbot/systemd/forgejo-wa-bot.service ● [18:40:15] Read /opt/swarmbot/systemd/forgejo-wa-bot.timer ● [18:40:15] Read /opt/swarmbot/systemd/forgejo-agent.service ● [18:40:15] Read /opt/swarmbot/systemd/forgejo-agent.timer ● [18:40:19] Read /opt/swarmbot/systemd/forgejo-webhook.service ● [18:40:19] Read /opt/swarmbot/systemd/forgejo.service ● [18:40:19] Read /opt/swarmbot/nginx/forgejo.conf ● [18:40:19] Read /opt/swarmbot/forgejo/app.ini ● [18:40:26] Read /opt/forgejo-whatsapp-bot/forgejo_wa_bot.py ● [18:40:26] Read /opt/forgejo-whatsapp-bot/forgejo_agent.py ● [18:40:26] Read /opt/forgejo-whatsapp-bot/forgejo_webhook.py ● [18:40:26] Read /opt/forgejo-whatsapp-bot/linkedin_service.py ● [18:40:26] Read /opt/forgejo-whatsapp-bot/machines.yaml ● [18:40:26] Read /opt/forgejo-whatsapp-bot/state.json ● [18:40:26] Read /opt/forgejo-whatsapp-bot/retries.json ● [18:40:35] Search for '.' in '*test*' files at /opt ● [18:40:35] Search for '.' in '*requirements*' files at /opt ● [18:40:35] Search for '.' in '*.env*' files at /opt ● [18:40:35] Search for '.' in '*setup*' files at /opt ● [18:40:35] Search for '.' in '*pyproject*' files at /opt ● [18:40:35] Search for '.' in '*.cfg' files at /opt ● [18:40:52] Read /opt/forgejo-whatsapp-bot/conversation_id.txt ● [18:40:52] Read /opt/forgejo-whatsapp-bot/whatsapp_conversation_id.txt ● [18:40:52] Search for '.' in '*.txt' files at /opt/forgejo-whatsapp-bot Excellent! Now I have a comprehensive understanding of the codebase. Let me summarize the key findings: 1. The project is at /opt/swarmbot/ (source) and /opt/forgejo-whatsapp-bot/ (deployed runtime) 2. It's Python3.9+ with Flask, requests, pyyaml3. LinkedIn integration already partially exists in the deployed version at /opt/forgejo-whatsapp-bot/linkedin_service.py (604 lines) and e ```
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
forgejo-admin/swarmbot#2
No description provided.