Inbox / TypeScript SDK

Analyze sentiment

Run the SentimentAgent on a conversation: classifies the prospect across the canonical 7 stages (initial, interested, neutral, objection, meeting_ready, closed_lost, closed_won) and updates the conversation_contexts row. Pass the full conversation object plus its messages - the agent uses the message thread, not the chat_id alone.

pipeline.analyzeSentimentBackend AI, consent required

Parameters

workspaceIdOptional · string
Optional workspace ID or slug. Required when this credential can access multiple workspaces and no workspace was configured on the client.
decisionOverrideOptional · object
See the input schema for this field.
workspaceSlugOptional · string
Required for Clerk auth. Ignored when using API key (workspace inferred from key).
conversationRequired · object
Required. The conversation object (must include chat_id).
messagesOptional · array
Message thread to analyze.
currentTagsOptional · array
Existing conversation tags so the agent can update incrementally.
allowHostedAiOptional · boolean
Must be true when this operation uses Pipeline hosted inference.
Request example
await pipeline.analyzeSentiment({
  "conversation": {},
  "allowHostedAi": true
})
Full input schema
Input schema
{
  "type": "object",
  "properties": {
    "workspaceId": {
      "type": "string",
      "minLength": 1,
      "description": "Optional workspace ID or slug. Required when this credential can access multiple workspaces and no workspace was configured on the client."
    },
    "decisionOverride": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "type": "object",
      "properties": {
        "provider": {
          "type": "string",
          "enum": [
            "typesafe",
            "openrouter"
          ]
        },
        "credentialId": {
          "type": "string",
          "format": "uuid",
          "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
        },
        "model": {
          "type": "string",
          "minLength": 1
        },
        "enabledTasks": {
          "maxItems": 3,
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "icp_scoring",
              "reply_classification",
              "sentiment_tagging"
            ]
          }
        },
        "fallback": {
          "type": "string",
          "enum": [
            "review",
            "configured_llm"
          ]
        },
        "policyVersion": {
          "type": "string",
          "const": "jev-policy-v1"
        }
      },
      "required": [
        "provider",
        "credentialId",
        "model",
        "enabledTasks",
        "fallback",
        "policyVersion"
      ],
      "additionalProperties": false
    },
    "workspaceSlug": {
      "type": "string",
      "description": "Required for Clerk auth. Ignored when using API key (workspace inferred from key)."
    },
    "conversation": {
      "type": "object",
      "additionalProperties": true,
      "description": "Required. The conversation object (must include chat_id)."
    },
    "messages": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": true
      },
      "description": "Message thread to analyze."
    },
    "currentTags": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Existing conversation tags so the agent can update incrementally."
    },
    "allowHostedAi": {
      "type": "boolean",
      "description": "Must be true when this operation uses Pipeline hosted inference."
    }
  },
  "required": [
    "conversation"
  ]
}
See this operation inCLI MCP REST API
TypeScript SDK | Pipeline v2 preview