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

How to create video upload node #82

Closed VitorGiam closed 7 years ago

VitorGiam commented 7 years ago

Hi, I'm trying to create a node to send videos to fb messenger, I already tried to send in Payload following the pattern of Json example of FB, like that link: https://developers.facebook.com/docs/messenger-platform/send-api-reference/video-attachment

Can someone help me?

Thanks!

guidone commented 7 years ago

@VitorGiam I'm working on it

VitorGiam commented 7 years ago

I liked your project, I'm going to use it in production. I would like to help you develop missing modules such as carousel, send video and webview. I have a team that can help you. If you are interested, I can talk more about this contribution through messenger. What do you think?

guidone commented 7 years ago

@VitorGiam I'd love that.

The video node is almost ready, I'll send you a beta tomorrow

fabianoleittes commented 7 years ago

Hi @guidone, how are you? First all, nice work. I and @VitorGiam work together on @sciensa a Brazilian company, we are using their project, which is very cool, we want to contribute to the project. Do you have a contributing code? How do you test?

How do you do to develop local and test with Facebook? Do you use ngrok? Could you tell us a bit about your setup?

guidone commented 7 years ago

Hi @VitorGiam I've a beta for the video node, can you help me testing it?

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

Thanks

guidone commented 7 years ago

@fabianoleittes Hi, I'm fine and thanks for using red bot.

Yes, I accept pull requests. RedBot is still a work in progress so it's welcome a bit of coordination to avoid duplication of works.

I generally use Telegram for the development, it's easier to setup, this is also the reason many features for Messenger are yet not implemented.

Yes I've tests, I use mocha, to test locally npm test and I lint the code before pushing it with npm run lint. Nodes are generally very simple, all the code for the specific platform are in /lib/ and chatbot--receiver.js nodes. The general rule of thumb with NodeRed is that a node should do the minimum, don't let a node do a task that can be done with two nodes. The more granular are the nodes the easier is to compose the flows.

I don't have a public roadmap yet, I'll open a wiki page in the next few days, for sure it includes Facebook cards and buttons, Slack support, email support and of course payment support.

VitorGiam commented 7 years ago

Hi, I'll test more closely. And then I'll chat you

fpsimonee commented 7 years ago

@guidone I'm a member of a Team of @fabianoleittes and @VitorGiam. Tomorrow me and the rest of Team test your feature.

Thank you man.

fpsimonee commented 7 years ago

@guidone I'm test your feature, but I need to change your code in facebook helper, in function upload Buffer, the type is setted in IMAGE, I change to params.type and I was able to send videos.

captura de tela de 2017-06-28 12-02-15

I was left with a question, can I upload videos only if I have their path?

captura de tela de 2017-06-28 12-05-42

Thanks man.

guidone commented 7 years ago

@fpsimonee this is common pattern to initialize an object with default values, that line does not change the final content of params.type

params = {type: 'my_type'};
params = _.extend({type: 'another_type'}, params);
// params.type == 'my_type'

I suspect that the wrong type was passed by the parent function, I've tried your flow and it works, even if at the beginning I got an error that I was not able to replicate anymore, perhaps the problem is there.