Agent-TS API Reference
The Agent-TS service exposes REST endpoints for WhatsApp integration, health monitoring, and internal notifications.Base URL
Endpoints Overview
| Method | Endpoint | Description | Auth |
|---|---|---|---|
GET | /health | Health check | None |
DELETE | /api/v1/conversation/:phone | Clear conversation | None |
GET | /api/v1/webhooks/whatsapp | Meta webhook verification | Verify Token |
POST | /api/v1/webhooks/whatsapp | Kapso / Meta WhatsApp messages | None |
POST | /api/v1/external/whatsapp | Compatibility test bridge | None |
POST | /api/v1/notifications/whatsapp | Internal notifications | HMAC |
Health Check
/health
Check if the agent service is running and healthy.
Response
Example
Clear Conversation
/api/v1/conversation/:phone
Clear the conversation history for a specific user.
Path Parameters
| Parameter | Type | Description |
|---|---|---|
phone | string | Phone number (E.164 or local format) |
Response
- Success (200)
- Not Found (404)
Example
Compatibility WhatsApp Webhook
/api/v1/external/whatsapp
Receive messages from a compatibility bridge used for local testing. Production traffic should use Kapso / Meta webhooks.
Request Body
Event type:
message, connected, disconnectedText message content
Sender JID (e.g.,
23279123456@c.us)Phone in E.164 format (e.g.,
+23279123456)Message type:
text, image, documentWhether message contains media
Media object with
data, mimetype, filename, sizeText Message Request
Image Message Request (KYC)
Response
Example
Meta WhatsApp Webhook (Verification)
/api/v1/webhooks/whatsapp
Verify webhook with Meta WhatsApp Business API.
Query Parameters
| Parameter | Type | Description |
|---|---|---|
hub.mode | string | Must be subscribe |
hub.verify_token | string | Your verify token |
hub.challenge | string | Challenge to echo back |
Response
Returns thehub.challenge value on success, or 403 on failure.
Example
Kapso / Meta WhatsApp Webhook (Messages)
/api/v1/webhooks/whatsapp
Receive messages from Kapso’s WhatsApp webhook, and also accepts forwarded Meta webhook payloads.
Request Body
Standard Meta webhook format:Response
Returns200 OK on success.
Internal Notifications
/api/v1/notifications/whatsapp
Send transaction notifications via WhatsApp (internal service use only).
Authentication
HMAC service authentication required:Request Body
Recipient phone in E.164 format
Notification free-text body. Required unless
interactive or template is provided.Optional Kapso interactive payload for list menus, reply buttons, flows, or CTA URLs.
Optional approved WhatsApp template payload sent through Kapso.
Transaction type for receipt generation
Transaction metadata for receipt
Transaction Types
| Type | Description |
|---|---|
pos_payment | POS terminal payment |
pos_refund | POS refund |
agent_cash_in | Agent cash-in |
p2p_transfer | Peer-to-peer transfer |
cash_out | Cash withdrawal |
Default Delivery Policy
| Transaction / event | Default delivery |
|---|---|
| gateway credential notifications | free text |
subscriber_registration | interactive buttons |
fund_from_vult | interactive buttons |
transfer_to_vult | interactive buttons |
processor_transfer | interactive buttons |
account_unblocked | interactive buttons |
child_card_created | interactive buttons |
card_unblocked | interactive buttons |
| security alerts, OTPs, VIP alerts, compliance alerts | free text |
pos_payment, pos_refund, agent_cash_in, p2p_transfer, cash_out | receipt image with caption when metadata is present |
interactive or template payload.
Request Example
Template Example
Response
Example
Error Responses
Standard Error Format
Common Errors
| Status | Error | Description |
|---|---|---|
| 400 | Phone number required | Missing phoneE164 |
| 401 | Service authentication failed | Invalid HMAC |
| 500 | Error processing webhook | Internal error |
| 503 | Agent not initialized | Service starting |
Next Steps
Tools Reference
OpenAI function calling tools
Webhooks Guide
WhatsApp integration setup