claudia-bot-builder icon indicating copy to clipboard operation
claudia-bot-builder copied to clipboard

Add Function for Adding a Video From Attachment ID

Open acucciniello opened this issue 6 years ago • 5 comments

- facebook allows for you to upload a file and serve it from them
- this function allows you to use a video from an attachment rather than trying to upload it from where ever it is hosted
- this could save load times for all videos being served

acucciniello avatar Aug 28 '18 18:08 acucciniello

Thanks and sorry for the late reply. I'll test this during the weekend and merge it.

stojanovic avatar Sep 21 '18 09:09 stojanovic

@acucciniello looks good, but can you add a test for this? If you don't know how to do that I can help.

stojanovic avatar Sep 24 '18 08:09 stojanovic

@stojanovic Sorry for the massive delay, I am just getting back to this. What are some tests you would need to make?

acucciniello avatar Nov 12 '18 21:11 acucciniello

@stojanovic In order to get an attachment id, I need to call the facebook API with a page access token. Without that I cannot make an image or a video. Do you have a page access token that works for testing?

acucciniello avatar Nov 13 '18 16:11 acucciniello

Sorry for the late reply. No need to invoke the Facebook API from the tests, let's just add a simple unit tests to make sure that we don't break this functionality in future. For example, invoke the video template and confirm that JSON structure is what you expect it to be. Also, try to invoke it without an attachment ID and check if the error is expected.

You can see similar examples here: https://github.com/claudiajs/claudia-bot-builder/blob/master/spec/facebook/facebook-format-message-spec.js.

stojanovic avatar Nov 14 '18 09:11 stojanovic