Articles
Collections
Write Article
Create Collection
Import from medium
Loading...
Sign in
POSTED 03 May 2018 03:14

Webview & Dapps

OWNER
Toshi

Web3.js-enabled browser

Toshi contains a Webview into which a web3.js instance is injected and hooked into your Toshi account. When developing a DApp, you can treat it just like any other web3.js instance - there is no Toshi-specific functionality.

If you're not sure where to start with DApp development, we recommend Truffle

DApps can be launched from the Browse screen by typing the URL into the search bar.
Browse screenBrowse screenImage by: Toshi
Dapp interaction via Browse ScreenDapp interaction via Browse Screen

Linking to WebView from a Toshi App chat

You can also create buttons or menu items that open an embedded webview. Webview buttons have an action property instead of a value.

The action property should begin with Webview:: followed by the URL to open.
session.reply(SOFA.Message({
  body: "What would you like to do next?",
  controls: [
    {
      type: "group",
      label: "Trip",
      controls: [
        {type: "button", label: "Directions", action: "Webview::https://mydapp.com/#directions"},
        {type: "button", label: "Timetable", value: "timetable"},
        {type: "button", label: "Exit Info", value: "exit"},
        {type: "button", label: "Service Conditions", action: "Webview::https://mydapp.com/#service-conditions"}
      ]
    },
    {
      type: "group",
      label: "Services",
      "controls": [
        {type: "button", label: "Buy Ticket", action: "Webview::https://mydapp.com/#buy-ticket"},
        {type: "button", label: "Support", value: "support"}
      ]
    }
  ]
}))
Outline
  • Web3.js-enabled browser

  • Linking to WebView from a Toshi App chat

OWNER
Toshi