Update Bot
info
Advanced API is available in the Business Plan
Description
This API endpoint allows you to update an existing bot. You can edit various fields like the bot's name, description, triggering behavior, message visibility, and more.
PUT
https://api.deadsimplechat.com/consumer/api/v2/bot/:botId?auth=<YOUR_API_KEY>
Request
PUT /consumer/api/v2/bot/:botId
Query Parameters
Parameter | Description | Data Type | Required |
---|---|---|---|
auth | Go to Dashboard -> Developer -> Private Key is your auth | String | Yes |
Request Body
The request body should contain a JSON object with the following optional fields:
Field | Description | Data Type | Constraints |
---|---|---|---|
name | The name of the bot | String | Optional |
description | Brief description of the bot | String | Max 1000 chars, Optional |
trigger | Event that triggers the bot (message , mention ) | String | Optional |
messageVisibility | Message visibility (public , private ) | String | Optional |
isAllowedInAllChatRooms | Whether the bot is allowed in all chat rooms | Boolean | Optional |
messageHistoryLimit | Limit for storing message history | Number | Optional |
webhookURL | Webhook URL for the bot | String (URI) | Optional |
metadata | Any extra metadata | String | Max 10000 chars, Optional |
enabled | Whether the bot is enabled | Boolean | Optional |
note
If the trigger
field is set to message
and the messageVisibility
is set to private
, an error will be returned.
Responses
Success Response
A JSON object containing the following fields:
Field | Description | Data Type |
---|---|---|
success | Whether the update was successful | Boolean |
bot | The updated bot object | Object |
HTTP Status: 200 OK
Body:
{
"success": true,
"bot": { /* Updated bot object */ }
}
Error Responses
Invalid API Key:
HTTP Status:
401 Unauthorized
Body:
{
"error": "Invalid API Key"
}Validation error:
HTTP Status:
400 Bad Request
Body:
{
"success": false,
"message": "Validation error",
"details": [ /* Error Details */ ]
}Bot name conflict:
HTTP Status:
400 Bad Request
Body:
{
"success": false,
"message": "Bot of the same name exists, please choose a different name or delete existing bot"
}
Code Examples
curl
curl -X PUT "https://api.deadsimplechat.com/consumer/api/v2/bot/12345?auth=<YOUR_API_KEY>" \
-H "Content-Type: application/json" \
-d '{"name": "NewBotName", "enabled": true}'
JavaScript (Fetch API)
fetch("https://api.deadsimplechat.com/consumer/api/v2/bot/12345?auth=<YOUR_API_KEY>", {
method: "PUT",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({
name: "NewBotName",
enabled: true
})
});