botpress / v12

Botpress OSS – v12
https://v12.botpress.com
GNU Affero General Public License v3.0
68 stars 83 forks source link

Images are not sent in Facebook & Telegram #729

Closed artoby closed 5 years ago

artoby commented 5 years ago

Describe the bug Images from the bot scenario aren't sent neither in Facebook nor in Telegram.

To Reproduce Steps to reproduce the behavior:

  1. Create a bot in Botpress
  2. Enable channel-messenger and channel-telegram modules and setup the integration
  3. Create a node in the "Flow editor" and setup "entry" node to always go to this newly created node
  4. Add a text action to the node "Hello World 1"
  5. Add an image action to the node, any image (for example this one)
  6. Add one more text action to the node "Hello World 2", so the image will reside between 2 texts
  7. Save the bot and try it in Facebook/Telegram
  8. See texts being sent but images not sent

Expected behavior Images (JPG and animated GIF's) to be sent in Facebook/Telegram

Environment (please complete the following information):

artoby commented 5 years ago

Update: In fact the images can be sent in Facebook with some limitations. This issue splits into 2:

  1. Currently (v11.9.3) Botpress uses generic template API to send images in Facebook but not the image API. There are several drawbacks of this approach:

    • Title should be necessarily set for generic template API for the image while Botpress UI says it's optional. If the title isn't set - Facebook returns an error and doesn't render the image. Error: (#100) Incomplete element data: title and at least one other field (image url, subtitle or buttons) (...)
    • An image sent using generic template API can't be zoomed, while images sent using image API can be zoomed
    • if you use ngrok to create a https tunnel - Facebook doesn't render images that are sent using generic template API. I've checked it by myself and there's a discussion of the issue in the Internet.
    • you can use "Card" content to achieve the same result as using generic template API for images. So it makes more sense to implement images using image API
  2. Currently (v11.9.3) images rendering isn't implemented for Telegram in image.js file.

My proposal: I can fix the code of image.js to use image API to send images in Facebook. And I can implement image rendering for Telegram.

Botpress devs, please write a comment if you agree with my proposal and I'll make a pull request then.

look

rndlaine commented 5 years ago

Hey @artoby, Yes the Image API looks like is the good approach!

rndlaine commented 5 years ago

Closing this issue as its resolved in botpress/botpress#1914