integrations icon indicating copy to clipboard operation
integrations copied to clipboard

Messenger: FB API sends expects non-empty string for image title

Open m90 opened this issue 8 years ago • 3 comments

Overview

  • What project is this issue for?: broid-messenger

  • Is this a bug, security, feature request, or feedback: bug?

Steps to Reproduce

  1. Start application with settings
  2. Send message

Use the messenger integration to send an image like:

{
  type: 'Image',
  url: 'http://example.net/image.jpg'
}

Observed

Facebook API responds with:

error: 400 - {"error":{"message":"(#100) Param [elements][0][title] must be a non-empty UTF-8 encoded string","type":"OAuthException","code":100,"fbtrace_id":"F8DlzRhbyZE"}}

Expected

The integration should send an image.

It looks like the empty string in the helpers cannot be used as a fallback value. Maybe the key needs to be omitted in that case?

m90 avatar May 03 '17 07:05 m90

It's expected, Media title is mandatory by facebook API. One workaround is to add a piece of code to generate via the URL a title for the media. look here https://github.com/broidHQ/integrations/pull/144/files

killix avatar May 10 '17 20:05 killix

I really have no clue how it is done, but when you use api.ai to hook into Messenger, you can send images without any sort of text attached. Don't know if that's feasible in this context though.

m90 avatar May 10 '17 20:05 m90

You right, API.ai use the Image FB template for the attachment. I did the fix to use this template when the name if not fill. Otherwise, i use the generic template.

killix avatar May 10 '17 21:05 killix