Skip to main content
App output

App output allows you to define data fields that are returned through the API.

Updated over 4 months ago

The main use case for App output data is for it to be utilized within a mobile app or headless commerce environment to drive different outcomes or content being shown, as HTML is often not required.

App Output data can include:

  • App Fields (Hard coded data)
    For example, if you want to associate a string with the outcome of a Slot rule tree, such as if a person has recently purchased, you could add purchased to a SmartBlock App field.

  • Product data (Product Field Mapping)
    Pull product data into a SmartBlock App field. For example, the price of a product that is being recommended to the visitor.

  • Person or SmartBlock data (App Output Field Mapping)
    Pull personal details into a SmartBlock App field. For example, a person’s name for use in the content.


Create and manage SmartBlock App output

App fields - hard coded data

If you need hard coded data to be outputted using a specified SmartBlock, you can use Create App Fields to set up the fields, and then App Output Field Mapping to output those fields.

To create App Fields within a SmartBlock:

  1. Go to Content > SmartBlocks.

  2. Create or edit a SmartBlock.

  3. Select the App Output tab.
    If you don’t see App Output, expand the More options (three dots) menu.

  4. Select Create App Field.

  5. Enter the following details:

    • Name
      Provide a user-friendly name that describes the purpose of the App field.

    • Key
      Assign an identifier to the App field. This should be unique and not contain any spaces.

    • Type
      Expand the Type drop-down menu and select the field type: Text, Number or Date.

    • Value
      Enter the static output that should be given for this field.

  6. Select CREATE.

App output field mapping

To make the App Fields, SmartBlock, or Person data output in your code, you need to set up a mapping to determine the output.

To set up the mapping:

  1. Expand the User menu and go to Settings > Exports.

  2. Select App Output Field Mappings.

  3. Select CREATE FIELD MAPPING.

  4. Expand the Field Name drop-down menu and select app_fields.

  5. For Element in Field, enter the Key from your App field.

  6. Enter the Output Fieldname that matches the name in your headless or app environment.
    This is what you want it to be called in the output code.

  7. Add any other App fields or person fields that you want included in your App output by selecting from the drop-down menu and assigning the relevant output fieldname.

  8. Select SAVE.

  9. Go back to your SmartBlock, and select the App Output tab.

  10. Expand the associated drop-down menu and select the App Output Field Mapping.

Product fields mapping - outputting product data

To make product data, for example, product name, description, or price output in the code, you need to set up a mapping to determine the output.

  1. Expand the User menu and go to Settings > Exports.

  2. Select Product Fields Field Mapping.

  3. Select CREATE FIELD MAPPING.

  4. Expand the Field Name drop-down menu and select the data that you want to include in the App Out and define the Output Name.

  5. Add all product details you want to include to the mapping.

  6. Select SAVE.

  7. Go back to your SmartBlock, and select the App Output tab.

  8. Expand the associated drop-down menu and select the Product Fields Field Mapping.

HTML output

By default, HTML output of SmartBlocks is enabled. If you want to turn it off, select the Enable HTML toggle at the bottom of the App Output tab.

App output preview

When configuring an App output in a SmartBlock, a new Preview panel appears on the right. Select the App Output tab to view the JSON that is returned for that SmartBlock, and see the output of any App fields or mappings that you add.

Did this answer your question?