Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including botkit-storage-firestore-v2 with all npm packages installed. Try it out:

var botkitStorageFirestoreV2 = require("botkit-storage-firestore-v2")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

botkit-storage-firestore-v2 v1.0.4

Firestore driver for Botkit. Deeper integrations, including complex and subqueries

botkit-storage-firestore Build Status

A Fork of Firebase storage module for Botkit.

This version includes support for subqueries, and complex queries. More info to come here, feel free to contact me for changes, info, etc.

Usage

Just require botkit-storage-firestore-v2 and pass it a config with a firebase_uri option. Then pass the returned storage when creating your Botkit controller. Botkit will do the rest.

Make sure everything you store has an id property, that's what you'll use to look it up later.

const admin = require('firebase-admin');
var serviceAccount = require(process.env.FIREBASE_URI);
admin.initializeApp({
    credential: admin.credential.cert(serviceAccount)
});

var db = admin.firestore();

var Botkit = require('botkit'),
    firebaseStorage = require('botkit-storage-firestore')({database: db}),
    controller = Botkit.slackbot({
        storage: firebaseStorage
    });
// then you can use the Botkit storage api, make sure you have an id property
var beans = {id: 'cool', beans: ['pinto', 'garbanzo']};
controller.storage.teams.save(beans);
beans = controller.storage.teams.get('cool');

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free