Skip to content

urban-bot/urban-bot-starter-javascript

Repository files navigation

Urban Bot Starter

Develop chatbots with zero configuration using javascript. If you want to use typescript use ts starter.

Launch

npx create-urban-bot my-app --template js

Telegram

  1. Get telegram token
  2. Paste token to .env TELEGRAM_TOKEN=YOUR_TOKEN
  3. Uncomment // import './render/telegram'; inside src/index.ts
  4. Run npm run dev and check your bot

Discord

  1. Get discord token
  2. Paste token to .env DISCORD_TOKEN=YOUR_TOKEN
  3. Uncomment // import './render/discord'; inside src/index.ts
  4. Run npm run dev and check your bot

Slack

  1. Create slack app
  2. Paste token to .env SLACK_TOKEN=YOUR_TOKEN
  3. Paste signing secret to .env SLACK_SIGNING_SECRET=YOUR_SIGNING_SECRET
  4. Run npm run start-tunnel and connect the public url with slack webhook.
  5. Uncomment // import './render/slack'; inside src/index.ts
  6. Run npm run dev and check your bot

Facebook

  1. Create facebook app
  2. Paste credentials to .env
  3. Run npm run start-tunnel and connect the public url with facebook webhook.
  4. Uncomment // import './render/facebook'; inside src/index.ts
  5. Run npm run dev and check your bot

Scripts

npm run build

Build your code to dist folder.

npm run dev

Build and start your code after every code changes. Settings are inside package.json nodemonConfig.

npm run lint

Check code style. All rules are inside .eslintrc.js.

npm run lint:fix

Fix code style issues automatically including prettier formatting.

npm run start

Start code from dist folder.

npm run start-tunnel

Start a public URL for exposing your local server.

npm run test

Start your tests. File matching *.test.(js|jsx).

Import files

You could import any file and paste to components as buffer or stream. It will be automatically added to dist bundle.

import image from './assets/logo.png';
import doc from './assets/document.doc';

function App() {
  return (
    <>
      <Image file={image} />
      <File file={fs.readFileSync(doc)} />
    </>
  );
}

About

Quick start to write chatbots with urban-bot and javascript.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published