Instance API

When querying an individual instance object bot, user or flow.

AttributeDescription
get(key)Get the value associated with the key.
Returns any data type.
set(key, value)Store the provide value along with the key.
idProvides the unique id of the give scope instance as a string.
Can be used to retrieve objects in another context.
all()Returns all of the data for the instance.
update(data)Updates one or more values for the instance,
but does not overwrite other values.
put(data)Overwrites the data for the instance object.
The bot data will only comprise of what was included in the put.
self.db.user.get('name')
"Nikola"
self.db.flow.set('order', 'Pizza')
{
  'id': "Rxxxxxxx",
  'order': "Pizza"
}
self.db.bot.id
"B0123456789"
self.db.user.all()
{
  'id': 'Uxxxxxxxxx',
  'name': 'Nikola',
  'dob': 'July 10, 1856'
}
self.db.bot.update({'alive': True})
{
  'id': 'Bxxxxxxxxx',
  'timezone': "Canada/Eastern",
  'alive': True
}
self.db.bot.put({'awesome': True, 'alive': True})
{
  'id': 'Bxxxxxxxxx',
  'awesome': True
  'alive': True
}