Skip to main content

Build chatbots using Tock and Python

Project description

tock-py

Build chatbots using Tock and Python

DISCLAIMERS

  • Work in progress
  • Not production ready
  • Only support text message response.
  • not yet implemented
    • carousel / card / quickplies
    • Exposing entities to storyHander
    • Managing User / conversational context
    • Testing
    • Packaging

Prerequisites

Run a Tock bot in API mode

Create a Bot application using the web connector type in Tock Studio and get your API key

Environment

We suggest you to create an isolated Python virtual environment:

$ python3 -m venv env
$ source env/bin/activate

Install dependencies

$ make init

Usage Websocket mode

from tock.bot import TockBot

bot = TockBot()

bot.add_story('greetings', lambda send: send(text="Greetings StoryHander !!!!"))

bot.start_websocket(apikey=os.environ['TOCK_APIKEY'])

Usage Webhook mode

from tock.bot import TockBot

bot = TockBot()

bot.add_story('greetings', lambda send: send(text="Greetings StoryHander !!!!"))

bot.start_webhook(host='0.0.0.0', path=os.environ['TOCK_WEBHOOK_PATH'], port=5000)

Project details


Download files

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

Source Distribution

tock-py-0.0.1.dev0.tar.gz (10.9 kB view hashes)

Uploaded Source

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