How do i integrate KoBoToolbox with my app

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.

-------- Original message --------

From: Chris Clarke chris...@live.co.uk

Date: 5/17/2017 12:20 PM (GMT+02:00)

To: Kobo Users kob...@googlegroups.com

Subject: [KoBo Users] Re: How to integrate Kobo with my app

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

On Monday, May 15, 2017 at 2:22:38 PM UTC+1, Bilal Haidar wrote:

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

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.

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

···

On Wednesday, May 17, 2017 at 11:05:48 AM UTC+1, Bilal Haidar wrote:

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.

-------- Original message --------

From: Chris Clarke chris...@live.co.uk

Date: 5/17/2017 12:20 PM (GMT+02:00)

To: Kobo Users kobo...@googlegroups.com

Subject: [KoBo Users] Re: How to integrate Kobo with my app

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

On Monday, May 15, 2017 at 2:22:38 PM UTC+1, Bilal Haidar wrote:

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

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.

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

···

On Wednesday, May 17, 2017 at 1:37:15 PM UTC+3, Chris Clarke wrote:

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

On Wednesday, May 17, 2017 at 11:05:48 AM UTC+1, Bilal Haidar wrote:

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.

-------- Original message --------

From: Chris Clarke chris...@live.co.uk

Date: 5/17/2017 12:20 PM (GMT+02:00)

To: Kobo Users kobo...@googlegroups.com

Subject: [KoBo Users] Re: How to integrate Kobo with my app

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

On Monday, May 15, 2017 at 2:22:38 PM UTC+1, Bilal Haidar wrote:

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

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.

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

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

···

On Wednesday, May 17, 2017 at 2:00:37 PM UTC+3, Chris Clarke wrote:

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

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

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

···

On Wednesday, May 17, 2017 at 2:36:35 PM UTC+3, Chris Clarke wrote:

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

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!

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

···

On Wednesday, May 17, 2017 at 3:25:03 PM UTC+3, Chris Clarke wrote:

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!

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!

Good to know :slight_smile:

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

···

On Wednesday, May 17, 2017 at 3:43:36 PM UTC+3, Chris Clarke wrote:

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!

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

···

On Wednesday, May 17, 2017 at 4:15:10 PM UTC+3, Bilal Haidar wrote:

Good to know :slight_smile:

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

On Wednesday, May 17, 2017 at 3:43:36 PM UTC+3, Chris Clarke wrote:

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!

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

Hi Bilal,
Are you able to integrate KoBo toolbox with .Net C#? Or how much are you successful in this. Can you please let me know as I am looking to do the same with C# and .Net.

Welcome to the forum, @raheel_marx ! I’d also love to hear about Bilal’s implementation. While we wait, Kobo has fairly robust APIs—what sorts of REST APIs or webhooks/rest services does your C# or .Net application have?

Not knowing exactly what your app does, it’s hard to envision the integration. Could you drop a few lines in here about the business requirement that must be satisfied by the integration? Then, I’m sure folks from the community would be able to help in planning out the integration.

Taylor

1 Like

Thanks @taylordowns2000 for your words. I am looking to integrate api with .net application, so that I can get matadata of fields in KoBo form and create a table for same fields in SQL Server database and after that get all data in json format of any form and dump it to my own SQL server database for further processing. I will do a generic implementation so that it will work for any form.
I was looking into forum and other implementations on github, but did not find anything implemented in .Net C#.

OK, now I understand. Sounds similar to a project we’re planning right now, actually. Using form metadata from Kobo we’re going to automatically generate create table statements and the associated jobs on OpenFn, then using the REST Services from Kobo to post submission data to OpenFn so it’s loaded into the postgres db in real-time. The only difference is that OpenFn is the middleware—leveraging the existing Kobo and SQL adaptors—instead of a custom .Net application.

I’m happy to share our work, pending approval from the client, once it’s complete. If you go the custom .Net way, please let me know how it goes. I’m sure we both (as well as other forum users) would benefit from seeing how we each end up implementing the automated form -> table, submission -> record integration! It’s a very cool requirement :slight_smile:

2 Likes