howdyai / botkit-cms

An open tool for designing, building and managing interactive dialog systems
https://botkit.ai
MIT License
265 stars 92 forks source link

Documentation requested for using botkit-cms as component Botkit App #8

Open cakriwut opened 5 years ago

cakriwut commented 5 years ago

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:

  1. I install botkit and create by first botkit app
    npm install -g botkit
    botkit new --platform web
  2. I cd to the new botkit app folder and run following command
    npm install --save botkit-cms
  3. 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

nick-solly commented 5 years ago

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.'});
    });
  });
KristlyDsena commented 5 years ago

how i access CMS

Oxicode commented 5 years ago

how i access CMS

+1

peterswimm commented 5 years ago

@KristlyDsena @Oxicode can you be more specific in your questions?

benbrown commented 5 years ago

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.

GiselleCastillo5 commented 5 years ago

helpp with that, do you know a command of how to start botkit CMS?

vitogit commented 5 years ago

@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)

benbrown commented 5 years ago

@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.

vitogit commented 5 years ago

@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.

vitogit commented 5 years ago

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.

Precioushp commented 7 months ago

Run cms and open localhost:3000/admin

npm run build npm start

how do you do this exactly???