AnswerIA API

The API for classifying and suggesting answers to customer messages, reviews, claims and more

Mailbot API Documentation

The Mailbot API is a microservice designed to classify and suggest answers to incoming emails. It can receive both plain text messages and base64 encoded files as input, and it responds with a list of categories and suggested answers.

Base URL

The base URL for accessing the Mailbot API is:

https://api.datakeen.co/api/v1/answeria/

Endpoints

Classify and Suggest Answer

Description

This endpoint allows you to submit an email as a plain text message or a base64 encoded file. It processes the message using a specific model identified by model_id and returns a list of categories along with a suggested answer.

Request Format

  • Method: POST
  • URL: https://api.datakeen.co/api/v1/answeria/{model_id}/classify
  • Headers:
    • Content-Type: application/json

URL Parameter

ParameterTypeDescription
model_idstringUnique identifier of the model to be used for classification.

Request Parameters

ParameterTypeDescription
messagestringThe email content as a plain text string.
filestringThe email content as a base64 encoded file.

Example Request (Plain Text)

curl -X POST https://api.datakeen.co/api/v1/answeria/12345/classify \
-H "Content-Type: application/json" \
-d '{
  "message": "What are your opening hours?"
}'

Example Request (Base64 Encoded File)

curl -X POST https://api.datakeen.co/api/v1/answeria/12345/classify \
-H "Content-Type: application/json" \
-d '{
  "file": "d2hhdCBhcmUgeW91ciBvcGVuaW5nIGhvdXJzPw=="
}'

Response Format

The response will contain a JSON object with categories and a suggested answer.

FieldTypeDescription
categoriesarrayA list of categories relevant to the message content.
suggestionstringThe suggested answer based on the message content.

Example Response

{
  "categories": ["Operating Hours", "General Inquiry"],
  "suggestion": "Our shop is open from 9 AM to 6 PM from Monday to Saturday."
}

List Possible Categories

Description

This endpoint retrieves a list of all possible categories for a model identified by model_id.

Request Format

  • Method: GET
  • URL: https://api.datakeen.co/api/v1/answeria/{model_id}/categories
  • Headers:
    • Content-Type: application/json

URL Parameter

ParameterTypeDescription
model_idstringUnique identifier of the model.

Example Request

curl -X GET https://api.datakeen.co/api/v1/answeria/12345/categories \
-H "Content-Type: application/json"

Response Format

The response will contain a JSON object with a list of categories.

FieldTypeDescription
categoriesarrayA list of categories available for the model.

Example Response

{
  "categories": ["Operating Hours", "General Inquiry", "Product Support"]
}

Add a New Category

Description

This endpoint allows you to add a new category to the list of possible categories for a specified model identified by model_id.

Request Format

  • Method: POST
  • URL: https://api.datakeen.co/api/v1/answeria/{model_id}/categories
  • Headers:
    • Content-Type: application/json

URL Parameter

ParameterTypeDescription
model_idstringUnique identifier of the model.

Request Parameters

ParameterTypeDescription
categorystringThe new category to be added.

Example Request

curl -X POST https://api.datakeen.co/api/v1/answeria/12345/categories \
-H "Content-Type: application/json" \
-d '{
  "category": "Shipping Information"
}'

Response Format

The response will confirm that the category has been added successfully.

FieldTypeDescription
successbooleanStatus of the addition operation.
messagestringConfirmation message.

Example Response

{
  "success": true,
  "message": "Category 'Shipping Information' has been added successfully."
}

Additional Information

  • Ensure that the model_id is correctly specified in the URL for all requests.
  • In case of errors, the API will return appropriate HTTP status codes along with error messages describing the issue.
  • Authentication details and further API usage limits should be addressed in the service agreement.

What’s Next

Start using the API