Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@lightbase/lightbot

Package Overview
Dependencies
Maintainers
2
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lightbase/lightbot

Javascript Client for Lightbot API

  • 1.0.0
  • unpublished
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
2
Weekly downloads
 
Created
Source

Lightbot.js

About

Lightbot.js is a client javascript SDK

It allows the developer to easily communicate with any lightbot agent.

Example

import { LightbotMessenger } from "lightbot";

const lightbotMessenger = new LightbotMessenger({
  hostURL: "http://localhost:9000",
  agentId: "agent-id",
});

lightbotMessenger.toggleMessenger();

lightbotMessenger.sendMessage({
  type: "plain",
  sender: "human",
  label: "Hello, I need some help!",
});

API Reference

PropertyDescriptionType
messagesMessage historyMessage
sendMessageSend a message to the serviceFunction(message: Message): void
toggleMessengerToggle messenger open stateFunction()
isOpenCurrent open stateBoolean
onChangeCalled when any primitive property gets updatedFunction(): void

Using withLightbotMessenger React HOC

Lightbot.js exports a React HOC which can be used to provide a communication interface to your React components.

import {
  LightbotMessage,
  LightbotMessengerDecoratedProps,
  withLightbotMessenger
} from "lightbot/lib/lightbot-react";

class AppDisconnected extends Component {
  render() {
    const { messages, sendMessage } = this.props;
    return (
      <Chat
        messages={messages}
        onMessageSend={sendMessage}
      />
    );
  }
}

export const App = withLightbotMessenger<AppProps>({
  hostURL: "https://localhost:9000,
  agentId: "agent-id"
})(AppDisconnected);

Injected props

withLightbotMessenger injects the same props as the one defined by the Lightbot API except the onChange is implemented in order to update your React components when any update is available.

FAQs

Package last updated on 24 Jan 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc