-
Notifications
You must be signed in to change notification settings - Fork 0
GreenBot Schema
Thomas Howe edited this page Apr 14, 2016
·
4 revisions
Underlying GreenBot is a Mongo database (by default named greenbot).
Scripts are the templates from which bots are created. When a script is installed in the system (by way of 'npm install python_bot' in the greenbot-core directory), the a new script document is inserted into the directory.
- default_settings : Array of settings for a bot. Each setting is an object with name, value and type.
- desc : String to describe the script type.
- icon_class : Name of Google material icon to display for script. See the site for more
- name : Name of the script. By convention, also the NPM package name
- tags : An array of text tags to identify the kind of script
- short_desc : Shorter than desc.
- repo_link : The github repo that holds the script.
- npm_pkg_name : The NPM package name of the script.
- default_cmd : The actual command that is run to start a conversation.
- owner_cmd : Same as default_cmd, but run when the owner of a bot texts in.
- default_path : Relative the root of Greenbot core, where the script is run from.
{
"default_settings" : [
{
"name" : "PROMPT_1",
"value" : "Thank you for texting in and trying out my bot!",
"type" : "text"
}
],
"desc" : "A sample bot written in Python, built for green-bot.",
"icon_class" : "build",
"name" : "python_bot",
"owner_cmd" : "",
"tags" : [
"basic",
"sample",
"python"
],
"short_desc" : "A sample bot written in Python, built for green-bot.",
"repo_link" : "https://github.com/green-bot/python_bot.git",
"npm_pkg_name" : "python_bot",
"npm_pkg_location" : "./node_modules/python_bot",
"default_cmd" : "npm start --loglevel silent",
"default_path" : "./node_modules/python_bot",
"_id" : ObjectId("570f9c922f309cce746de3e4")
}
Sessions are the result of a conversation.
- transcript : Array of messages for a conversation. Each message indicates direction (ingress|egress) and the actual text.
- src : The initiator and far end identifier of the conversation.
- dst : The destination and near end indentifier of the conversation
- sessionKey : A key that uniquely identifies the two parties in the conversation
- sessionId : A unique key for this session
- collectedData : A JSON object with each field being an element of data collected by the bot. collectedData is communicated by the bot by sending JSON to stdout. Each JSON object overwrites the previous.
- lang : The human language used by the src and far end of the conversation.
- botId : The bot ID that had the conversation
{
"transcript" : [
{
"direction" : "egress",
"text" : "Thank you for texting in and trying out my bot!"
},
{
"direction" : "egress",
"text" : "Give me something to say"
},
{
"direction" : "ingress",
"text" : "maybe\n"
},
{
"direction" : "egress",
"text" : "You said: maybe"
}
],
"src" : "1460310169341",
"dst" : "development::zwrpt7n2jcia4odk5",
"sessionKey" : "1460310169341_development::zwrpt7n2jcia4odk5",
"sessionId" : "xrJ68oAJ2hvpJigAS",
"collectedData" : {
"answer" : "maybe"
},
"updatedAt" : ISODate("2016-04-10T17:42:53.292Z"),
"createdAt" : ISODate("2016-04-10T17:42:49.496Z"),
"lang" : "en",
"botId" : "zWRpT7N2jciA4odK5",
"_id" : "xrJ68oAJ2hvpJigAS"
}
Bots are the thing that actually HAS the conversation with the far end.
- accountId : Id of the user that created and owns this bot
- addresses : An array of objects that lists the network identifiers and keywords that this bot listens for.
- description : Tell me more about your bot.
- name : The name of the bot.
- notificationEmailSubject : After a conversation is over, when we send an email, sets the subject line.
- notificationEmails : A comma separated list of destinations for the conversation email
- ownerHandles : An array of far end identifiers (srcs) that own this bot. This allows the bot to have different scripts for owners and non-owners
- postConversationWebhook : When the conversation is over, sets where we will POST the conversation JSON
- scriptId : The script ID that this bot has been copied from
- settings : An array of settings for this bot, copied from the default settings in the script. Allows the bot to have custom messages. These settings become ENV variables for the bot.
{
"_id" : "sfKnBHBZ3ZbaNzMW6",
"accountId" : "EdfWbk4Te3h3PG9YQ",
"addresses" : [
{
"networkHandleId" : "Xdc9dheccqXm6TWxJ",
"networkHandleName" : "development::sfknbhbz3zbanzmw6",
"keywords" : [
"test"
],
"network" : "development"
}
],
"description" : "A sample bot written in Python, built for green-bot.",
"name" : "python_bot",
"notificationEmails" : "[email protected]",
"postConversationWebhook" : null,
"scriptId" : ObjectId("570fc127751eeb77b78c1c63"),
"settings" : [
{
"name" : "PROMPT_1",
"value" : "Thank you for texting in and trying out my bot!",
"type" : "text"
}
],
"ownerHandles" : [ ],
"createdAt" : ISODate("2016-04-14T16:11:24.210Z"),
"updatedAt" : ISODate("2016-04-14T16:11:24.499Z")
}