Recording booking questions when creating a new booking

Recording booking questions when creating a new booking via the Appointedd API.

When you create a new booking for a customer in Appointedd you can record one or more "booking questions" for that booking. This allows you to gather additional details from your customers when they make a booking such as what dietary preferences they have or if they accept your terms an conditions.

To use booking questions you'll first need to set them up on your Appointedd organisation which you can do by following our support guide on How to create questions to be asked when bookings are made (including T&C's) which covers how to do this.

Once you have this setup you can then specify the booking questions in your payload when you make a request via our API to create a new booking. Here's an example request that sets four custom questions (using a reservation slot that you previously created, see the previous guide on Creating a new booking for how to do this):

const axios = require("axios").default;

const options = {
  method: 'POST',
  url: 'https://api.appointedd.com/v1/bookings',
  headers: {Accept: 'application/json', 'Content-Type': 'application/json'},
  data: {
    data: {
      customers: [
        {
          customer: {
            profile: {firstname: 'Ada', lastname: 'Lovelace', email: '[email protected]'},
            marketing_subscribed: false
          },
          questions: [
            {
              type: 'text',
              label: 'Do you have any dietry preferences?',
              value: 'I am vegan'
            },
            {type: 'checkbox', label: 'Are you over 18?', value: 'true'},
            {type: 'dropdown', label: 'What kind of pet do you have?', value: 'Cats'},
            {type: 'terms', label: 'Do you accept our terms & conditions?', value: 'true'}
          ],
        }
      ]
    },
    slot_id: '<SLOT_ID>'
  }
};

axios.request(options).then(function (response) {
  console.log(response.data);
}).catch(function (error) {
  console.error(error);
});

Here you'll see that we are answering 4 different questions, one for each of the types of booking questions that we support in Appointedd. To map a question in your request to a question setup in your organisation the label property of your question must match the text you set in the Question field when you set up the question in your Appointedd organisation. Additionally here's a breakdown of each question and their type and value properties:

Text Questions

  • The type property must be set to text.
  • The value property can be any free-form text.

Checkbox Question

  • The type property must be set to checkbox.
  • The value property must be a string that is either "true" if the checkbox was checked by the customer and "false" if it wasn't.

Dropdown Question

  • The type property must be set to dropdown.
  • The value property must be a string that matches one of the options that you configured in your organisation when you set it up.

Terms & Conditions Question

  • The type property must be set to terms.
  • The value property must be a string that is either "true" if the terms were accepted by the customer and "false" if it wasn't.