Update on sending social media posts from Hugo based static site
Around a year ago I posted on 'Social Media Posts after Migrating from WordPress to Hugo Static Pages'. Recently I have found that the Twitter functionality in my Logic App was failing.
Turns out this was due to the changes in the Twitter Free API, with them moving from V1 to V2 which requires OAuth authentication as opposed to a Bearer token.
In essence the core of the problem is that the built-in Logic Apps Twitter Connector only supports the V1 Twitter API. So the only option was to create my own custom solution.
This I have done using an Azure Function called from my existing Logic App. The code in the Function is shown below.
Note: For this function code to work you also need a
function.proj
file upload that adds the reference to OAuth.net package1 <Project Sdk="Microsoft.NET.Sdk"> 2 <PropertyGroup> 3 <TargetFramework>netstandard2.0</TargetFramework> 4 </PropertyGroup> 5 <ItemGroup> 6 <PackageReference Include="OAuth.net" Version="1.7.0" /> 7 </ItemGroup> 8 </Project>
The function is called from my Logic App using the built in Azure Function Connector. So nicely encapsulating all the custom code away from my Logic App.
I guess it is time to consider adding Threads and BlueSKy to the Logic App, but I will leave that for another day.