Skip to main content

Create Bot

info

Advanced API is available in the Business Plan

Create a new bot for chat rooms. This endpoint allows for customization of bot behaviors, including triggers and message visibility.


POST
https://api.deadsimplechat.com/consumer/api/v2/bot

Request

POST /consumer/api/v2/bot

Query Parameters

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

Body Parameters

ParameterDescriptionData TypeRequiredConstraints
nameThe name of the botStringYes
descriptionBrief description of the bot's functionalityStringNoMax 1000 characters
triggerEvent that will trigger the bot (message or mention)StringNoOne of message, mention
messageVisibilityVisibility of bot's messages (public or private)StringNoOne of public, private
isAllowedInAllChatRoomsWhether the bot is allowed in all chat roomsBooleanNo
messageHistoryLimitLimit to the number of historical messages accessible by the botNumberNo
webhookURLThe URL for the bot's webhookStringYesMust be a valid URI
metadataAdditional metadata in JSON formatStringNoMax 10000 characters
enabledWhether the bot is enabled or disabledBooleanNo

Responses

Success Response

A JSON object containing the following field:

FieldDescriptionData Type
_idThe unique ID of the created botString

HTTP Status: 200 OK

Body:

{
"success": true,
"bot": { /* Updated bot object */ }
}

Error Responses

  • Validation Error:

    HTTP Status: 400 Bad Request

    Body:

    {
    "success": false,
    "message": "invalid request",
    "error": "Detailed error description"
    }
  • Trigger and Visibility Conflict:

    HTTP Status: 400 Bad Request

    Body:

    {
    "success": false,
    "message": "Error: Bots cannot be configured to trigger on every message when message visibility is set to private. Either change the bot trigger to \"mention\" or set the message visibility to \"public\"."
    }

Code Examples

curl

curl -X POST "https://api.deadsimplechat.com/consumer/api/v2/bot?auth=<YOUR_API_KEY>" -H "Content-Type: application/json" -d '{"name": "MyBot", "description": "This is my bot"}'

JavaScript (Fetch API)

fetch("https://api.deadsimplechat.com/consumer/api/v2/bot?auth=<YOUR_API_KEY>", {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({
name: "MyBot",
description: "This is my bot"
})
})