How to integrate Kobo with my app

890 views
Skip to first unread message

Bilal Haidar

unread,
May 15, 2017, 9:22:38 AM5/15/17
to Kobo Users
Hi,
I am developing an app for an NGO that uses KoboToolbox to create and submit surveys.

Now I need to integrate with Kobo in this new app. My questions to you are the following:

1- Can I host the form designer of Kobo inside my app to allow users to create new forms or edit existing?

2- If a form is hosted in Kobo, can I retrieve data submitted into my app? I am using ASP.NET MVC 5 as a backend.

Thank you
Bilal

Chris Clarke

unread,
May 17, 2017, 5:20:57 AM5/17/17
to Kobo Users

Hi Bilal,

I've done similar in a html5 (javascript) app, addressing (1) using an enketo iframe and (2) get requests to pull back in the data. Would that work for you? Here's a small demo version of some of the app functionality:
https://play.google.com/store/apps/details?id=com.stats4sd.dataloopsdemo&hl=en

Chris

bhaidar

unread,
May 17, 2017, 6:05:48 AM5/17/17
to Chris Clarke, Kobo Users
Chris wow that's amazing!!

I'm very new to Enketo and KoboToolbox.

Can you please guide me on how to start? 

This is exactly what I need.

Design forms in kobo, be able to open forms in my Web App,  then submit form and finally retrieve results.

I really appreciate your help.

Regards
Bilal 


 
Sent from my Samsung Galaxy smartphone.
--
You received this message because you are subscribed to a topic in the Google Groups "Kobo Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/kobo-users/CvkQrSYZH1k/unsubscribe.
To unsubscribe from this group and all its topics, send an email to kobo-users+...@googlegroups.com.
To post to this group, send email to kobo-...@googlegroups.com.
Visit this group at https://groups.google.com/group/kobo-users.
For more options, visit https://groups.google.com/d/optout.

Chris Clarke

unread,
May 17, 2017, 6:37:15 AM5/17/17
to Kobo Users
I'm not sure exactly where the best place to start is as I've not used asp.net however I imagine a quick search should show up ways to embed an iframe and how to use GET requests (sometimes called http requests). Opening any form in enketo online from the kobo dashboard should give the url you need, and documentation on the Kobo api is here: https://kc.kobotoolbox.org/api/v1/

The code I used is also openly available on github here: https://github.com/stats4sd/Data-Loops-Demo, however I'm not sure how useful it will be if you are using a different platform.

Chris

Bilal Haidar

unread,
May 17, 2017, 6:50:36 AM5/17/17
to Kobo Users
Thanks a lot Chris!

So you don't need to deploy Enketo on your servers? 

If I understood well, someone would create a new account with Kobo. Then design a form. Then open the mobile app, using APIs I can get list of forms designed on Kobo. I can then open the form inside the mobile app, fill it and then view results?

Using API I can get list of forms, how about viewing the form? Is it also a service by Kobo that you can use to open a form inside a mobile or even Web app?

Thanks a lot
Bilal

Chris Clarke

unread,
May 17, 2017, 7:00:37 AM5/17/17
to kobo-...@googlegroups.com

If you want to use your own server you will have greater flexibility if you need to create custom functionality and I would also recommend if you foresee usage requirements getting quite large (hundreds of requests per day), however for initial development and testing I think you can rely on kobo’s own hosted solution.

 

Yes you have understood as intended. if you already know the forms you are using you could also hardcode the urls in (what you see when you open the form in web input mode).  This url can be loaded in an iframe to view, alternatively if wanting to load dynamically the /forms api endpoint has a request to get the webform/enketo link which could then be loaded. The service that opens these is called ‘enketo’ https://enketo.org/, and is a service that integrates with kobo. You can run your own enketo server, or again the hosted solution has an existing enketo integration.

 

Chris

Bilal Haidar

unread,
May 17, 2017, 7:18:47 AM5/17/17
to Kobo Users
Thanks a lot for the wonderful explanation!

I will be reading on for sure more. But still one question, when you say enketo link or enketo service, how is that integrated with Kobo? Or in other words, what kobo offers and what enketo offers?

Also, I realized the setup of Enketo server is a bit involved. But does that mean when I deploy my own server of Enketo, I can connect Kobo to it?

Thanks

Chris Clarke

unread,
May 17, 2017, 7:36:35 AM5/17/17
to kobo-...@googlegroups.com

Ah yes, I can see how that might be confusing. Essentially both tools stem from the same base of standardized, open-source survey form format (OpenRosa), but have taken different approaches to how they display and interact with the forms. Kobo is specialised for mobile collection via android, and enketo specialises in web collection via browser. They have many areas of commonality (including development team), and have been made to work together to provide option to collect data both in a browser and mobile app. Things get a bit more confusing in the case we’ve been discussing as we’re using the enketo web browser on a mobile phone to replace some of the kobo functionality, but still relying on the rest of the kobo system for aggregating and storing data etc. (enketo requires another service such as kobo for this). You can read a bit more here: https://enketo.org/openrosa/ . Of note is the section at the bottom which explains some of the key differences in specific question types which can and cannot be displayed in both platforms.

 

Hope that helps,

 

Chris

Bilal Haidar

unread,
May 17, 2017, 8:11:22 AM5/17/17
to Kobo Users
So basically, do I need to interact with Enketo at any moment? Is it the case I design a form with Kobo, then using Kobo services I load the form in my Web app or iframe on mobile? What's the role of Enketo here? 

I read the link you sent me, there are many players like ODK, Enketo, Ona, Kobo and others. I know now they all follow a standard in forms which is xForms and XlsForms. But are they different providers? For instance, with ODK can you build forms, load it, fill it and retrieve results? Do the rest also offer such thing? Like can I use Enketo alone to build and fill forms? 

I am sorry for the many questions, but I am starting from now where.

Thanks again
Bilal

Chris Clarke

unread,
May 17, 2017, 8:25:03 AM5/17/17
to kobo-...@googlegroups.com

You do not need to interact directly with enketo as kobo can handle this for you (it does this automatically every time you click to preview your form online in the web browser, or collet data via web). ONA is very similar to Kobo (as I understand they both were created from the same original project, however have since split to add different functionality). They both also do many of the same things as ODK aggregate, however in my opinion have improved on the core functionality in almost every way. Kobo remains completely open source and free, whilst ONA has since limited it’s free offering and provides subscription services.  They are both completely inter-compatible and allow data moved from one platform to the other (including the odk aggregate platform).

 

I would suggest you start experimenting and see how you get on, all the platforms mentioned also typically have excellent support forums and guides to get you up and running. Don’t worry about it, we all started somewhere!

Bilal Haidar

unread,
May 17, 2017, 8:31:20 AM5/17/17
to Kobo Users
Thanks a lot Chris. Yes, I will start on Kobo and follow your app at least to get the first steps in learning how to use it.

I noticed you are an expert in Ionic, do you recommend it for apps on mobile given knowledge in JavaScript? 

Thanks

Chris Clarke

unread,
May 17, 2017, 8:43:36 AM5/17/17
to kobo-...@googlegroups.com

I really like Ionic and it is definitely one of the more popular, but as most things it depends on what you’re trying to achieve. There are other frameworks which are much easier to use (e.g. drag and drop style creators) which can be great for simple use cases but may be prohibitive in the longer term. Ionic is built on top of angularJS, which is an MVC framework where the rendering is done client-side (compared to ASP.net which I believe is more server-side?). This could lead to slower rendering and compatibility on older devices, however in my experience (usually working in low-resource environments) this hasn’t proven overly problematic. I’ve always been quite a fan of anything javascript as it seems to go pretty much anywhere you want it to and save me having to become an expert in too many different languages!

Bilal Haidar

unread,
May 17, 2017, 9:15:10 AM5/17/17
to Kobo Users
Good to know :-)

I am an ASP.NET developer but also work with Angular, node and javascript. 

I am going to give it a try as I need to work on mobile apps (not complicated nor fancy ones).

Also, I am making a move towards node js to replace asp.net. Javascript is amazing.

Thanks a lot for the information, I really appreciated.

Regards
Bilal

Bilal Haidar

unread,
May 17, 2017, 10:36:08 AM5/17/17
to Kobo Users
Hi Chris,
I am going through your code and noticed this line:

>> return this.http.post('http://kobo-api.stats4sd.org', body, options)

What's the story about proxy site? 

Thanks

Chris Clarke

unread,
May 17, 2017, 10:41:28 AM5/17/17
to kobo-...@googlegroups.com

Ah, interesting issue regarding cross origin requests and internet security. https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS

Basically when running on an app there’s more freedom to send certain types of request and the app can communicate directly, however when testing in your own web browser things are stricter so I’m proxying requests via another server.

 

As this is no longer very relevant to kobo I suggest you either contact me direct (c.cl...@stats4sd.org) with any follow-up or post on github.

 

Chris

Reply all
Reply to author
Forward
0 new messages