.Skip to main content
2 min read
I was looking for a way to import my twitter favourites. First I was thinking about writing a plugin that checks the twitter api for new likes, but no one ain't no time for that.
So reading about IFTTT again, I wanted to give a try as the maker channel seems to fit as it let's you make web request to a publicly accessible URL. No luck with the Known API, it needs some custom http headers.
So I wrote a quick and dirty request forwarder : KnownApiForward. It takes the request from ifttt and passes it to the known api.
The Known documentation is still a bit poor and one has to get the pieces together if you're not familiar with it.
What you need is :
your endpoint (your_known/action/edit in my case for a status https:/
your api key (account settings -> tools).
Calculate the token :
$token = base64_encode(hash_hmac('sha256',$known['action'] ,$known['known_api_key'] , true));
Headers for the curl call :
$known['headers'] = array('Accept: application/json', 'X-KNOWN-USERNAME: ' . $known['username'], 'X-KNOWN-SIGNATURE: ' .$known['token'], 'Content-Type: application/json', 'Content-Length: ' . strlen($known['status']));
And the curl options :
curl_setopt($ch, CURLOPT_COOKIEJAR, "/tmp/cookiefile"); curl_setopt($ch, CURLOPT_URL,"YOUR_KNOWN_SITE_URL".$known['action']); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $known['status']); curl_setopt($ch, CURLOPT_HTTPHEADER, $known['headers']);
In IFTT, create a recipe with the Maker Channel. Provide the script's url and put a json formatted text in the body field :
@withknown seems that YT videos only are embedded with status updates? https:/
@ubernauten Danke, war aber nicht mein Script,sondern eine App (http:/