Producing a Riddle.com integration in a Low-Code fashion

Mohammed Brückner
3 min readMar 24, 2019

--

Riddle is a fun riddle / on-site game generator tool that allows your website visitors to engage with your site in an entertaining way. As we all know, everything entertaining has big potential to leave a good impression and is tempting to be shared with others — multiplier effects awaiting! All “riddles” are managed by Riddle, which include dealing with user submitted data and of course analyzing the usage.

Riddle is very integration friendly as well, with plenty of ways to customize your riddles and blend them into your own content.

There is a little catch with Riddle, however — the input/output format is formencoded POST payload. In a world that favors JSON as transport format that is not ideal for integration purposes, but hey — there is a very easy solution.

Why not use serverless functions and combine them with serverless processing flows to not only convert the payload on-the-fly but as well create complex integration flows? Best of all, embracing a low-code approach? Because always remember — a line of code you don’t write is a line of code you don’t have to maintain.

So, the tools of the trade for getting the job done in this little how-to are Azure Functions and Azure Logic Apps.

Logic Apps and Functions work very well together. Coding in NodeJS makes JSON a clear preference, obviously.

The code below requires the module “qs” to work, however that is the only dependency.

You can use this function to pass on the payload “body” property in a LogicApp flow and the function will output nice JSON wich can be perfectly interpreted and evaluated. Without any further coding. It’s really that simple.

module.exports = function (context, req) {if (req.body) {       var debug=false;       var qs = require('qs');       var theBody=req.body; //will be a formencoded POST payload in this case (state of March 2018)       var jSONifiedPayLoad=qs.parse(theBody);        context.res = {                    body: "Done, response: "+JSON.stringify(jSONifiedPayLoad)                   };       context.done();     }   else {       context.res = {           status: 400,           body: "Not a HTTP post. Or whatever."       };       if(debug)context.log('status: '+status);       context.done();   }};

With this kind of Azure Function, you can just plug in a Riddle.com flow easily and create any sort of complex integration flow to your heart’s desire. Your imagination is the only limit.

--

--

Mohammed Brückner
Mohammed Brückner

Written by Mohammed Brückner

Authored "IT is not magic, it's architecture", "The Office Adventure - (...) pen & paper gamebook" & more for fun & learning 👉 https://platformeconomies.com !

No responses yet