. Skip to main content

Daniel Nix

Can't share an Ananas from

Daniel Nix

Daniel Nix

Using the Known API

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.

Thanks to Marcus Povey who gave me some good tips on how to start with writing an api for Known, could quickly put some code together.

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://nxd4n.nixekinder.be/status/edit)

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 :

iftt maker settings

Daniel Nix

My New @withKnown Plugin : Ratings http://nixis.me/7k (based on an idea from @diplix)

Daniel Nix

Known Announces DreamHost as Exclusive Web Hosting Sponsor

SAN FRANCISCO, September 29, 2015 – Known, an open source publishing platform used to empower both individuals and groups to own their social activity online,

Daniel Nix

.@withknown new plugin : Import Your http://moves-app.com summary http://nixis.me/2d (Thanks to @diplix). See: http://nixis.me/2e

Daniel Nix

@withknown seems that YT videos only are embedded with status updates? https://www.youtube.com/watch?v=t2ZoU0LEM6E

Daniel Nix

seems @withknown is not 100% compatible with https://quill.p3k.io/ @aaronpk

Daniel Nix

@ubernauten Danke, war aber nicht mein Script,sondern eine App (http://withknown.com) wollte smtp server und account wissen. Läuft jetzt.

Daniel Nix

Known: create a single website for all your content

Just installed Known, simple blog software with and support