fbTemplates | Chatbot Library
Skip to main content

fbTemplates

fbTemplates are used to build nice structures in a Facebook Messenger Environment. These templates are created to work with Facebook Messenger.

fbStructureTemplate

fbStructureTemplate help us to create a custom Structure

  • You can use whatever block you want but take in mind that you have to separate it with a separator (comma).
  • In order to make structure work, you can paste all the name's structures inside of structure, and the components required in the component array.
  • If you dont know already what to do with context please make it false and just declare contextBody as null. (You can find Context in doc).
  • External or Generic Blocks should be used inside of open/close Payloads.
  • Available fbBlocks are image paragraph reply card for native, and generic media receipt for external. These can be located in blocks -> fbBlocks.

.

Keep in Mind

Native and External Blocks cant be used in the same structure, if so, Native Blocks will have priority and external won't appear even if they are inside of the structure.

$context = false;
$contextBody = [];
$fbTitle = ["test"];

$fbTitleArray = ["card1 intentName","card2 intentName"];
$fbImageArray = ["https://imageCardurl1.com","https://imageCardurl2.com"];
$fbSubtitleArray = ["subtitle for card1","subtitle for card2"];
$fbLinkArray = ["https://cardHyperlink.com","https://cardHyperlink.com"];
$fbStyleArray = ["$style_Tall","$Style_Full"];
$bTitleArray = [
["Card1 Button1 Title","Card1 Button 2 Tittle"],
["Card2 Button1 Title","Card2 Button 2 Tittle"]
];
$bCustomArray = [
["Card1 Button 1 postback","https://Card1button2url.com"],
["Card2 Button 1 postback","https://Card2button2url.com"]
];

$structure = ['openPayload','generic','closePayload'];
$components = [
[],
[$fbTitleArray, $fbImageArray, $fbSubtitleArray, $fbLinkArray, $fbStyleArray , $bTitleArray, $bCustomArray],
[]
];

fbStructureTemplate($context,$contextBody,$fbTitle,$structure,$components);