Day 20: automatic liking on Twitter
Today I drafted a SiloAPI class in indieweb-toolkit. The idea is that it gives an easy way to interact with different Silo API's. In some ways this is a bad idea, because all API's work different and have different capabilities, but I like the idea, even if it's bad.
One API call that is available for both Twitter, Instagram and Facebook is to create a like. So that's where I focussed on first. Today, I made SiloAPI
a wrapper for the TwitterOAuth PHP library, and it now supports ::like()
just like micropub::like()
. You still need to pass in the name of the silo though, but maybe I'll detecting the silo from the URL later.
siloapi::setToken('twitter', [
'consumer_key' => 'xxx',
'consumer_secret' => 'xxx',
'oauth_token' => 'xxx',
'oauth_token_secret' => 'xxx',
]);
siloapi::like('https://twitter.com/_/status/123456', 'twitter');
Then I realised that Brid.gy probably can do this for me too, since it already syndicates my Tweets for me when I ask for it. So I just made my Micropub endpoint call Brid.gy publish for every like-of
that is a twitter-URL.
I will add to SiloAPI though, because I want to autolike to Instagram too!