Skip to main content

A CLI tool for bothub.studio service

Project description

==========
bothub-cli
==========
---------------------------
CLI tool for deploy chatbot
---------------------------

This package provides command line interface to `Bothub.studio`_ service.

Installation
============

To install bothub-cli::

$ pip install bothub-cli

or, if you are not installing in a ``virtualenv``::

$ sudo pip install bothub-cli

The bothub-cli package works on python2 and 3 both.


Getting Started
===============

Before using bothub-cli, you need to tell it about your `Bothub.studio`_ credentials.

.. code:: bash

$ bothub configure
Username: myuser
Password: mysecret

Then it stores access token on ``~/.bothub`` directory.

To start build a new bot:

.. code:: bash

$ mkdir mybot
$ cd mybot
$ bothub init
Project name: mybot

Now you have a starter echo bot::

.
|-- bothub
|   |-- bot.py
|   `-- __init__.py
|-- bothub.yml
|-- requirements.txt
`-- tests

Edit bot.py below for your purpose.

.. code:: python

# -*- coding: utf-8 -*-

from __future__ import (absolute_import, division, print_function, unicode_literals)

from bothub_client.bot import BaseBot


class Bot(BaseBot):
"""Represent a Bot logic which interacts with a user.

BaseBot superclass have methods belows:

* Send message
* self.send_message(message, chat_id=None, channel=None)
* Data Storage
* self.set_project_data(data)
* self.get_project_data()
* self.set_user_data(data, user_id=None, channel=None)
* self.get_user_data(user_id=None, channel=None)

When you omit user_id and channel argument, it regarded as a user
who triggered a bot.
"""

def handle_message(self, event, context):
self.send_message(event['content'])

and deploy it.

.. code:: bash

$ bothub deploy

You also need to configure channel to use.

.. code:: bash

$ bothub channel add telegram --api-key=<my-api-key>

Usage
=====

::

Usage: bothub [OPTIONS] COMMAND [ARGS]...

Bothub is a command line tool that configure, init, and deploy bot codes
to BotHub.Studio service

Options:
--help Show this message and exit.

Commands:
channel Setup channels of current project
clone Clone existing project
configure Setup credentials
deploy Deploy project
init Initialize project
logs Show error logs
ls List projects
nlu Manage project NLU integrations
property Manage project properties
rm Delete a project
test Run test chat session


Setup
-----

Authorize a user and get access token.

.. code:: bash

$ bothub configure


Project management
------------------

Initialize project on current directory. Create a echo chatbot code.

.. code:: bash

$ bothub init

Deploy current project.

.. code:: bash

$ bothub clone <project_name>

Clone an existing project.

.. code:: bash

$ bothub deploy

List of projects.

.. code:: bash

$ bothub ls

Delete a project.

.. code:: bash

$ bothub rm <project_name>

Show error logs.

.. code:: bash

$ bothub logs

Run current project on local machine for test.

.. code:: bash
$ bothub test


Channel management
------------------

List of channels for current project.

.. code:: bash

$ bothub channel ls

Add a channel for current project.

.. code:: bash

$ bothub channel add telegram --api-key=<api_key>
$ bothub channel add facebook --app-id=<app_id> --app-secret=<app_secret> --page-access-token=<page_access_token>

Remove a channel from current project.

.. code:: bash

$ bothub channel rm <channel>


NLU integration managemt
------------------------

List of NLU(Natural Language Understanding) integration for current project.

.. code:: bash

$ bothub nlu ls

Add a NLU integration for current project.

.. code:: bash

$ bothub nlu add apiai --api-key=<api_key>

Remove a NLU integration from current project.

.. code:: bash

$ bothub nlu rm <nlu>


License
=======

Apache License 2.0

.. _Bothub.studio: https://bothub.studio?utm_source=pypi&utm_medium=display&utm_campaign=bothub_cli


Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

bothub_cli-0.1.15-py2.py3-none-any.whl (18.5 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file bothub_cli-0.1.15-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for bothub_cli-0.1.15-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 2e657679492a00ffaf2c7b8901a02ef9c370759f002dba0a979f5971dc51ec84
MD5 c8c3035614b9833fb77da1ec712b3b6f
BLAKE2b-256 f44f25294e4ee9d3a18c43dbb921f5e8b3605e462cf3a4e42062627a0d443b2f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page