AI Agent Topic

Prev Next

Topic

Topic JSON Format

Topic is represented as simple flat JSON objects with the following keys:

Name Type Description
id guid Id of the topic.
aiAgentId guid Id of the AI agent.
name string Name of the topic.
description string Description of the topic.
topicCategoryId guid Id of the topic category.
questions Topic Question Array Questions for the topic.
answer Topic Answer Answer for the topic.

Topic Question JSON Format

Name Type Description
id guid Id of the question.
topicId guid Id of the topic.
question string Question text.

Topic Answer JSON Format

Name Type Description
topicId guid Id of the topic.
type enum Allowed values are workflow, naturalLanguage.
instructions string Instructions for the answer.
workflow object Chatbot response workflow.
functionIds [guid] Array FunctionIds used in the answer.
functions Function Array Functions used in the answer.

Get the list of Topics

GET aiagent/topics

Parameters:

Name Type in Required Description
siteId integer query yes Site Id.
aiAgentId guid query yes ID of the AI agent to filter topics by.
topicCategoryId guid query no ID of the AI agent Topic Category.
keywords string query no Search topics containing these keywords in name or description.
include string query no Allowed values are questions, answer. Includes related data in response.
pageSize integer query no Number of topics to return per page.
pageIndex integer query no Page number to retrieve. Default is 1.

Response:

An array of Topic

Example

Sample Request:

curl https://api11.comm100.io/aiagent/topics?siteId=10000&aiAgentId=ec9f351e-d7d7-45fc-81aa-2fdd9e706f17 \ 
    -X GET \ 
    -H 'Authorization: Bearer {access_token}'

Response:
HTTP/1.1 200 OK

[
    {
        "id": "eace93f3-ce47-4e01-a4cb-08dd5aebc1c0",
        "aiAgentId": "ec9f351e-d7d7-45fc-81aa-2fdd9e706f17",
        "topicCategoryId": "b0f0f202-b8ee-41d8-ae9b-c5ce2946218c",
        "name": "sayhi",
        "description": "'sayhi' is about the importance of greetings in social interactions. It helps users understand how to effectively initiate conversations, build rapport, and foster connections with others."
    }
]

Get a single Topic

GET aiagent/topics/{id}

Parameters:

Name Type in Required Description
siteId integer query yes Site Id.
id guid path yes ID of the topic to retrieve.
include string query no Allowed values are questions, answer. Includes related data in response.

Response:

Topic

Example

Sample Request:

curl https://api11.comm100.io/aiagent/topics/eace93f3-ce47-4e01-a4cb-08dd5aebc1c0?siteId=10000 \ 
    -X GET \ 
    -H 'Authorization: Bearer {access_token}'

Response:
HTTP/1.1 200 OK

{
    "id": "eace93f3-ce47-4e01-a4cb-08dd5aebc1c0",
    "aiAgentId": "ec9f351e-d7d7-45fc-81aa-2fdd9e706f17",
    "topicCategoryId": "b0f0f202-b8ee-41d8-ae9b-c5ce2946218c",
    "name": "sayhi",
    "description": "'sayhi' is about the importance of greetings in social interactions. It helps users understand how to effectively initiate conversations, build rapport, and foster connections with others.",
    "questions": [
        {
            "id": "702632ff-0f37-46dd-1c0d-08dd5aebc1c1",
            "topicId": "eace93f3-ce47-4e01-a4cb-08dd5aebc1c0",
            "question": "hi"
        },
        {
            "id": "3e89aecb-430a-4d0d-1c0e-08dd5aebc1c1",
            "topicId": "eace93f3-ce47-4e01-a4cb-08dd5aebc1c0",
            "question": "Hello!"
        },
        {
            "id": "00f6e4ec-f090-4d32-1c0f-08dd5aebc1c1",
            "topicId": "eace93f3-ce47-4e01-a4cb-08dd5aebc1c0",
            "question": "Hi there!"
        },
        {
            "id": "49e45be1-dabb-47e2-1c10-08dd5aebc1c1",
            "topicId": "eace93f3-ce47-4e01-a4cb-08dd5aebc1c0",
            "question": "Greetings!"
        },
        {
            "id": "45819e9a-c279-4328-1c11-08dd5aebc1c1",
            "topicId": "eace93f3-ce47-4e01-a4cb-08dd5aebc1c0",
            "question": "Hey!"
        }
    ]
}

Create a new Topic

POST aiagent/topics

Parameters:

Name Type in Required Description
siteId integer query yes Site Id.
aiAgentId guid body yes ID of the AI agent to which this topic belongs.
topicCategoryId guid body yes ID of the AI agent topic category.
name string body yes Unique in an AI agent.
question string body no Initial question text for the topic. Will Generate similar questions according to this qusetion text.

Response:

Topic

Example

Sample Request:

curl https://api11.comm100.io/aiagent/topics?siteId=10000 \ 
    -X POST \
    -H 'Authorization: Bearer {access_token}' \
    -H 'Content-Type: application/json' \
    -D '{"name":"sayhi","question":"hi","siteId":10000,"aiAgentId":"ec9f351e-d7d7-45fc-81aa-2fdd9e706f17","topicCategoryId": "b0f0f202-b8ee-41d8-ae9b-c5ce2946218c"}'

Response:
HTTP/1.1 201 OK

{
    "id": "eace93f3-ce47-4e01-a4cb-08dd5aebc1c0",
    "aiAgentId": "ec9f351e-d7d7-45fc-81aa-2fdd9e706f17",
    "topicCategoryId": "b0f0f202-b8ee-41d8-ae9b-c5ce2946218c",
    "name": "sayhi",
    "description": "'sayhi' is about the importance of greetings in social interactions. It helps users understand how to effectively initiate conversations, build rapport, and foster connections with others.",
    "questions": [
        {
            "id": "702632ff-0f37-46dd-1c0d-08dd5aebc1c1",
            "topicId": "eace93f3-ce47-4e01-a4cb-08dd5aebc1c0",
            "question": "hi"
        },
        {
            "id": "3e89aecb-430a-4d0d-1c0e-08dd5aebc1c1",
            "topicId": "eace93f3-ce47-4e01-a4cb-08dd5aebc1c0",
            "question": "Hello!"
        },
        {
            "id": "00f6e4ec-f090-4d32-1c0f-08dd5aebc1c1",
            "topicId": "eace93f3-ce47-4e01-a4cb-08dd5aebc1c0",
            "question": "Hi there!"
        },
        {
            "id": "49e45be1-dabb-47e2-1c10-08dd5aebc1c1",
            "topicId": "eace93f3-ce47-4e01-a4cb-08dd5aebc1c0",
            "question": "Greetings!"
        },
        {
            "id": "45819e9a-c279-4328-1c11-08dd5aebc1c1",
            "topicId": "eace93f3-ce47-4e01-a4cb-08dd5aebc1c0",
            "question": "Hey!"
        }
    ]
}

Update the Topic

PUT aiagent/topics/{id}

Parameters:

Name Type in Required Description
siteId integer query yes Site Id.
id guid path yes ID of the topic to update.
topicCategoryId guid body no Updated topic Category Id.
name string body no Updated name for the topic. Must be unique within the AI agent.
description string body no Updated description of the topic.
questions Topic Question Array body no Updated list of questions for the topic.
answer Topic Answer body no Updated answer configuration for the topic.

Response:

Topic

Example

Sample Request:

curl https://api11.comm100.io/aiagent/topics/eace93f3-ce47-4e01-a4cb-08dd5aebc1c0?siteId=10000 \ 
    -X PUT \
    -H 'Authorization Bearer {access_token}' \
    -H 'Content-Type: application/json' \
    -D '{"description":"Updated description of the topic."}'

Response:
HTTP/1.1 200 OK

{
    "id": "eace93f3-ce47-4e01-a4cb-08dd5aebc1c0",
    "aiAgentId": "ec9f351e-d7d7-45fc-81aa-2fdd9e706f17",
    "topicCategoryId": "b0f0f202-b8ee-41d8-ae9b-c5ce2946218c",
    "name": "sayhi",
    "description": "Updated description of the topic."
}

Delete the Topic

DELETE aiagent/topics/{id}

Parameters:

Name Type in Required Description
siteId integer query yes Site Id.
id guid path yes ID of the topic to delete.

Response:

No Content

Example

Sample Request:

curl https://api11.comm100.io/aiagent/topics/eace93f3-ce47-4e01-a4cb-08dd5aebc1c0?siteId=10000 \ 
    -X DELETE \
    -H 'Authorization Bearer {access_token}'

Response:

HTTP/1.1 204 No Content

Copyright © 2022 Comm100 Network Corporation. All Rights Reserved.