0.0.10 • Published 5 years ago

@leesiongchan/botstream v0.0.10

Weekly downloads
10
License
MIT
Repository
github
Last release
5 years ago

botstream

Facebook Messenger + RxJS + xstate = botstream (POC)

Motivation

WIP

Usage

import botstream, { messageEvent$ } from '@leesiongchan/botstream';

const bot = botstream({
    facebookAccessToken: '1234',
    facebookApiVersion: 'v4', // Optional, default = 'v4'
    facebookVerifyToken: '2345',
    port: 3000,
});

const echoConvo$ = messageEvent$.pipe(say(ev => `Echo: ${ev.message.text}`));
const helloConvo$ = event$.pipe(
    hears(['hello'], 'message'),
    say('Ok, hello! How can I help you?'),
);

bot.loadSkills(echoConvo$, helloConvo$);

APIs

botstream

  • botstream(config: BotstreamConfig)
  • loadSkills(skills: Observable[]): void
  • server A Fastify server.

Observables

  • event$
  • eventReplay$
  • messageEvent$
  • postbackEvent$

Operators

  • ask
  • hears
  • say
  • sendButtonTemplate
  • sendGenericTemplate
  • sendQuickReplies
  • showSenderAction

TODO

  • xstate Integration
  • Support multiple channels?
0.0.10

5 years ago

0.0.9

5 years ago

0.0.8

5 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago