SAP-archive / bot-connector

Bot Connector allows you to connect your bot to multiple messaging channels.
MIT License
184 stars 101 forks source link

Carouselle without buttons doesn't work (facebook messenger) #18

Closed remiroyc closed 7 years ago

remiroyc commented 7 years ago

Hi,

I think i detected two problems: First of all, message type 'carouselle' is missing in your "structured message "documentation.

On the other hand, I tried to use theses lines of code :

          message.addReply(
            {
              type: 'carouselle',
              content: [
                {
                  title: 'title',
                  subtitle: 'subtitle',
                  imageUrl: 'image_url',
                },
              ],
            });

But an exception was thrown by the superagent request (statusMessage: 'Internal Server Error').

And if I tried to send an empty buttons array, i get this error message :

    text: '{"message":"Error while sending message","results":{"status":400,"response":{"req":{"method":"POST","url":"https://graph.facebook.com/v2.6/me/messages?access_token=EAAGPNWjtXXgBAKiaPffklr8BUBWjCqbVFLk7T6LfHUZBnpRQVThSoQuomM5PZCZAzgYYQyRCsiP9gGtDrLrN9dRU21ZBlyOqc1CgfqzAuqJi2UlGTqUcQuY4ce5fKJThmz5jhsyKcOTKUvUtDxxI4gAPi6Q6ZBtoEVGhfKh6d0QZDZD","data":{"recipient":{"id":"1505883169485050"},"message":{"attachment":{"type":"template","payload":{"template_type":"generic","elements":[{"subtitle":"sous-titre","title":"titre","image_url":"https://beebom-redkapmedia.netdna-ssl.com/wp-content/uploads/2016/01/Reverse-Image-Search-Engines-Apps-And-Its-Uses-2016.jpg","buttons":[]}]}}}},"headers":{"user-agent":"node-superagent/3.5.2","content-type":"application/json"}},"header":{"www-authenticate":"OAuth \\"Facebook Platform\\" \\"invalid_request\\" \\"(#194) param [elements][0][buttons] has too few elements.\\"","access-control-allow-origin":"*","pragma":"no-cache","cache-control":"no-store","x-fb-rev":"2991045","content-type":"text/javascript; charset=UTF-8","x-fb-trace-id":"HbHp42Cb/nj","facebook-api-version":"v2.9","expires":"Sat, 01 Jan 2000 00:00:00 GMT","x-fb-debug":"bVRjXf34A06dcGItliHabsXLSCv4f0Gu03rClKlD8M/jPp37pFtqpUXmDEDiS5u2Z67SQ85iZTnHZseQIeocGQ==","date":"Mon, 01 May 2017 09:09:49 GMT","connection":"close","content-length":"144"},"status":400,"text":"{\\"error\\":{\\"message\\":\\"(#194) param [elements][0][buttons] has too few elements.\\",\\"type\\":\\"OAuthException\\",\\"code\\":194,\\"fbtrace_id\\":\\"HbHp42Cb\\\\/nj\\"}}"}}}',

In facebook documentation (https://developers.facebook.com/docs/messenger-platform/send-api-reference/generic-template), buttons is not mandatory :

image

jhoudan commented 7 years ago

We've released a new version of the Bot Connector, this should not be a problem anymore :-)