Skip to main content

How to Create a Custom Watch Survey

In Cozie, it is possible to create a custom watch survey. The watch survey is defined in a JSON file. An example is shown below.

Create a JSON file

Create a JSON file. A JSON file is just a text file with the file extension.json. Below is a minimal example of a watch survey with one question and one response option. A longer example of a working watch survey is available at the bottom of this page.

Minimal example
{
"survey_name": "Example Survey",
"survey_id": "example_survey",
"survey": [{
"question": "How would you prefer to be?",
"question_id": "q_thermal",
"response_options": [{
"text": "Cooler",
"icon": "snowflake",
"icon_background_color": "#F1A62E",
"use_sf_symbols": false,
"sf_symbols_color": "#000000",
"next_question_id": ""
}
]
},
]
}

The table below explains the field names from the example above.

KeyDescriptionExample value
survey_nameName of watch survey that is shown in the 'Settings' tab of the Cozie iPhone appThermal (short)
survey_idSurvey IDthermal_short
surveyArray with questions-
questionQuestion that is shown in the watch survey on the Apple WatchHow would you prefer to be?
question_idThe question ID is used as a column name in the database. It has to have the prefix q_q_preference_thermal
response_optionsArray of response options objects-
textResponse text that is shown in the watch survey on the Apple Watch and text that is stored in the database.Cooler
iconFilename or SF symbol name of icon that is shown on the left-hand side of the response option textsnow_flake
icon_background_colorBackground color that is shown for image-based icons and SF Symbol based icons#F1A62E
use_sf_symbolsBoolean that indicates whether the value specified in icon is a filename or an SF symbol namefalse
sf_symbols_colorForeground color that is shown for SF symbols#000000
next_question_idQuestion ID of the next question that is shown if this response option is selected. If the watch survey should end after selecting this response option, then the next question_id is an empty string.q_location

The watch survey JSON file needs to be made available online. It cannot be uploaded into the app as a file. The most convenient way of hosting the watch survey JSON file is on GitHub.

  1. Create the public repository on Github

  2. Add the watch survey JSON file to the repository.

  3. Go to the raw version of the file.

    Screenshot of watch survey file on Github  
  4. Copy the URL from the raw file.

    Screenshot of raw watch survey file on Github  
  5. Use this URL as a link to the watch survey JSON file in the next section.

How to load the watch survey into the Cozie app

  1. Open to the Cozie app and go to the Backend tab.

  2. Add the URL to the watch survey file in the input field labeled Watch Survey Link Link to example survey)

    Screenshot backend watch survey configuration  
  3. Press the sync button in the Backend tab. The watch survey should now be available to select in the Settings tab.

  4. Go to the Settings tab and select your watch survey. The watch survey defined in the JSON file provided with the link above should be listed in the pop-up list. Select it.

  5. Sync the settings with the Apple Watch while the Cozie app is open on the Apple Watch, just like described in the Setup guide.

Example of JSON file for a custom watch survey

example_survey.json
{
"survey_name": "Example Survey",
"survey_id": "example_survey",
"survey": [{
"question": "How would you prefer to be?",
"question_id": "q_thermal",
"response_options": [{
"text": "Cooler",
"icon": "snowflake",
"icon_background_color": "#F1A62E",
"use_sf_symbols": false,
"sf_symbols_color": "#000000",
"next_question_id": "q_location"
},
{
"text": "No Change",
"icon": "emoticon_happy",
"icon_background_color": "#F1A62E",
"use_sf_symbols": false,
"sf_symbols_color": "#000000",
"next_question_id": "q_location"
},
{
"text": "Warmer",
"icon": "flame.fill",
"icon_background_color": "#F1A62E",
"use_sf_symbols": true,
"sf_symbols_color": "#FF0000",
"next_question_id": "q_location"
}
]
},
{
"question": "Where are you?",
"question_id": "q_location",
"response_options": [{
"text": "Outdoor",
"icon": "person_walking",
"icon_background_color": "#F1A62E",
"use_sf_symbols": false,
"sf_symbols_color": "#000000",
"next_question_id": "q_clothing"
},
{
"text": "Indoor",
"icon": "indoor",
"icon_background_color": "#F1A62E",
"use_sf_symbols": false,
"sf_symbols_color": "#000000",
"next_question_id": "q_clothing"
}
]
},
{
"question": "What clothes are you wearing?",
"question_id": "q_clothing",
"response_options": [{
"text": "Very light",
"icon": "clothes_shirt_sleeveless",
"icon_background_color": "#F1A62E",
"use_sf_symbols": false,
"sf_symbols_color": "#000000",
"next_question_id": ""
},
{
"text": "Light",
"icon": "clothes_shirt_short",
"icon_background_color": "#F1A62E",
"use_sf_symbols": false,
"sf_symbols_color": "#000000",
"next_question_id": ""
},
{
"text": "Medium",
"icon": "clothes_shirt_pants",
"icon_background_color": "#F1A62E",
"use_sf_symbols": false,
"sf_symbols_color": "#000000",
"next_question_id": ""
},
{
"text": "Heavy",
"icon": "clothes_pullover",
"icon_background_color": "#F1A62E",
"use_sf_symbols": false,
"sf_symbols_color": "#000000",
"next_question_id": ""
}
]
}
]
}