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
930 stars 188 forks source link

Сontext storage node #121

Closed german-st closed 6 years ago

german-st commented 6 years ago

Hello, @guidone

Is it possible to make a separate node to store the context? When using a messenger for which there is no node, we can not use context store system. For example, I use api Viber. But now it is very inconvenient, since there are no nodes to work with it (Send and Receive). But the context is very necessary in the development of flows. As I see it. A separate node is a context. Which is put after the node with a message from the api (Viber)(e.g. httpin node). There we specify which variables to assign values from msg object. After that, as usual in the flow, we can use the usual chat.get('variable_name').

How do you think this is really done? Will it work? This would greatly help with the use of third-party API. Thanks ;)

guidone commented 6 years ago

Hi, I've a beta with the Slack support and option to use a persistent storage

npm install node-red-contrib-chatbot@0.9.0-0

API.ai and Debug node not working (for the moment)

german-st commented 6 years ago

Hello, @guidone Tried to check. I hope correctly understood how it works) My example: image

In the first case, I set variable after the block conversion in function (1 number in screenshot): var chat= msg.chat(); chat.set('test',msg.test1); return msg;

In the lower chain, I again add the block conversion and in the function after(2 number in screenshot) I try to read the previously set variable. This is successful. var chat= msg.chat(); msg.result=chat.get('test'); return msg;

I chose storage context in memory. Thus, having an interrupted flow chain, we can receive context data. It is good)

image

I hope I understood correctly that this should work this way? By the way, I chose telegram transport, although in theory it does not matter which one to choose. Another question, selecting the file where it will be stored locally? Thank's

guidone commented 6 years ago

Yes this how it works.

The new context storage system works only for Slack, for Telegram, Facebook and Smooch nothing is changed. So just to recap:

screen shot 2017-11-21 at 15 21 18
{
    "path": "/web/chat-contexts"
}
german-st commented 6 years ago

Hello, @guidone FYI

I noticed that after installation npm install node-red-contrib-chatbot@0.9.0-0, there was an error when trying to write a bot. Error in the connector Telegram Receiver. Error on the screenshot. When a message arrives in a bot, it occurs.

image

Thanks

guidone commented 6 years ago

Ok I've pushed out the 0.9.0-1, not sure if this is going to fix this bug, can you copy here the error you see in the console?

german-st commented 6 years ago

Hello, @guidone

Output from the console for the version 0.9.0-0 shows the same error) image

In the version 0.9.0-1 the error did not appear. Work correctly ;)

guidone commented 6 years ago

Merged 0.9.0