Botmetrics Data Models
Botmetrics uses Postgres as its main data store and here are the different models that it uses:
- User: A User is a Devise backed model that deals with user authentication.
- BotCollaborator: BotCollaborator is a join table used to form a relationship between a Bot and a User. A user can invite other users as collaborators to view metrics on the same bot and each time that happens a new
BotCollaborator
entry is created. (A Userhas_many
Botsthrough
BotCollaborators). - Bot: A Bot is the model that backs a new "bot project" that a user might create. If you have Facebook, Slack and Kik bots, you will create three separate bots for each.
- BotInstance: A BotInstance is a model that
belongs_to
a Bot. The significance of aBotInstance
varies on the platform. For Slack, every time a new team signs up to use your bot, a newBotInstance
record is created. On Facebook and Kik, only a singleBotInstance
exists per bot. - BotUser: A BotUser is a model that
belongs_to
a BotInstance. A BotUser represents all of the users that interact with your bot on that platform. - Event: An Event is a model that
belongs_to
both BotInstance and BotUser. An event represents a "metric" on Botmetrics. Every time a message is sent to/from the bot (or in the case of Slack, a message that is being transmitted in a channel that the bot has access to), or an image upload, etc. is tracked in theEvent
model. - Dashboard: A Dashboard is a model that
belongs_to
a Bot. A dashboard is created every time a user creates a custom dashboard to track a custom metric. - DashboardEvent: A DashboardEvent acts a join model between
Dashboard
andEvent
. Whenever a new event is created, if it matches the conditions of the custom dashboard, aDashboardEvent
entry will be created to store the relationship between the Dashboard and the Event. (A Dashboardhas_many
Eventsthrough
DashboardEvents).
Updated less than a minute ago