Skip to main content

Agent-TS API Reference

The Agent-TS service exposes REST endpoints for WhatsApp integration, health monitoring, and internal notifications.

Base URL

Endpoints Overview


Health Check

Check if the agent service is running and healthy.

Response

Example


Clear Conversation

Clear the conversation history for a specific user.

Path Parameters

Response

Example


Compatibility WhatsApp Webhook

Receive messages from a compatibility bridge used for local testing. Production traffic should use Kapso / Meta webhooks.

Request Body

string
required
Event type: message, connected, disconnected
string
Text message content
string
Sender JID (e.g., 23279123456@c.us)
string
required
Phone in E.164 format (e.g., +23279123456)
string
Message type: text, image, document
boolean
Whether message contains media
object
Media object with data, mimetype, filename, size

Text Message Request

Image Message Request (KYC)

The media.data field must include the data URI prefix (data:image/jpeg;base64,).

Response

Example


Meta WhatsApp Webhook (Verification)

Verify webhook with Meta WhatsApp Business API.

Query Parameters

Response

Returns the hub.challenge value on success, or 403 on failure.

Example


Kapso / Meta WhatsApp Webhook (Messages)

Receive messages from Kapso’s WhatsApp webhook, and also accepts forwarded Meta webhook payloads.

Request Body

Standard Meta webhook format:

Response

Returns 200 OK on success.

Internal Notifications

Send transaction notifications via WhatsApp (internal service use only).

Authentication

HMAC service authentication required:

Request Body

string
required
Recipient phone in E.164 format
string
Notification free-text body. Required unless interactive or template is provided.
object
Optional Kapso interactive payload for list menus, reply buttons, flows, or CTA URLs.
object
Optional approved WhatsApp template payload sent through Kapso.
string
Transaction type for receipt generation
object
Transaction metadata for receipt

Transaction Types

Default Delivery Policy

Services can always override the default by sending an explicit interactive or template payload.

Request Example

Template Example

Response

Example


Error Responses

Standard Error Format

Common Errors

Next Steps

Tools Reference

OpenAI function calling tools

Webhooks Guide

WhatsApp integration setup