All plans have 30% OFF For this week

Claim Discount

API Reference: Topics Endpoint

The Topics endpoint in AnswerPal allows you to manage and organize topics—categories or labels that help classify conversations, tickets, or messages. Topics are essential for routing, automation, analytics, and context-aware workflows. You can create, update, retrieve, and delete topics, as well as manage topic-related actions, mappings, and documents.

Overview

Topics are used in AnswerPal to categorize and automate the handling of incoming messages, tickets, or customer conversations. Each topic can be linked to specific actions, documents, and mappings, enabling advanced automation and reporting. The Topics API provides endpoints to manage topics and related resources efficiently.

Endpoints

Topics

Method and URL: GET /api/Topics Returns a paginated list of all topics for the authenticated customer.

Method and URL: GET /api/Topics/{id} Returns the details for a specific topic.

Method and URL: POST /api/Topics Creates a new topic. Provide the required fields in the request body.

Create Topic Request (POST /api/Topics):

{
  "name": "Order Status",
  "description": "Status updates and order tracking"
}

Topic Response (GET /api/Topics/101):

{
  "topicID": 101,
  "customerID": 42,
  "name": "Order Status",
  "description": "Status updates and order tracking"
}

Method and URL: PUT /api/Topics/{id} Updates an existing topic. Provide the fields to update in the request body.

Method and URL:DELETE /api/Topics/{id} Deletes a topic by its unique ID.

TopicActions

The TopicActionsmanages the association between topics and actions. You can list, create, update, and delete topic-action mappings to define automation flows.

Method and URL: GET /api/TopicActions Returns a paginated list of all topic-action mappings. Supports filters: topicId, actionId, hookName, channelId, isActive.

Method and URL: GET /api/TopicActions/{id} Returns the details for a specific topic-action mapping.

Method and URL: POST /api/TopicActions Creates a new topic-action mapping. Provide the required fields in the request body.

Method and URL: PUT /api/TopicActions/{id} Updates the priority of a topic-action mapping.

Method and URL: DELETE /api/TopicActions/{id} Deletes a topic-action mapping by its unique ID.

Method and URL: POST /api/TopicActions/bulk Bulk create multiple topic-action mappings.

Create TopicAction Example

Create TopicAction Request (POST /api/TopicActions):

{
"topicID": 101,
"actionID": 55,
"priority": 10,
"isActive": true
}

TopicAction Response (GET /api/TopicActions/201):

{
"topicActionID": 201,
"topicID": 101,
"actionID": 55,
"priority": 10,
"isActive": true
}

TopicDocuments

The TopicDocumentsmanages the linkage between topics and documents. You can list, create, update, and delete topic-document associations, enabling context-aware responses and knowledge base integration.

Method and URL: GET /api/TopicDocuments Returns a paginated list of all topic-document mappings. Supports filters: topicId, documentId, channelId, hookName, isHook.

Method and URL: GET /api/TopicDocuments/{id} Returns the details for a specific topic-document mapping.

Method and URL: POST /api/TopicDocuments Creates a new topic-document mapping. Provide the required fields in the request body.

Method and URL: PUT /api/TopicDocuments/{id} Updates an existing topic-document mapping. Provide the fields to update in the request body.

Method and URL: DELETE /api/TopicDocuments/{id} Deletes a topic-document mapping by its unique ID.

Method and URL: POST /api/TopicActions/bulk Bulk create multiple topic-action mappings.

TopicDocument

A TopicDocument links a topic to a document, which can be used for automated replies, knowledge base references, or dynamic data retrieval. Properties:

    • topicDocumentID (integer, required): Unique identifier for the mapping. Example: 401
    • topicID (integer, required): Reference to the topic. Example: 101
    • documentID (integer, required): Reference to the document. Example: 501
    • relevanceScore (integer, optional): Score for ranking document relevance. Example: 95

Create TopicDocument Example

Create TopicDocument Request (POST /api/TopicDocuments):

{
"topicID": 101,
"documentID": 501,
"relevanceScore": 95
}

TopicDocument Response (GET /api/TopicDocuments/401):

{
"topicDocumentID": 401,
"topicID": 101,
"documentID": 501,
"relevanceScore": 95
}

Data Models

Topic Object

The Topic object is used in requests and responses for the Topics API.

Properties:

  • topicID (integer, required): Unique identifier for the topic. Example: 101
  • customerID (integer, required): Reference to the customer organization. Example: 42
  • name (string, required): Name of the topic. Example: Order Status
  • description (string, optional): Description of the topic. Example: Status updates

TopicCreateDTO and TopicUpdateDTO

Used in POST and PUT requests for creating or updating a topic.

Properties:

  • name (string, required): Name of the topic.
  • Example: Order Status

description (string, optional): Description of the topic. Example: Status updates

TopicAction Object

A TopicAction links a topic to an action, defining what automation should occur when a message is classified with a particular topic.

Properties:

  • topicActionID (integer, required): Unique identifier for the topic-action link. Example: 201
  • topicID (integer, required): Reference to the topic. Example: 101
  • actionID (integer, required): Reference to the action. Example: 55
  • priority (integer, required): Execution priority, lower values are executed first. Example: 10
  • isActive (boolean, required): Whether this topic-action mapping is active. Example: true

PageTopicMapping Object

A PageTopicMapping links a web page or resource to a topic, allowing context-aware automation or analytics.

Properties:

  • pageTopicMappingID (integer, required): Unique identifier for the mapping. Example: 301
  • topicID (integer, required): Reference to the topic. Example: 101
  • pageUrl (string, required): URL of the web page. Example: https://site.com/help
  • context (string, optional): Additional mapping context or metadata. Example: FAQ Section

TopicDocument Object

A TopicDocument links a topic to a document, which can be used for automated replies, knowledge base references, or dynamic data retrieval.

Properties:

  • topicDocumentID (integer, required): Unique identifier for the mapping. Example: 401
  • topicID (integer, required): Reference to the topic. Example: 101
  • documentID (integer, required): Reference to the document. Example: 501
  • relevanceScore (integer, optional): Score for ranking document relevance. Example: 95

Request and Response Examples

Create Topic Request (POST /api/Topics): name: Order Status description: Status updates and order tracking

Topic Response (GET /api/Topics/101): topicID: 101 customerID: 42 name: Order Status description: Status updates and order tracking

FAQ

Yes, topics are designed for routing tickets, messages, and automating workflows.

Yes, you can link multiple actions with different priorities to a topic.

All mappings and actions linked to the topic will no longer trigger for that topic.

Table of Contents

AnswerPal: AI-powered customer service solutions to elevate your support and communication effortlessly.

Contact

For all support, sales, and partnership inquiries, email us at info@answerpal.eu