guidone / node-red-contrib-chatbot

Visually build a full featured chat bot for Telegram, Facebook Messenger, Whatsapp and Slack with Node-RED. Almost no coding skills required.
http://red-bot.io
933 stars 189 forks source link

Enhancement Request: Context Node Set from msg, etc #92

Closed TotallyInformation closed 7 years ago

TotallyInformation commented 7 years ago

The Context node should be able to set a context variable based on the input message for when the bot is initiating a conversation (e.g. from a web interface or alert). It should use the same capabilities as the Node-RED native change node (e.g. msg.xxxx, global, flow, JSONata).

guidone commented 7 years ago

@TotallyInformation ok basically the feature requests are two

  1. be able to manipulate the chat context programmatically by passing some input parameters to the context node (if I've understood correctly). This is redundant, since it's possible to do that in a simple function node (after a conversation node for example)
var context = msg.chat();
context.get('my_key');
context.set('another_key', 42);
return msg;

And yes there's some missing documentation here https://github.com/guidone/node-red-contrib-chatbot/wiki/Chat-Context I'll improve it.

  1. Implementing the Context node like the default Change node. It's a pretty complex node, and I think it's not strategic for the chatbot ecosystem right now (compared to extending the support for Facebook Messenger or Telegram payments for example). I rather try a way to extend the Change node in order to accept different contexts (in addition to msg, context, flow) rather than duplicate the functionality of it just for the chat context. Perhaps there's a way to extend the node or propose a PR to the Node-Red guys, I'll look into it