Skip to main content
POST
/
api
/
chat
curl -X POST "https://api.hitler.app/api/chat" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "message": "tomorrow I need to review the budget and send invoices",
    "platform": "web",
    "platformUserId": "user-123",
    "history": []
  }'
{
  "text": "got it, adding 2 tasks",
  "intent": "task_create",
  "taskDrafts": [
    {
      "id": "draft-uuid-1",
      "title": "review the budget",
      "priority": 3,
      "dueDate": "2024-01-16T09:00:00.000Z"
    },
    {
      "id": "draft-uuid-2",
      "title": "send invoices",
      "priority": 3,
      "dueDate": "2024-01-16T09:00:00.000Z"
    }
  ],
  "showMoodPrompt": false,
  "inferredMood": null
}
This endpoint requires authentication via JWT (for web users) or API key (for bot services).

Overview

The chat endpoint provides conversational AI capabilities powered by Anthropic tool use. The LLM understands natural language in any supported language, decides which tools to call (get_tasks, create_task_draft, log_mood, etc.), and returns responses grounded in real data. When tasks are detected, it creates drafts for user confirmation.

Request

message
string
required
The user’s message (1-2000 characters)
platform
string
required
Source platform: web, slack, teams, or whatsapp
platformUserId
string
required
User identifier on the platform (user ID or UUID)
history
array
Recent conversation history for context. Each item should have role ("user" or "assistant") and content (the message content).

Response

text
string
The AI’s response message
intent
string
Detected intent: task_create, task_list, mood, help, greeting, or general
taskDraft
object
Single task draft (when one task is detected). Contains id (Draft UUID), title (Parsed task title), priority (1-5), and optional dueDate.
taskDrafts
array
Multiple task drafts (when several tasks are detected)Each item contains id, title, priority, and optional dueDate
tasks
array
Task list returned when the LLM calls get_tasks tool. Each item contains id, title, status, priority, dueDate, createdAt
completedTask
object
Task that was just completed via the complete_task tool. Contains id, title, status
moodLogged
object
Mood entry just logged via the log_mood tool. Contains id, value, note, createdAt
moodHistory
array
Recent mood entries returned from get_mood_history tool
taskStats
object
Task statistics from get_task_stats tool. Contains totalTasks, completedTasks, completionRate, openTasks, overdueTasks
showMoodPrompt
boolean
Whether to show mood logging UI
inferredMood
integer
Mood value (1-5) inferred from the message, if detected

Intents

IntentDescriptionTypical Response
task_createUser wants to create a taskReturns taskDraft or taskDrafts
task_listUser asks about their tasksReturns task summary in text
moodUser wants to log moodSets showMoodPrompt: true
helpUser asks for helpReturns help information
greetingCasual greetingFriendly response
generalGeneral conversationConversational response
curl -X POST "https://api.hitler.app/api/chat" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "message": "tomorrow I need to review the budget and send invoices",
    "platform": "web",
    "platformUserId": "user-123",
    "history": []
  }'
{
  "text": "got it, adding 2 tasks",
  "intent": "task_create",
  "taskDrafts": [
    {
      "id": "draft-uuid-1",
      "title": "review the budget",
      "priority": 3,
      "dueDate": "2024-01-16T09:00:00.000Z"
    },
    {
      "id": "draft-uuid-2",
      "title": "send invoices",
      "priority": 3,
      "dueDate": "2024-01-16T09:00:00.000Z"
    }
  ],
  "showMoodPrompt": false,
  "inferredMood": null
}

Service Endpoint

For bot services (Slack, Teams), use the service endpoint with API key authentication:
POST /api/chat/service
This endpoint uses the X-API-Key header instead of JWT Bearer token.
curl -X POST "https://api.hitler.app/api/chat/service" \
  -H "X-API-Key: hitler_org123_secret456" \
  -H "Content-Type: application/json" \
  -d '{
    "message": "what tasks do I have?",
    "platform": "slack",
    "platformUserId": "U123ABC456"
  }'

Language Support

Hitler supports 13 languages with automatic detection:
LanguageCodeScript Detection
EnglishenglishLatin (default)
HinglishhinglishHindi patterns
SpanishspanishSpanish diacritics
FrenchfrenchFrench diacritics
GermangermanGerman characters
PortugueseportuguesePortuguese diacritics
ItalianitalianItalian patterns
DutchdutchDutch words
JapanesejapaneseHiragana/Katakana/Kanji
KoreankoreanHangul
ChinesechineseCJK ideographs
ArabicarabicArabic script
RussianrussianCyrillic
The AI automatically detects the user’s language and responds appropriately:
Request (Spanish)
{
  "message": "añade una tarea: revisar el presupuesto",
  "platform": "web",
  "platformUserId": "user-123"
}
Response (Spanish)
{
  "text": "vale, añadiendo \"revisar el presupuesto\"",
  "intent": "task_create",
  "taskDraft": {
    "id": "draft-uuid",
    "title": "revisar el presupuesto",
    "priority": 3
  }
}

Language Endpoints

Get Supported Languages
GET /api/chat/languages
Returns the list of all supported languages. Get User’s Language
GET /api/chat/language
Authorization: Bearer YOUR_TOKEN
Returns the user’s current language preference. Update User’s Language
PATCH /api/chat/language
Authorization: Bearer YOUR_TOKEN
Content-Type: application/json

{ "language": "spanish" }
Sets the user’s preferred language, overriding auto-detection.

Notes

  • Task drafts created via chat must be confirmed using the Confirm Draft endpoint
  • The AI uses conversation history for context, but history is not persisted server-side
  • Mood inference happens silently and doesn’t interrupt the conversation
  • Response messages are kept short (8-12 words) for chat-like UX
  • Language is auto-detected from each message but can be manually set