Skip to main content

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

ParameterDescriptionData TypeRequired
authGo to Dashboard -> Developer -> Private Key is your authStringYes

Request Body

The request body should contain a JSON object with the following optional fields:

FieldDescriptionData TypeConstraints
nameThe name of the botStringOptional
descriptionBrief description of the botStringMax 1000 chars, Optional
triggerEvent that triggers the bot (message, mention)StringOptional
messageVisibilityMessage visibility (public, private)StringOptional
isAllowedInAllChatRoomsWhether the bot is allowed in all chat roomsBooleanOptional
messageHistoryLimitLimit for storing message historyNumberOptional
webhookURLWebhook URL for the botString (URI)Optional
metadataAny extra metadataStringMax 10000 chars, Optional
enabledWhether the bot is enabledBooleanOptional
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:

FieldDescriptionData Type
successWhether the update was successfulBoolean
botThe updated bot objectObject

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
})
});