<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>Coder Legion - Recent posts tagged linkedin-api</title>
<link>https://coderlegion.com/tag/linkedin-api</link>
<description>Powered by Question2Answer</description>
<item>
<title>Autopilot - the API Nightmare: How I Defeated LinkedIn Bureaucracy to Automate My Company</title>
<link>https://coderlegion.com/11564/autopilot-the-api-nightmare-how-i-defeated-linkedin-bureaucracy-to-automate-my-company</link>
<description>&lt;p&gt;Until now, everything was fun. We had AI agents with cynical personalities (&lt;a rel=&quot;nofollow&quot; href=&quot;https://datalaria.com/en/posts/ai_agents_part3/&quot;&gt;Post 3&lt;/a&gt;) and a brain capable of analyzing text (&lt;a rel=&quot;nofollow&quot; href=&quot;https://datalaria.com/en/posts/ai_agents_part2/&quot;&gt;Post 2&lt;/a&gt;). But everything lived in the safety of my terminal, on &lt;code&gt;localhost&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;For &lt;strong&gt;Datalaria Autopilot&lt;/strong&gt; to become real, it had to get out into the world.&lt;/p&gt;
&lt;p&gt;Here is where the project stopped being an engineering problem and became a battle against &lt;strong&gt;API Bureaucracy&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://datalaria.com/en/posts/ai_agents_part4/autopilot_api_nightmare.png&quot; alt=&quot;Project Concept Image - The API Nightmare&quot;&gt;&lt;/p&gt;
&lt;h3 id=&quot;the-goal-publishing-as-a-brand-not-a-person&quot;&gt;The Goal: Publishing as a Brand, Not a Person&lt;/h3&gt;
&lt;p&gt;My requirement was clear: I don't want the bot posting on my personal LinkedIn profile. I want it to post on the &lt;strong&gt;Datalaria Company Page&lt;/strong&gt;, with the official logo and a corporate tone.&lt;/p&gt;
&lt;p&gt;Technically, this requires a change in the API endpoint:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Personal Profile: &lt;code&gt;urn:li:person:12345&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Company Page: &lt;code&gt;urn:li:organization:110125695&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;It looks like a one-line code change. &lt;strong&gt;It ended up being a couple of days of waiting and red tape.&lt;/strong&gt;&lt;/p&gt;
&lt;h3 id=&quot;battle-1-twitter-x-and-the-anti-bot-wall&quot;&gt;Battle 1: Twitter (X) and the Anti-Bot Wall&lt;/h3&gt;
&lt;p&gt;First up, Twitter. Getting API access these days requires passing an audition. I had to apply for the &lt;em&gt;Free Tier&lt;/em&gt; and write a &quot;motivational letter&quot; explaining that I am not a Russian spam bot, but an AI technical enthusiast.&lt;/p&gt;
&lt;p&gt;After getting past the &lt;code&gt;403 Forbidden&lt;/code&gt; error (I forgot to enable &quot;Read &amp;amp; Write&quot; permissions) and the &lt;code&gt;Duplicate Content&lt;/code&gt; error (I tried sending the same &quot;Hello World&quot; twice), I achieved connection. Twitter/X was ready, and in principle, everything worked simply.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://datalaria.com/en/posts/ai_agents_part4/datalaria_twitter_first_publication.png&quot; alt=&quot;Post automatically published on Twitter&quot;&gt;&lt;/p&gt;
&lt;h3 id=&quot;battle-2-the-final-boss-linkedin-company-pages-&quot;&gt;Battle 2: The Final Boss (LinkedIn Company Pages)&lt;/h3&gt;
&lt;p&gt;The biggest problem occurred with LinkedIn.&lt;/p&gt;
&lt;p&gt;I designed my &lt;code&gt;social_manager.py&lt;/code&gt; script to use a company ID if it existed in the environment variables:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-python&quot;&gt;# Hybrid logic in Python
if company_id:
    print(f&quot; Company ID Detected. Posting as page...&quot;)
    author_urn = f&quot;urn:li:organization:{company_id}&quot;
else:
    print(&quot; Posting as personal profile...&quot;)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;When I ran it, the console spat out a blood-red error:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;&lt;code&gt;❌ Error posting to LinkedIn: Status 403: ACCESS_DENIED&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h4 id=&quot;the-ghost-permission-w-organization-social&quot;&gt;The Ghost Permission: &lt;code&gt;w_organization_social&lt;/code&gt;&lt;/h4&gt;
&lt;p&gt;I discovered that the standard LinkedIn token only gives you the &lt;code&gt;w_member_social&lt;/code&gt; permission (posting as a person). The permission for companies (&lt;code&gt;w_organization_social&lt;/code&gt;) &lt;strong&gt;did not exist&lt;/strong&gt; in my developer dashboard.&lt;/p&gt;
&lt;p&gt;To unlock it, I had to complete an administrative scavenger hunt:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Page Verification:&lt;/strong&gt; I had to generate a special URL in the Developer Portal and approve it with my admin account. Result: &lt;em&gt;Company Verified&lt;/em&gt;. ✅&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Even so, it didn't work:&lt;/strong&gt; The permission still didn't appear.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;The Hidden Request:&lt;/strong&gt; I had to request access to the &lt;strong&gt;&quot;Marketing Developer Platform&quot;&lt;/strong&gt; product.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;The Form:&lt;/strong&gt; LinkedIn made me fill out a questionnaire detailing that I am a &quot;Direct Customer,&quot; that I am not an advertising agency, and that my usage is strictly internal for organic automation.&lt;/li&gt;
&lt;/ol&gt;
&lt;h4 id=&quot;the-victory&quot;&gt;The Victory&lt;/h4&gt;
&lt;p&gt;After a few hours of waiting, the approval email arrived. I re-generated the token and... there it was!&lt;/p&gt;
&lt;p&gt;With the new &quot;Super Token&quot; loaded into my &lt;code&gt;.env&lt;/code&gt;, I ran the script one last time.&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-text&quot;&gt;--- TESTING SOCIAL MEDIA MANAGER ---
DTO - Posting to Twitter... ✅ Success!
DTO - Posting to LinkedIn...
 Company ID Detected: 110125695.
✅ LinkedIn Success! Post ID: urn:li:share:741...
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And the definitive proof on the social network:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://datalaria.com/en/posts/ai_agents_part4/datalaria_linkedin_first_publication.png&quot; alt=&quot;Post automatically published on the Datalaria LinkedIn Page&quot;&gt;&lt;/p&gt;
&lt;h3 id=&quot;conclusion-and-next-steps&quot;&gt;Conclusion and Next Steps&lt;/h3&gt;
&lt;p&gt;I have achieved what seemed impossible: a Python script that has legal authorization to act as my company.&lt;/p&gt;
&lt;p&gt;But there is one final problem: &lt;strong&gt;This token expires in 60 days.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;If I do nothing, in two months this whole system will break. Furthermore, I am still running the script manually from my laptop.&lt;/p&gt;
&lt;p&gt;In the &lt;strong&gt;final post&lt;/strong&gt; of this series, we are going to automate it all. We will use &lt;strong&gt;GitHub Actions&lt;/strong&gt; so the system runs itself every time I upload an article, and (if the API lets us) we will implement automatic token renewal.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Coming Up - Post 5: Total Automation (CI/CD).&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt; &lt;strong&gt;Source Code:&lt;/strong&gt; The final &lt;code&gt;social_manager.py&lt;/code&gt; module is available in the &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/Dalaez/datalaria-website/tree/main/autopilot&quot;&gt;GitHub repo&lt;/a&gt;.&lt;/p&gt;
</description>
<category>Tutorials</category>
<guid isPermaLink="true">https://coderlegion.com/11564/autopilot-the-api-nightmare-how-i-defeated-linkedin-bureaucracy-to-automate-my-company</guid>
<pubDate>Fri, 13 Feb 2026 07:04:33 +0000</pubDate>
</item>
</channel>
</rss>