aichaos / rivescript-js

A RiveScript interpreter for JavaScript. RiveScript is a scripting language for chatterbots.
https://www.rivescript.com/
MIT License
377 stars 144 forks source link

Any plan for a Slack adapter? #44

Closed mfornasa closed 9 years ago

mfornasa commented 9 years ago

Do you have any plan for a Slack adapter? Or: does the code provide entry points to write an adapter?

kirsle commented 9 years ago

The rivescript-js module won't add code for a Slack adapter as it's outside of the scope; this project is purely for the chatbot logic component for letting people build their own bots.

However, I could add a minimalistic example to the eg/ directory that shows what's needed to interface with Slack. It wouldn't be a full production-ready bot, but would show the minimal code needed for it. I'll look into this when I get some time.

As for entry points: RiveScript should be easily pluggable into any system. So if you write code for the Slack API (i.e. with node-slack-client) and get to the point where you have a message from a user and want a bot's reply to it.... send that message into RiveScript with var reply = rs.reply(slackNick, slackMessage); and post the response back to the Slack API.

kirsle commented 9 years ago

I've added an example for connecting RiveScript to Slack: https://github.com/aichaos/rivescript-js/tree/master/eg/slack-bot

mfornasa commented 9 years ago

It seems to work very well, thanks!