guidone/node-red-contrib-chatbot

Feature request: Split buttons/ quickReply for readability

Closed this issue · 3 comments

I'm working on a fork of your project. I'm trying to make payload buttons behave like the below picture. My motivation is for the flows to have better readability when using postback. Instead of specifying the payload your self and create a rules node to capture the response, you can just get the Id of the connected nodes and send message to the correct port.
image

Steps I have taken so far:
I've tried to custom the chat-platform to send message directly to buttons node but fail because I can't get node.chat (ChatServer) from buttons nodes.
I'm now trying to emit events and receive using the RED.events likes Output nodes.
What do you think about this feature @guidone ? Can you give me some pointers on how to make this?

I'm happy to create a pull request after I'm done.

Hi @namph-sgn , it cuould be interesting.
The whole project is following the principle of the minimum atomic action, each node should only take care of the smallest atomic action it can be accomplished.
The reason for that is because a dev could have to do something between definition of the buttons and the node that actually sends them or just after it (i.e. a timeout or a follow up or send through another channel, etc).
I don't want to give up this principle, it will break the compatibility, but I understand this is a very common use case.

I need to think a little about the best way to get this, so far the best I can think of is adding a checkbox at the bottom of the configure panel (something like "send buttons" or "wait for answer") which is actualy sending the buttons to the same bot the message came from and show the outputs related to the postbacks.

This will save the principle, is backward compatible and the UX it's just a click on a checkbox.

Hello @guidone,
I understand your point about the atomic principle and I have every intents to abide by them. The use cases you suggest is also very common.
I have been trying to emit the events using RED.events and have got a working prototype. I will try the ideas you suggest next and comment on this issue when I'm done.
In the mean time, if you come up with any ideas, feel free to comment, I will make sure to try them.

I may have a solution for this, under testing, this is the docs:

https://www.notion.so/redbot/Buttons-node-b8f3ea33948049cca7b94491061183f4