> ## Documentation Index
> Fetch the complete documentation index at: https://docs.kibocommerce.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Contentstack Integration

The Kibo Commerce extension with Contentstack lets you search and fetch products from your Kibo catalog and display them on your entry page via a custom field. This step-by-step guide explains how to create the custom field extension for your [content types](https://www.contentstack.com/docs/developers/create-content-types/about-content-types/). For more information on Contentstack, see their [website](https://app.contentstack.com/) and [developer portal](https://www.contentstack.com/docs/developers/).

<img src="https://mintcdn.com/kibocommerce-59e68a4a/J4w9KvWH3YVo4Mms/img/1669917734400.png?fit=max&auto=format&n=J4w9KvWH3YVo4Mms&q=85&s=7ba956599f651375bc773f2f90d40bb3" alt="The Contentstack logo" width="384" height="127" data-path="img/1669917734400.png" />

## Prerequisites

You must have the following accounts:

* Kibo Commerce Account
* Contentstack Account

## Install the App

For installation instructions, email the Contentstack support team and request access to the Kibo Commerce Contentstack integration source code.

## Configure the Integration

The following sections of this guide will walk through the different steps that must be performed to create a Kibo Commerce custom field extension:

1. Retrieve your Kibo Commerce App API credentials.
2. Add the Kibo Commerce custom field extension to your account.
3. Use the custom field.
4. Add products in the custom field.

### Retrieve API Credentials

To obtain your Kibo API credentials:

1. Log in to your Kibo Commerce [Dev Center](http://developer.mozu.com/login).
2. Click **Develop** > **Applications**.<img src="https://mintcdn.com/kibocommerce-59e68a4a/WyMwcFixo9GjoZe3/img/dev-console.png?fit=max&auto=format&n=WyMwcFixo9GjoZe3&q=85&s=50c028c6fb4c26f4563b9366755757eb" alt="Navigation for &#x22;Applications&#x22; from Dev Center screen" width="579" height="138" data-path="img/dev-console.png" />
3. Select an existing application or create an application for your sandbox or production environment.
4. Click **Create Application** on the top right corner. <img src="https://mintcdn.com/kibocommerce-59e68a4a/WyMwcFixo9GjoZe3/img/create-application.png?fit=max&auto=format&n=WyMwcFixo9GjoZe3&q=85&s=b67be52e0402ffad49e022a3c80e746d" alt="Applications page with &#x22;Create Application&#x22; button at top right corner" width="1290" height="216" data-path="img/create-application.png" />
5. Enter a **Name** and **Application ID**.<img src="https://mintcdn.com/kibocommerce-59e68a4a/WyMwcFixo9GjoZe3/img/create-application-modal.png?fit=max&auto=format&n=WyMwcFixo9GjoZe3&q=85&s=0be86b49f3b3477f7e2cee8456c161b4" alt="Create Application modal with the required fields and &#x22;Save&#x22; button at bottom" width="490" height="345" data-path="img/create-application-modal.png" />
6. Click **Save**.
7. Copy the **Application ID** and **Shared Secret** to use later in your application.<img src="https://mintcdn.com/kibocommerce-59e68a4a/WyMwcFixo9GjoZe3/img/application-key.png?fit=max&auto=format&n=WyMwcFixo9GjoZe3&q=85&s=10f2894dfaabc1798fdcd75f7e78c64c" alt="Application ID and Shared Secret details on Application page" width="1889" height="161" data-path="img/application-key.png" />

### Add the Custom Field Extension

The root folder of the source code that you get from the support team contains a redirect HTML file.

1. Upload this file as an asset in Contentstack by following steps mentioned in the [Create/Upload](https://www.contentstack.com/docs/content-managers/working-with-assets/create-upload-assets/) asset article.
2. After uploading the file, you'll get a URL in the [asset details](https://www.contentstack.com/docs/content-managers/working-with-assets/create-upload-assets/#asset-details) section, make note of this URL.

To add the extension to your stack:

1. Log in to your Contentstack account.
2. Click the **Settings** icon on the left navigation panel.
3. Select **Extensions**.
4. Click **+ New Extension** in the top right, then **Create New**.<img src="https://mintcdn.com/kibocommerce-59e68a4a/1Nyrd7MBmKOhtK96/img/new-extension.png?fit=max&auto=format&n=1Nyrd7MBmKOhtK96&q=85&s=e0eb9c7e5e730114e261e7898cefb7e5" alt="Contentstack homepage with navigation for adding &#x22;New Extension&#x22;" width="1919" height="876" data-path="img/new-extension.png" />
5. In the **Select Extension Type** window, select **Custom Field**. <img src="https://mintcdn.com/kibocommerce-59e68a4a/WyMwcFixo9GjoZe3/img/custom-field.png?fit=max&auto=format&n=WyMwcFixo9GjoZe3&q=85&s=1ec8a4c8b65e2b404debc854d72c2857" alt="&#x22;Select Extension Type&#x22; window with highlighting &#x22;Custom Field&#x22; option " width="1387" height="509" data-path="img/custom-field.png" />
6. On the Create New Extension page, enter the following values.
   * **Title** (Required): Enter a title such as “Kibo Commerce” for your custom field.
   * **Field Data Type** (Required): Select "JSON" as the data type in which the field input will be saved in Contentstack.
   * **Multiple** (Optional): Leave this field unchecked.
   * **Hosting Method** (Required): Select "Hosted by Contentstack" for this content type.
   * **Extension Source Code:** Specify the extension code here. Copy the source code from the index.html file located in the root folder that you get from our Support team and paste it into the Extension source code field.<img src="https://mintcdn.com/kibocommerce-59e68a4a/1Nyrd7MBmKOhtK96/img/untitled-page.png?fit=max&auto=format&n=1Nyrd7MBmKOhtK96&q=85&s=b30f0163cddcd78edea15f56a26a34e5" alt="Create New Extension page with required fields and &#x22;Save&#x22; button at the bottom " width="916" height="799" data-path="img/untitled-page.png" />
7. Set up the **Configuration Parameter** such as in the below example:
   ```
   {
     "apiHost": "https://t1234.sandbox.mozu.com", 
     "authHost": "https://t1234.sandbox.mozu.com", 
     "applicationId": "kibo.example-app-name.1.0.0.Release", 
     "sharedSecret": "12345_Secret",
     "type": "product_multiple",
     "pageCount": "10",
     "redirectUrl": "https://assets.contentstack.io/v3/assets/123/123/123/redirect.html"
   }
   ```
   These parameters are:
   * **apiHost**\*\*:\*\* Host of your Kibo API environment.
   * **authHost:** Host for Kibo API authentication, either a production ([https://t00000.tp0.mozu.com](https://t00000.tp0.mozu.com)) or sandbox ([https://t00000.sandbox.mozu.com](https://t00000.sandbox.mozu.com)) environment. Replace the numeric placeholders with your Tenant ID and production pod.
   * **applicationId:** The Application ID [found in your Developer Console](/pages/getting-started#view-application-credentials "Getting Started").
   * **sharedSecret:** The Application Secret [found in your Developer Console](/pages/getting-started#view-application-credentials "Getting Started").
   * **type:** The Kibo Data Object being fetched (which should be a product).
   * **pageCount:** The number of items that the API will return for each page of your query (default is 10).
   * **redirectUrl:** The URL to redirect.
8. Click **Save**.

### Use the Custom Field

Once you have added a custom field, you can use it in your content type.

1. Click the **Content Models** icon on the left navigation panel.
2. Click **+ New Content Type** in the top right.<img src="https://mintcdn.com/kibocommerce-59e68a4a/WyMwcFixo9GjoZe3/img/content-models.png?fit=max&auto=format&n=WyMwcFixo9GjoZe3&q=85&s=314a3ac3b8a6867c9416b0bbff1faca0" alt="Contentstack homepage with navigation for adding &#x22;New Content Type&#x22;" width="1918" height="676" data-path="img/content-models.png" />
3. Enter a **Name**, **UID**, and then click **Save and proceed**.<img src="https://mintcdn.com/kibocommerce-59e68a4a/WyMwcFixo9GjoZe3/img/content-type-modal.png?fit=max&auto=format&n=WyMwcFixo9GjoZe3&q=85&s=3eacf10fae36e24a1c39c520be4b5156" alt="“Create New Content Type” modal with required fields and “Save and Proceed” button at the bottom" width="710" height="537" data-path="img/content-type-modal.png" />
4. Click **Insert a field** link (the **+** sign) and add the **Custom** field to it.<img src="https://mintcdn.com/kibocommerce-59e68a4a/WyMwcFixo9GjoZe3/img/insert-field.png?fit=max&auto=format&n=WyMwcFixo9GjoZe3&q=85&s=8cc18372bbd596235620eae61e5e29d6" alt="Insert a field link displays with plus sign" width="1199" height="281" data-path="img/insert-field.png" /><img src="https://mintcdn.com/kibocommerce-59e68a4a/WyMwcFixo9GjoZe3/img/custom.png?fit=max&auto=format&n=WyMwcFixo9GjoZe3&q=85&s=0c0a3aaddc299e62e70e88d379cf6d3f" alt="A modal with various fields highlighting Custom field" width="1056" height="567" data-path="img/custom.png" />
5. Click **Select Extension/App** from the drop-down menu in Basic properties.
6. Check the KiboCommerce extension field that you created and click **Proceed**.<img src="https://mintcdn.com/kibocommerce-59e68a4a/1Nyrd7MBmKOhtK96/img/select-extenstion-modal.png?fit=max&auto=format&n=1Nyrd7MBmKOhtK96&q=85&s=befd1b6c855246f17f8443603d59f45c" alt="Select Extension or App page with added extension list to choose and &#x22;Proceed&#x22; button at bottom" width="1109" height="560" data-path="img/select-extenstion-modal.png" />
7. Click **Save and Close.<img src="https://mintcdn.com/kibocommerce-59e68a4a/WyMwcFixo9GjoZe3/img/create-custom.png?fit=max&auto=format&n=WyMwcFixo9GjoZe3&q=85&s=9b4f42618cc162fcd1e5648ea2688dfa" alt="Custom field page with &#x22;Select Extension/App&#x22; drop-down and &#x22;Save and Close&#x22; button at bottom" width="1450" height="784" data-path="img/create-custom.png" />**
8. Create an entry for this content type and you will see the **Kibo Commerce** custom field.

### Add Products in the Custom Field

To add products to the custom field:

1. Click the **Entities** icon on the left navigation panel.
2. Click **All Entries** and then **+ New Entry** in the top right.<img src="https://mintcdn.com/kibocommerce-59e68a4a/1Nyrd7MBmKOhtK96/img/new-entry.png?fit=max&auto=format&n=1Nyrd7MBmKOhtK96&q=85&s=378c8399cdbee8a4a6ec0a97dfb96d1f" alt="Contentstack homepage with navigation for adding &#x22;New Entry&#x22;" width="1917" height="699" data-path="img/new-entry.png" />
3. Select the custom field and click **Proceed**.<img src="https://mintcdn.com/kibocommerce-59e68a4a/1Nyrd7MBmKOhtK96/img/select-content-type-modal.png?fit=max&auto=format&n=1Nyrd7MBmKOhtK96&q=85&s=0666695038344ece94baa3838ecf3adc" alt="List of added &#x22;Content Type&#x22; with &#x22;Proceed&#x22; button at bottom" width="1110" height="563" data-path="img/select-content-type-modal.png" />
4. Select the corresponding **Add Products** to either add single or multiple products.<img src="https://mintcdn.com/kibocommerce-59e68a4a/J4w9KvWH3YVo4Mms/img/add-product-page.png?fit=max&auto=format&n=J4w9KvWH3YVo4Mms&q=85&s=08999a75168d7068a9be14990ac23269" alt="Add Products buttons for single and multiple products adding with &#x22;Save&#x22; and &#x22;Publish&#x22; button at bottom" width="919" height="794" data-path="img/add-product-page.png" />
5. Click **Add Products** to go to the KiboCommerce Extension window.
6. Use the search bar at the top to search for the product of your choice.
7. Select one or more products and click **Add Product(s)**.<img src="https://mintcdn.com/kibocommerce-59e68a4a/1Nyrd7MBmKOhtK96/img/products.png?fit=max&auto=format&n=1Nyrd7MBmKOhtK96&q=85&s=fa293e23d4b1d79f44e4b4cc087b814c" alt="Add Product page with added product list and &#x22;Add 1 Product(s)&#x22; button at bottom" width="1908" height="1010" data-path="img/products.png" />
8. Click **Save**.<img src="https://mintcdn.com/kibocommerce-59e68a4a/1Nyrd7MBmKOhtK96/img/products-save.png?fit=max&auto=format&n=1Nyrd7MBmKOhtK96&q=85&s=a3bb97ce31298c6798b52df396f66bea" alt="Add Product page with added product list and &#x22;Add 1 Product(s)&#x22; button at bottom" width="1917" height="844" data-path="img/products-save.png" />
