Bots Data Model
Description
Bots initialize routines and can be triggered either through a survey or slash command. The COTBot data model contains the bot's settings and corresponding parametrized bot (routine stages).
JSON Sample
{
"_id": "618a69512c7cae88b3aa2fe3", //ObjectId<COTBot>
"commands": [
{
"_id": "618a695a6359f4e3aef2f5a8", //Command ObjectId
"isActive": true,
"isSlash": true,
"isSurvey": false,
"slashCmd": "sendemail",
"surveyIds": []
}
],
"company": "618a696218446b289ab7b847", //ObjectId<COTCompany>
"createdAt": "2021-05-12T18:24:20.405Z",
"description": "Send an automated email",
"global": true,
"isActive": true,
"name": "Send Email",
"parametrizedBot": { //COTParametrizedBot
"maxIterations": 2,
"stages": [
{
"_id": "618a6968eec811dbba542170", //Routine stage objectId
"key": "email",
"name": "PBEmail",
"version": null,
"data": {
"subject": "Hey! We need to talk to you.",
"content": {
"recipientName": "",
"recipientEmail": "",
"companyName": "ACME",
"title": [
"Your team is looking for you."
],
"action": "",
"code": "",
"messageA": "$JOIN# #Your presence is requested in the #($VALUE#channel|nameDisplay)# channel.",
"messageB": ""
},
"targets": [
"$VALUE#cmdArgs"
]
},
"next": {
"DEFAULT": "message"
},
"customNetworkRequest": []
},
{
"_id": "618a6974b4b9f668deab7b3e", //Routine stage objectId
"key": "message",
"name": "PBMessage",
"data": {
"content": "📩 Email sent ✅",
"contentType": "text/system",
"sentBy": "$VALUE#user|_id",
"channelIds": "$VALUE#channel|_id"
},
"next": {},
"customNetworkRequest": []
}
],
"start": "email",
"version": "v3"
},
"version": 3
}
Fields
Field | Description | Type | Note |
---|---|---|---|
_id | System generated bot ID. | ObjectId<COTBot> | |
commands | Bot trigger settings. | object[ ] | |
commands[index]._id | System generated command object ID. | ObjectId | |
commands[index].isActive | boolean | if false, setting will not be used. | |
commands[index].isSlash | Indicates if the bot is triggered by a slash command or not. | boolean | |
commands[index].isSurvey | Indicates if the bot is triggered by a survey or not. | boolean | |
commands[index].slashCmd | Indicates the string that, along with a preceeding slash, triggers the bot, e.g., /string . | string | isSlash must be true . |
commands[index].surveyIds | Points to the surveys that trigger that bot. | [ObjectId<COTSurvey> ] | isSurvey must be true . |
company | The ID of the company the bot is found in. | ObjectId<COTCompany> | |
createdAt | Indicates when the bot was created. | ISODate | YYYY-MM-DDTHH:mm:ss.SSSZ |
description | A brief description of what the bot does. | string | |
global | Indicates if the bot is available globally, i.e., in all the channels of the company. | boolean | |
isActive | Indicates if the bot is active or not. | boolean | |
modifiedAt | Indicates the last time the property's configuration was modified. | ISODate | YYYY-MM-DDTHH:mm:ss.SSSZ |
name | string | ||
parametrizedBot | Contains the routine that is set off by the bot. | COTParametrizedBot | |
version | Indicates the current version of the bot tool. | number | The version should be set at 3 . |
Deprecated
Field | Description | Type | Note |
---|---|---|---|
__v | System generated version. | DEPRECATED | |
commands[index].showHelp | boolean | DEPRECATED | |
commands[index].description | string | DEPRECATED | |
commands[index].arguments | [ ] | DEPRECATED | |
extraData | string[ ] | DEPRECATED | |
process | string | DEPRECATED |
Additional Resources
- Bot Section: Bot administrative panel settings
- Create a Bot Tutorial: Tutorial on how to create a bot
- API documentation in Swagger: complete with data models (schemas)
- COTLang: use COTLang for extracting data from models in routines
- Triggers and Contexts: more information on using data models within routines
Help
- Cotalker Platform Community: post your questions or search for previous answers given in the forum