chats.sendBotMessage
POST
/v1/bots/{botId}/messages
const url = 'https://example.com/v1/bots/example/messages';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"commandKey":"example","input":[{"type":"message","role":"user","content":[{"type":"input_text","text":"example"}]}],"queue":true}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/v1/bots/example/messages \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "commandKey": "example", "input": [ { "type": "message", "role": "user", "content": [ { "type": "input_text", "text": "example" } ] } ], "queue": true }'Sends a message to your Chat with this Bot. OpenBot makes the Chat the first time. When the Bot is free, the message starts a Turn at once. When the Bot works for you, it reads the message at its next step. You need bots.delegate on the Bot.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”botId
required
string
Request Bodyrequired
Section titled “Request Bodyrequired”Media typeapplication/json
object
commandKey
required
string
input
required
queue
boolean
Responses
Section titled “Responses”Success
Media typeapplication/json
object
executionId
required
string
commandKey
required
string
sequence
required
integer
chat
required
string
turn
required
string
Example generated
{ "executionId": "example", "commandKey": "example", "sequence": 1, "chat": "example", "turn": "example"}ChatModelInvalid | FileInvalid | BotInvalid | OrganizationRequired
Media typeapplication/json
AuthenticationRequired
Media typeapplication/json
object
_tag
required
string
Example
{ "_tag": "AuthenticationRequired"}ExecutionForbidden | @nmnmcc/ability/Authorizer/Forbidden | MembershipRequired | ForbiddenOrigin
ExecutionNotFound | ChatNotFound | BotNotFound
ExecutionConflict | ExecutionKeyConflict | ChatConflict | @nmnmcc/ability/Authorizer/Pending | BotConflict
Media typeapplication/json
RateLimited
Media typeapplication/json
object
_tag
required
string
retryAfterSeconds
required
integer
Example
{ "_tag": "RateLimited"}ExecutionUnavailable | ChatStorageUnavailable | ChatExecutionUnavailable | BotStorageUnavailable | AuthenticationUnavailable | RequestFailed
Media typeapplication/json
Any of:
object
_tag
required
string
errorId
required
string
object
_tag
required
string
object
_tag
required
string
chat
required
string
object
_tag
required
string
object
_tag
required
string
object
_tag
required
string
object
_tag
required
string
category
required
string
errorId
required
string
Example
{ "_tag": "ExecutionUnavailable"}