npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

botfuel-webchat-client

v3.25.1

Published

Botfuel webchat client designed to work with bots made with Botfuel Bot SDK. For a more detailed documentation, see https://app.botfuel.io/docs.

Downloads

111

Readme

Botfuel Webchat Client

Botfuel webchat client designed to work with bots made with Botfuel Bot SDK. For a more detailed documentation, see https://app.botfuel.io/docs.

We provide a HTTP poll fallback if websockets are not supported by the browser.

Install

<script> tag using CDN

jsDelivr is a global CDN delivery for JavaScript libraries.

To include the latest release:

<script src="https://cdn.jsdelivr.net/npm/botfuel-webchat-client"></script>

For older releases:

<script src="https://cdn.jsdelivr.net/npm/[email protected]"></script>

Then add the following script on your page:

BotfuelWebChat.init({
    appToken: '<BOTFUEL_APP_TOKEN>'
});

Note: Register and create an app on https://app.botfuel.io to get a <BOTFUEL_APP_TOKEN>.

For development, you can also provide a custom backend:

BotfuelWebChat.init({
    appToken: '<BOTFUEL_APP_TOKEN>'
    serverUrl: 'http://localhost:7001'
});

Technologies

We mainly use:

  • React.js: UI building library
  • Syled-components: CSS-in-JS library for styling React UI components
  • Apollo: Execute GraphQL queries and subscriptions to the webchat server (https://webchat.botfuel.io).
  • Webpack: development and production builds

Development

To launch a development server, run:

yarn
yarn start

It will launch a webpack dev server.

Build for production

To build a production optimized for production, run:

yarn build:production

this is useful for testing bundle size or issues that only happen in production. It is executed by the npm publish command (prepublish hook).

Publishing

To publish package on NPM and jsdelivr, simply bump the version (according to semver) and publish it:

npm version <patch, minor, major>
npm publish

The script will automatically be available on jsdelivr.

Links in messages

By default, webchat-client automatically parses links. Links such as https://www.botfuel.io will appear as clickable anchor tags in messages.

HTML

It is possible to display HTML in messages by turning on the parseHTML option. By default it’s turned off. Dangerous HTML tags are filtered.

Useful development notes

We use Fragment on the payload field in the Message query in the WebChat/index.jsx file because it can be of several types: Text, Table, Actions, Postback, Quickreplies, BotAction and Images. The type of payload define which fields are available on it. These types are defined server-side.

In the same file, we use optimiticResponse (Apollo) when sending the use message so we immediately update UI with the message sent instead of waiting for the server’s response. This provides a better UI experience where the user can immediately see the message he typed and entered.

License

See the LICENSE file.