Cloudkibo / KiboPush

0 stars 1 forks source link

Endpoint to handle attachment url #8342

Closed ImranBinShoukat closed 4 years ago

ImranBinShoukat commented 4 years ago

In this task, we will create an endpoint to handle attachment url. It should be able to do the following:

  1. If url is a YouTube link and size is less then 25MB then extract the video, upload on fb, and send the attachment id back to client
  2. If url is a YouTube link and size is greater than 25MB then fetch its meta data and send the response back to client
  3. If its some other url then fetch its meta data and send the response back to client

For further info please refer to design document: https://docs.google.com/document/d/12-4bLH4ZE8dM12_uxT74q8opmkPpFUEXY_ZuQk-_MEs/edit#

sojharo commented 4 years ago

I have worked on this and this is under construction. I need to discuss few logic points on this with imran as logic to download the video and upload to facebook is already available on accounts server for broadcast feature youtube component.

sojharo commented 4 years ago

@ImranBinShoukat I have completed the work on this. Please test after merging.

ImranBinShoukat commented 4 years ago

I have tested this. Sometimes it is giving error when I provide youtube link.

Screenshot 2020-04-15 at 8 39 05 PM Screenshot 2020-04-15 at 8 40 25 PM

@sojharo please look into this

sojharo commented 4 years ago

I have tested it with several videos. I am not able to reproduce this. I think this must be due to Internet glitch. In such case, we can show on UI that video upload failed, please try again. But I think this might only happen on localhost due to slow internets we have. This might not occur on digital ocean droplets.

@ImranBinShoukat Please suggest.

ImranBinShoukat commented 4 years ago

It is giving error "Failed to fetch youtube video info"

Screenshot 2020-04-17 at 5 38 17 PM

@sojharo please look into this

sojharo commented 4 years ago

@ImranBinShoukat I have fixed the problem on attachment now. Please test on staging:

Here are the screenshots of server response on attachment:

Screenshot 2020-04-20 at 4 46 18 PM

On following screenshot, it shows that it says URL is valid

Screenshot 2020-04-20 at 4 46 27 PM

However, the UI is not showing undefined.

ImranBinShoukat commented 4 years ago

Tested. Working fine on staging

ImranBinShoukat commented 4 years ago

Since, #7459 is complete, please add the Facebook video code in chatbot automation too.

sojharo commented 4 years ago

I started work on this yesterday and it is under construction. For some videos, it is giving me errors that video doesn't belong to the page. I am working more on this today.

jekram commented 4 years ago

Please check if it is a requirement that the Video belongs to that page

sojharo commented 4 years ago

Any facebook video which is public can be used.

I have completed the work on this. @ImranBinShoukat please test after review.

ImranBinShoukat commented 4 years ago

Tested this. There are couple of issues here:

  1. It is not accepting this url https://web.facebook.com/144227143333/videos/221806225768784/?_rdc=1&_rdr
  2. Also, for private videos it should say that video is private. So that we can display a message on client that this can not be sent
jekram commented 4 years ago

@sojharo This is crital for us

sojharo commented 4 years ago

Also, for private videos it should say that video is private. So that we can display a message on client that this can not be sent

I have fixed the above error. In response, server will say "Video is private" in description for all the facebook private video URLs.

It is not accepting this url https://web.facebook.com/144227143333/videos/221806225768784/?_rdc=1&_rdr

I have also fixed the above error and it will accept these type of facebook video URLs as well.

Now you can test it.

@ImranBinShoukat Please merge my pull request and test on staging.

sojharo commented 4 years ago

@ImranBinShoukat as per our discussion, I have fixed the image and video problems and also now I am sending the private video message as 500 error message as required. Please test now on staging.

ImranBinShoukat commented 4 years ago

Tested. Working fine on staging

sojharo commented 4 years ago

@ImranBinShoukat please test on production.

ImranBinShoukat commented 4 years ago

Tested on production

bjafri5 commented 4 years ago

I tried publishing KiboPush chatbot and Facebook videos are still not sending. @sojharo please look into it

bjafri5 commented 4 years ago

Was able to get Facebook videos to send by using my own account. Marking this as resolved

jekram commented 4 years ago

@sojharo This is not fully working

On Askkibo ChatBot on Women's Right, the link is for FB Video but is it not playing within Messenger but on the Facebook page

https://www.facebook.com/rebeccaforwa/videos/909491089512942/

Screen Shot 2020-05-27 at 3 03 47 AM
sojharo commented 4 years ago

I have just tested this video link and put it in my chatbot. I was able to play the video on facebook messenger.

Here is the screenshot:

Screenshot 2020-05-28 at 9 21 35 AM

Let me check it from your account in the meeting.

sojharo commented 4 years ago

I have checked this on your account on Ask Kibo Page as well. There is wrong URL added in for this message block. The URL which is added is of a facebook live video. The live video URL is not supported by Facebook Media Component to play inside Messenger. They will always go as card.

Please see the screenshot:

Screenshot 2020-05-28 at 4 01 02 PM

This is the URL that is added inside the bot: https://www.facebook.com/watch/live/?v=909491089512942

It is different from the above URL that is in previous comment.

https://www.facebook.com/rebeccaforwa/videos/909491089512942/

I have given the correct URL in the bot now. You can test the bot. It shows the playable video as shown in following screenshot:

Screenshot 2020-05-28 at 4 11 37 PM

Media component supports following facebook video URL types, of videos which are already uploaded to page and not running as live stream.

Supported Video URLs

Screenshot 2020-05-28 at 4 09 37 PM

Source: https://developers.facebook.com/docs/messenger-platform/send-messages/template/media/

I have updated the user guide and put this information that we should not copy paste live video URLs and have given the format of supported URL in user guide.

https://kibopush.com/chatbot-automation/

jekram commented 4 years ago

@sojharo Please communicate this to team members.

sojharo commented 4 years ago

Yes, it was communicated to team members as well.