https://github.com/leesiongchan/botstream
fb messenger + rxjs + xstate = botstream
https://github.com/leesiongchan/botstream
chatbot facebook-messenger-bot observable rxjs
Last synced: over 1 year ago
JSON representation
fb messenger + rxjs + xstate = botstream
- Host: GitHub
- URL: https://github.com/leesiongchan/botstream
- Owner: leesiongchan
- License: mit
- Created: 2019-09-17T01:14:17.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2020-07-18T09:45:06.000Z (almost 6 years ago)
- Last Synced: 2025-03-15T08:12:16.699Z (over 1 year ago)
- Topics: chatbot, facebook-messenger-bot, observable, rxjs
- Language: TypeScript
- Size: 111 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# botstream
Facebook Messenger + RxJS + xstate = botstream (POC)
## Motivation
WIP
## Usage
```javascript
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?