Buni.aiDocs
API referenceBots

Send a message to a chatbot (async)

Queues a message for a chatbot and returns immediately with 202 and an invocationId.

POST/bots/{projectId}/invoke

Queues a message for a chatbot and returns immediately with 202 and an invocationId. Poll GET /external-invocations/{invocationId} or pass webhookUrl to receive the result.

Requires the bot:invoke scope. Chatbot projects only.

This endpoint does not accept runAt or delaySeconds; to schedule a run, trigger the flow with POST /flows/{projectId}/trigger-async instead.

Authorization

AuthorizationBearer <token>

Authorization: Bearer bai_ext_.... Tokens belong to one project and carry scopes: bot:invoke, flow:trigger, automation:trigger.

In: header

Scope: bot:invoke

Path Parameters

projectId*string

The project ID. The token must belong to this project.

Header Parameters

x-idempotency-key?string

Up to 128 characters. A repeat of a key already used for the same project, target and mode returns the original run instead of starting a new one. Longer keys are ignored.

Lengthlength <= 128

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/bots/string/invoke" \  -H "Content-Type: application/json" \  -d '{    "message": "I want to change my delivery address",    "sessionId": "customer-4821",    "userName": "Ama Mensah",    "webhookUrl": "https://api.example.com/buni/callbacks",    "webhookSecret": "whsec_example_only"  }'

{  "invocationId": "clx9k7r2q0004ab12cd34ef99",  "status": "QUEUED"}