Send a survey with finer control (optional questions, page breaks)

Kaizala API for survey creation now allows you to have finer control on how the survey is displayed as well as making questions optional (which was not possible earlier). In this post, I will demonstrate the options with an example.

In case you are new to Kaizala / Kaizala APIs, please read the post for getting started with Kaizala APIs.

Scenario for demonstration

For the demo, the scenario would be a survey with a single optional question on first page, two questions on the second page and fourth question on the last page.

Survey request body

The survey request body would be similar to the one that we have always been using – with an additional parameter ConfigData in the question, that allows configuring the question.

The configurations we will be covering in this post are:

  • AddPageBreak
  • Source – for image questions only
  • FilterMode – for image questions only

In addition to the question configurations, the question itself can take a property IsOptional to determine if the question is mandatory / optional.

Fig 1 – Sample survey body

IsOptional

As intuitive as it is, the boolean flag serves to make the question either mandatory / optional. When not specified, the default is true.

ConfigData

There are a bunch of configurations for adding page break and selecting source and filters for images

AddPageBreak

This flag decides whether there should be a page break after the question. When not specified, the value defaults to true.

Source

This flag is for Image type question and specifies if the image should be from camera / should allow picking from gallery too. You could use CameraBack or CameraFront to use images from camera and All to allow picking from gallery and camera.

FilterMode

The filter mode flag allows you to set the default filter mode the camera should be launched in. The filters are WhiteBoard, BusinessCard, Document, Photo.

Closing notes

Below is what the survey created with the sample body looks like. Feel free to reach out with your questions / comments. If you want to receive email notifications on new posts, please subscribe below.

Screens from the demo

One thought on “Send a survey with finer control (optional questions, page breaks)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s