Foundation for building a Javascript app for Toshi (Chat Bot / Web View) with configurations for Docker and Heroku
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
attachments
bin
config
dependencies
docs/images
examples
gradle/wrapper
src
.gitignore
Dockerfile
LICENSE
Procfile
README.md
app.json
build.gradle
currency.json
docker-compose.yml.sample
gradlew
gradlew.bat
package.json
system.properties
yarn.lock

README.md

Toshi SOFA App

This repo helps you build a Toshi app in Javascript.

The sample bot can:

  • send messages
  • send and request money
  • create simple UI for buttons and menus
  • store sessions and state for each user

TODO

  • sending image messages
  • creating web view UIs

Launch your own Toshi app in 5 minutes

Read our guide to creating a Toshi app.

When ready, fork this repo and deploy it to Heroku.

Deploy

Then check out src/bot.js to start changing the bot logic.

Running locally with Docker

You can run the project locally with

docker-compose up

If any new depencies are added you can rebuild the project with

docker-compose build

To reset the postgres database in your dev environment you can use

docker-compose down -v

Architecture

Deploying a Toshi app requires a few processes to run:

  • toshi-headless-client
    This is a client we provide (similar to the iOS or Android client) that provides a wrapper around the Toshi backend services. It also handles end-to-end encrypting all messages using the Signal protocol. It is written in Java and runs in the background, proxying all the requests to and from your bot.
  • redis
    We use redis pub/sub to provide a connection between the toshi-headless-client and your bot.
  • bot.js
    This is where all your app logic lives.
  • postgres
    Postgres is used to store session data so you can persist state for each user who talks to your bot (similar to cookies in a web browser).

diagram

See also


Copyright © 2017-2018 Toshi Holdings Pte. Ltd. <https://www.toshi.org/>

"Toshi" is a registered trade mark. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor.

This software licensed under the MIT License.