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

Possible to add more message templates for facebook? #88

Closed jasminejasmine closed 7 years ago

jasminejasmine commented 7 years ago

It's great to have button quick replies for facebook. However, there are also many other facebook templates, like generic template, list template, etc. Can you please add the message formats for such templates? I believe that will be helpful for many people. Thanks.

guidone commented 7 years ago

Yes! I'm working on it

jasminejasmine commented 7 years ago

@guidone Great to hear that! May I know any timeline for this? Thanks

metabaron commented 7 years ago

Please do it :) I tried to "emulate" the correct code through the use of a "function" from Node Red but it seems there is something that I do not understand hence it's not working.

Thank you and good work here mate !! some typos here and there but hey, the code works

guidone commented 7 years ago

@jasminejasmine @metabaron I'm working on it, I think I've found a UI solution for both buttons, template and the horizontal carousel

I'll keep you posted with a beta as soon as it's usable

metabaron commented 7 years ago

Oh cool, good news then. Don't forget to let us all program that through a "msg.payload" injection please :) as I do most of my processing before using the buttons (and I'm sure I'm not the only one here)

guidone commented 7 years ago

@metabaron would you like to give it a try?

npm install node-red-contrib-chatbot@0.8.0-beta-1

What's new

metabaron commented 7 years ago

Ok, let me try it:

npm install node-red-contrib-chatbot@0.8.0-beta-1
npm WARN node-red-project@0.0.1 No repository field.
npm WARN node-red-project@0.0.1 No license field.

+ node-red-contrib-chatbot@0.8.0-beta-1
added 151 packages, removed 14 packages and updated 1 package in 23.713s
$node-red
26 Jul 15:40:50 - [info] 

Welcome to Node-RED
===================

26 Jul 15:40:50 - [info] Node-RED version: v0.17.5
26 Jul 15:40:50 - [info] Node.js  version: v8.2.1
26 Jul 15:40:50 - [info] Darwin 16.7.0 x64 LE
26 Jul 15:40:51 - [info] Loading palette nodes
26 Jul 15:40:53 - [warn] ------------------------------------------------------
26 Jul 15:40:53 - [warn] [rpi-gpio] Info : Ignoring Raspberry Pi specific node
26 Jul 15:40:53 - [warn] ------------------------------------------------------
26 Jul 15:40:53 - [warn] Missing node modules:
26 Jul 15:40:53 - [warn]  - node-red-contrib-browser-utils (0.0.5): fileinject, microphone, camera
26 Jul 15:40:53 - [warn]  - node-red-contrib-play-audio (2.0.1): play audio
26 Jul 15:40:53 - [info] Removing modules from config
26 Jul 15:40:53 - [info] Settings file  : /XXXXXXXXXX/.node-red/settings.js
26 Jul 15:40:53 - [info] User directory : /XXXXXXXXXX/.node-red
26 Jul 15:40:53 - [info] Flows file     : /XXXXXXXXXX/.node-red/flows_XXXXXXXXXX.local.json
26 Jul 15:40:53 - [info] Creating new flow file
26 Jul 15:40:53 - [info] Starting flows
26 Jul 15:40:53 - [info] Started flows
26 Jul 15:40:53 - [info] Server now running at http://127.0.0.1:1880/

Seems all good, writing some quick and dirty code and I'll come back to you hopefully within the next hour.

metabaron commented 7 years ago

Not sure if it's me but the whole thing seems slower to go FROM Facebook TO the Node-Red and FROM the Node-Red TO Facebook.

[{"id":"5352b52b.396a2c","type":"chatbot-inline-buttons","z":"1714cf30.8cfd01","name":"Test button","buttons":[{"type":"url","label":"Button URL 1","url":"http://googleTest1.com","webViewHeightRatio":"tall","extensions":false,"answer":"","alert":false},{"type":"postback","label":"Button postback","value":"Value 5","answer":"","alert":false},{"type":"call","label":"Button phone","number":"123456"},{"type":"login","url":"http://www.googleTest2.com"},{"type":"logout"},{"type":"newline"},{"type":"url","label":"Button URL 2","url":"http://googleTest3.com","webViewHeightRatio":"tall","extensions":false,"answer":"","alert":false}],"message":"This is the message","x":391,"y":194,"wires":[["c52bcd71.83bae"]]}] NOTE: Button message not centred on my Android phone Facebook messenger application

Error message:

"(#105) param name_placeholder[buttons] has too many elements." NOTE: Seems like the limit it 3 buttons and from what I can see not information about that in the documentation of the button. All button works as expected.

Note: The template button do not mention the size MAX of the image, it should ;) The carrousel of generic templates works

Congrats, everything else is ok.

guidone commented 7 years ago

@metabaron Thanks for the feedback!

  1. I'll check with your JSON but I guess that if the button is not centered is a glitch in the Android client
  2. Yes the limit is 3 buttons, I'm updating the docs, there also a validation in the node, trying to use more that 3 buttons the button looks like schermata 2017-07-26 alle 15 57 13
  3. About this:

The template button do not mention the size MAX of the image, it should ;)

Do you mean the image in the Generic Template or Quick Replies? I didn't find any image limitation in the Generic Template. I still have to implement the attributes sharable and image_aspect_ratio

metabaron commented 7 years ago

I understand that the display will show an error but honestly I think most of the people have no idea what the triangle and the circle means (and it took me a while to notice and understand them when I started playing around with Node Red). Just saying :)

For the MAX size, I was talking about generic template. I took the google landing page logo as an image and under my Android Facebook messenger, only maybe 2/3 of it is visible, like the left and right part of it are not visible.

guidone commented 7 years ago

Yes it's not immediate, but it's how Node-RED works, there was a discussion about that here https://github.com/node-red/node-red/issues/557, basically their philosophy is to allow the user to save a node in any case even if the configuration is not validated and the alert for possible misconfiguration the moment the flow is deployed

The second problem I think will be solved by the Generic Template's param image_aspect_ratio that I'm going to add

metabaron commented 7 years ago

Ok cool

fpsimonee commented 7 years ago

@guidone Hi, I working with your project, and I have to use list template. I test your beta version and not found this template. You planning to add this ? You'd like help for do this?

guidone commented 7 years ago

Yes I'll add it, not sure if I'll release in 0.8.0 or next iteration, but soon!

Il 27 lug 2017, 20:00 +0200, Felipe Paiva Simone notifications@github.com, ha scritto:

@guidone Hi, I working with your project, and I have to use list template. I test your beta version and not found this template. You planning to add this ? You'd like help for do this? — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

guidone commented 7 years ago

@fpsimonee you have it, install this

npm installnode-red-contrib-chatbot@0.8.0-beta-2

There are still some docs and tests to write

fpsimonee commented 7 years ago

@guidone Hi, I will install this and test, thank you!

guidone commented 7 years ago

This is merged in 0.8.0

Thanks everyone for the feedbacks