botkit-cms
botkit-cms copied to clipboard
Documentation requested for using botkit-cms as component Botkit App
Hi,
I tried to follow starting guide - adding botkit-cms as component in Botkit App. Unfortunately I can not make it works. Here are my steps:
- I install botkit and create by first botkit app
npm install -g botkit
botkit new --platform web
- I cd to the new botkit app folder and run following command
npm install --save botkit-cms
- I modify bot.js , and add following lines:
var controller = Botkit.socketbot(bot_options);
var cms = require('botkit-cms')();
cms.useLocalStudio(controller);
cms.loadScriptsFromFile(__dirname + '/scripts.json'); // How I can get scripts.json ??
I believe I don't see any scripts.json , and I am not sure if my understanding to register new component is correct. Would anyone help me and guide me what should I do to configure botkit-cms web?
Thanks.
Riwut
You could copy the file botkit-cms/.data/sample_scripts.json
from the library to your project root as scripts.json
.
I also then had to add a block in the skills folder to actually use the Studio scripts:
controller.on('message_received', function(bot, message) {
controller.studio.runTrigger(bot, message.text, message.user, message.channel).catch(function(err) {
bot.reply(message, {text: 'Sorry, I don\'t understand.'});
});
});
how i access CMS
how i access CMS
+1
@KristlyDsena @Oxicode can you be more specific in your questions?
I'm not sure if this is answering your question, @Oxicode @KristlyDsena, but when run as a local component, you do not get the CMS UI. You would run a separate instance of the stand-alone CMS to get the editor UI.
helpp with that, do you know a command of how to start botkit CMS?
@GiselleCastillo5 @Oxicode @KristlyDsena Clone and install botkit-cms
git clone https://github.com/howdyai/botkit-cms.git
cd botkit-cms
npm install
Create an .env file from .env_sample and paste content
cp .env_sample .env
PLATFORM=web
TOKENS=youwillneverguessmysecretbottoken
USERS=admin:123secret
Create .data folder, create a scripts.json inside. Copy the content from sample-scripts.json
mkdir .data
cp sample_scripts.json .data/scripts.json
Run cms and open localhost:3000/admin
npm run build
npm start
Enter the credentials from env vars (admin 123secret)
@vitogit this is mostly correct, though you would not want to put the environment variables in your .bash_profile -- that would make them available to all applications you run. They should live in the environment only for that app -- either in the .env file, or in some other secure key manager provided by your hosting environment.
@benbrown agree, I updated my answer. This was just me trying to hack some bot really quick, I didn't saw the .env_sample file.
I created a PR in case that info could be useful to others https://github.com/howdyai/botkit-cms/pull/15 but I couldn't add a reviewer.
Run cms and open localhost:3000/admin
npm run build npm start
how do you do this exactly???