botkit-cms icon indicating copy to clipboard operation
botkit-cms copied to clipboard

Documentation requested for using botkit-cms as component Botkit App

Open cakriwut opened this issue 6 years ago • 11 comments

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
  1. I cd to the new botkit app folder and run following command
   npm install --save botkit-cms
  1. 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

cakriwut avatar Dec 31 '18 02:12 cakriwut

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.'});
    });
  });

nick-solly avatar Dec 31 '18 15:12 nick-solly

how i access CMS

KristlyDsena avatar Jan 11 '19 10:01 KristlyDsena

how i access CMS

+1

Oxicode avatar Feb 12 '19 00:02 Oxicode

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

peterswimm avatar Feb 12 '19 15:02 peterswimm

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.

benbrown avatar Feb 12 '19 19:02 benbrown

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

GiselleCastillo5 avatar Feb 15 '19 22:02 GiselleCastillo5

@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 avatar Feb 19 '19 13:02 vitogit

@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 avatar Feb 19 '19 15:02 benbrown

@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 avatar Feb 19 '19 15:02 vitogit

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.

vitogit avatar Feb 19 '19 17:02 vitogit

Run cms and open localhost:3000/admin

npm run build npm start

how do you do this exactly???

Precioushp avatar Feb 03 '24 09:02 Precioushp