# Internal Data JSON Methods

### Objectives <a href="#toc90240811" id="toc90240811"></a>

This guide will help you to quickly use JSON data files (.json) as a data source in iX Hello.

### Pre-requisites <a href="#toc90240811" id="toc90240811"></a>

1. **An iX Hello account**

For steps to create an iX Hello account, follow the steps [here](/ixhc/general/ix-hello-create-account-original.md)

2. **A valid JSON data file**

You will need a valid JSON file containing some data. If you do not have this, you can also create a new one with the sample data provided below. Open Notepad, paste the following sample data, and save the file as **Sample.json**:

```
{
   "Contacts": [
      {
         "name": "Martin",
         "contactnumber": "0123456789",
         "country": "US"
      },
      {
         "name": "Bob",
         "contactnumber": "1230456789",
         "country": "US"
      },
     {
         "name": "James",
         "contactnumber": "1230456789",
         "country": "Canada"
     }
  ]
}
```

These instructions will use this sample data.

### Steps <a href="#toc90240812" id="toc90240812"></a>

To proceed with these steps, you will need Studio Mode access in iX Hello.&#x20;

### Step 1 Create content from JSON file <a href="#toc54887585" id="toc54887585"></a>

1. Log-in to the iX Hello portal at <https://bots.ixhello.com>
2. Open Studio Mode.
3. From the left menu, Navigate to the **Content** > **Content**. You should see a page with a list of contents (if any) and a button to add a new content as shown in below screenshot.

<figure><img src="/files/1g4m2A4Ra7uVHyroGpvA" alt=""><figcaption></figcaption></figure>

3. Create new content by clicking on **ADD NEW CONTENT**. Once clicked, you should see a screen to provide new content details. Fill in a Content ID, Content Name, Category, and Text.

<figure><img src="/files/YbaCP6x1Co96kD7npSoi" alt=""><figcaption></figcaption></figure>

4. Scroll down and select **Media Or Data**. This will open up some more fields. Set the Media Type to **JSON**. To load the sample JSON file, select **Upload File**, click on **Choose File**, and browse to the Sample.json file created earlier. When finished, press **Add**.

<figure><img src="/files/Mt6Kix5dOgg24ZEivNuB" alt=""><figcaption></figcaption></figure>

The file you use must be a valid JSON file with JSON contents else the platform will not allow you to upload it.

5. Once uploaded, you should see a success notification and added contents as shown below.

<div align="left"><figure><img src="/files/WsKZCHGXgh0uO5q3W2Do" alt=""><figcaption></figcaption></figure></div>

### Step 2 Create a new connection for the Internal Data <a href="#toc90240814" id="toc90240814"></a>

1. From the left menu, navigate to the **Integration** > **Connect System**. You should see a list of all the connections that you have already created.
2. To create a new connection, click on **Add New Connection.**

<figure><img src="/files/6EnYLRzakjtrQjYlwUtt" alt=""><figcaption></figcaption></figure>

3. On the popup, choose **Internal Content** as Connection and name the System Instance. Press **Next**.

<figure><img src="/files/fwrhmIK73AE6nGraGHHB" alt=""><figcaption></figcaption></figure>

4. You should see a newly created connection as shown in below screenshot.

<figure><img src="/files/wlEyoIqqgxlzFtxVXLiA" alt=""><figcaption></figcaption></figure>

Now the connection is ready to use with the app.

### Step 3 Create an App to utilize internal data <a href="#toc90240815" id="toc90240815"></a>

1. To create an app, browse to **Apps** > **Custom Apps** and click **New Custom App**

<figure><img src="/files/WxBZk9fgd5kBOylN3NA6" alt=""><figcaption></figcaption></figure>

2. A small screen pops up. Populate the fields and press **Save**.

<div align="center"><figure><img src="/files/61EvMNUqakrlYsObeyVo" alt="" width="375"><figcaption></figcaption></figure></div>

| Input                    | Information                                                                                                                                                                                           |
| ------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Name                     | You can give any value of your choice.                                                                                                                                                                |
| Custom App Type          | Select Search                                                                                                                                                                                         |
| Category                 | <p>Please use the same category that you have used for the Internal Data.</p><p><strong>Note:</strong> If category do not match then methods in this app may not be able to access the JSON data.</p> |
| Make this app as shared… | Select this if you want to share this app with other users in your organization.                                                                                                                      |

### Step 4 Create a Data Source <a href="#toc90240816" id="toc90240816"></a>

A Data Source connects the app with the integration.&#x20;

1. Once you have an App created, open the **Data Sources** tab and press **Create New Data Source**.

<figure><img src="/files/Ei5hoSDZIgISzGXBQ24M" alt=""><figcaption></figcaption></figure>

2. In the screen that opens, give it a name and choose **Internal Content: My Contacts**.

<figure><img src="/files/pjzhT0YVJMuUYJuYGHS2" alt=""><figcaption></figcaption></figure>

3. If you want to make this connection as private to you, select the available option “Consider as a Personalized Data Source”. If selected, other users in your organization will not be able to use it.
4. Click on **Save**. Once a data source is created, you are ready to start creating various methods and use JSON Data.

### Step 5 Create Methods <a href="#toc90240817" id="toc90240817"></a>

By using Methods, you will be able to access JSON data as well as add new data to the same JSON.&#x20;

1. To access Methods, click on the **Methods** tab.

<figure><img src="/files/rMDyeNyEIF3JCKwR4tfQ" alt=""><figcaption></figcaption></figure>

As of the publication date of this document, iX Hello supports following methods for JSON Data:

1. GetJSONContents
2. AddRecord
3. AddRecordToNode

### Method: GetJSONContents <a href="#toc46439382" id="toc46439382"></a>

You can use this method to pull the contents of your JSON file. The method requires just one parameter as explained below.

Parameters:

| Parameter | Sample Value | Info                                                                                      |
| --------- | ------------ | ----------------------------------------------------------------------------------------- |
| ContentID | Contacts01   | This parameter is used to uniquely identify the content (JSON file) used in Internal Data |

Other than these two parameters, you need to provide following standard inputs

| Parameter       | Info                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| --------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Method Name     | You can give any name. This name will be displayed in the methods list.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| Request Type    | <p><strong>GetJSONContents</strong></p><p>This is the method that you are using</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| Parameters      | As explained in the previous table                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| Record Limit    | <p>Numeric value (e.g. 10)</p><p>If Method is returning larger number of records, then you can limit this result by providing this value.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| Record JsonPath | <p>Each method returns data in JSON format and to pick any specific information from the JSON, we need to specify the <em>Record JsonPath</em> so iX Hello platform will pick that data in consideration while displaying results.</p><p>Example: $.\[\*]</p><p>This selects all the records that is returned.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| Record Template | <p>Let’s assume that the following JSON represents one record.</p><p>{</p><p>"attributes": {</p><p>"type": "Contact",</p><p>"url": "/services/data/v47.0/sobjects/Contact/0032w000002GFOVAA4"</p><p>},</p><p>"Id": "0032w000002GFOVAA4",</p><p>"FirstName": "John",</p><p>"LastName": "Bond",</p><p>"Phone": "(312) 596-1000"</p><p>}</p><p>In this example, Phone is at root level and can be accessed by {{Phone}}</p><p>So record template can be written as</p><p><em>Phone number of {{FirstName}} {{LastName}} is {{Phone}}</em></p><p>So, when a method is executed, this will be displayed as,</p><p><em>Phone number of John Bond is (312) 596-1000</em></p><p>Note:</p><p>Anything written in between {{ }} is represented as a json field and it’s case-sensitive.</p><p>{{Phone}} is not same as {{phone}}</p> |
| Result Template | <p>This indicates how method results should be represented.</p><p>Here you go, {{Records}}</p><p>Here, {{Records}} represents one or more records separated by a separator.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |

#### Sample Response: <a href="#toc46439384" id="toc46439384"></a>

```
{
   "Contacts": [
   {
      "name": "Martin",
      "contactnumber": "(678)345 6789",
      "country": "US"
   },
   {
      "name": "Bob",
      "contactnumber": "(678) 045 6789",
      "country": "US"
   },
   {
      "name": "James",
      "contactnumber": "(678) 123 0456",
      "country": "Canada"
   }
   ]
}
```

### Method: AddRecordToNode <a href="#toc90240821" id="toc90240821"></a>

This method is useful for adding new records in existing JSON that you have uploaded in the Contents section on the  iX Hello platform.

This method requires following parameters:

| Parameter      | Sample Value                                                                                         | Info                                                                                                                          |
| -------------- | ---------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- |
| ContentID      | Contacts01                                                                                           | This parameter is used to uniquely identify the content (JSON file) used in Internal Data                                     |
| NodePath       | $.Contacts                                                                                           | NodePath determines the path or location within the JSON to insert the record.                                                |
| Record         | <p>{</p><p>"name": "Joe",</p><p>"contactnumber": "(678) 000 6789",</p><p>"country": "US"</p><p>}</p> | The record in valid JSON format                                                                                               |
| RecordPosition | <p>First</p><p>Last</p>                                                                              | <p>You can select value for dropdown.</p><p>It determines the position of the newly inserted record in the original JSON.</p> |

#### Sample Response: <a href="#toc90240822" id="toc90240822"></a>

{"result":"success"}

### Method: AddRecord <a href="#toc90240823" id="toc90240823"></a>

This method is useful for adding new records in existing JSON that you have uploaded in the Contents section on the iX Hello platform. The method is like the previous one with a difference that, it does not require NodePath. It is useful when you have a very simple JSON (just key value pairs).

This method requires following parameters:

| Parameter      | Sample Value                                                                                         | Info                                                                                                                          |
| -------------- | ---------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- |
| ContentID      | Contacts01                                                                                           | This parameter is used to uniquely identify the content (JSON file) used in Internal Data                                     |
| Record         | <p>{</p><p>"name": "Joe",</p><p>"contactnumber": "(678) 000 6789",</p><p>"country": "US"</p><p>}</p> | The record in valid JSON format                                                                                               |
| RecordPosition | <p>First</p><p>Last</p>                                                                              | <p>You can select value for dropdown.</p><p>It determines the position of the newly inserted record in the original JSON.</p> |

#### Sample Response: <a href="#toc90240824" id="toc90240824"></a>

{"result":"success"}}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.ixhello.com/ixhc/json-methods/internal-data-json-methods.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
