loading

April 1, 2017

Multiple messages for Facebook Messanger in api.ai via Webhook

Lately we were building a chatbot, where there was need to send a big peace of text information to facebook messanger via it’s bot api system. But we run into the limitation problem. Facebook does not allow  longer texts via it’s api.

 

  • text must be UTF-8 and has a 640 character limit
  • You cannot send a text and an attachment together, please read the Send API Reference for more details

So after struggling a bit with Api.Ai sequentional functionality, we have come across very simple solution! You can actually in your json answer to api.ai webhook call define the facebook answer separately and have not only 1 message but many…

 

Here is how can a JSON answer to api.ai webhook call from your server look like

 

 

{"speech":"Some Big text Here","displayText":"Some Big text Here","my_intent_data":"orensgrqi_search","data":{"telegram":{"text":"Some big text here","parse_mode":"Markdown"},"facebook":[{"text":"this is text 570"},{"text":"this is text 570"},{"text":"this is text 570"}]},"contextOut":[],"source":"Magyboo.de"}

 

 

 

 

 

 

 

Share this Post