How do I create a content type and content item?
Â
This article shows how to create a content type (such as Fruit Nutrition), and how to create a content item (such as Apple, Banana, Cantaloupe, Durian, and so on). Content lets you define items to use in a conversational experience. For example, you may have a conversational experience that provides health benefits of fruit. In the Fruit Nutrition content type, you could have the following discrete content items, as the following image shows.
Your voice experience may include questions such as "What are the nutritional facts about bananas?" (to return a specific answer) or "Give me another tip for healthy eating." (to return a random sample from the content group). Of course, you can have many more items than are shown in this example.
Create a content type
Important: Creating a content type involves knowledge of JSON coding.
Content types are created from schemas. See How do I create a schema?
In the Project Side navigation menu > Develop > Schemas.
Â
Click Add (+) to start a new schema. Select Content as the schema type and click Add.
The following image shows a partial Edit Schema form.
Note: You can cut and paste the following sample code to the Schema Editor and modify the fields that appear when you create a content item:
{ "fields" : [ { "key" : "speaker", "label" : "Speaker voice", "isDefault" : false, "validation" : [{ "required" : "false" }], "options" : [], "ref" : "", "fieldType" : "text", "type" : "Object" }, { "key" : "source", "label" : "Source", "isDefault" : false, "validation" : [{ "required": "true" }], "options" : [], "ref" : "", "fieldType" : "text", "type" : "Object" }, { "key" : "tip", "label" : "Nutrition Tip", "isDefault" : true, "validation" : [{ "required": "true" }], "options" : [], "ref" : "", "fieldType" : "richtext", "type" : "Object" }, { "label" : "Title", "key" : "title", "isDefault" : false, "validation" : [], "options" : [], "ref" : "", "fieldType" : "text", "type" : "String" }, { "label" : "Tags", "key" : "tags", "isDefault" : false, "validation" : [], "options" : [], "ref" : "", "fieldType" : "text", "type" : "Object" } ]
Click Save (checkmark).
Create a content item
You can create content data using the Dynamic Data Manager node or you can add content data manually. See How to use the Dynamic Data Manager node.
Use the following steps to create content data manually:
To create content data locally, go to the project and click on Content from the side menu bar.
Â
Select a content type (such as Fruit Nutrition).
Â
For each content type, repeat the following steps:
Click Add (+) to get the Add content pop-up window.
Â
Enter a content name and select the content type. Click Add for the content form to appear. (To edit an existing content item, open the vertical ellipsis and choose Edit for the content form to appear.)
Â
After you fill out the form and save it, the detail view appears.