botnaut
Version:
Facebook Messenger Chatbot Framework
1,293 lines (729 loc) • 38.5 kB
HTML
<html lang="" >
<head>
<meta charset="UTF-8">
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<title>Template Builders · Botnaut</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="description" content="">
<meta name="generator" content="GitBook 3.2.3">
<meta name="author" content="David Menger">
<link rel="stylesheet" href="../gitbook/style.css">
<link rel="stylesheet" href="../gitbook/gitbook-plugin-anchors/plugin.css">
<link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
<link rel="stylesheet" href="../gitbook/gitbook-plugin-search/search.css">
<link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
<meta name="HandheldFriendly" content="true"/>
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
<link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">
<link rel="next" href="ButtonTemplate.html" />
<link rel="prev" href="Tester.html" />
</head>
<body>
<div class="book">
<div class="book-summary">
<div id="book-search-input" role="search">
<input type="text" placeholder="Type to search" />
</div>
<nav role="navigation">
<ul class="summary">
<li class="header">Building a chat bot</li>
<li class="chapter " data-level="1.1" data-path="../">
<a href="../">
Getting Started
</a>
</li>
<li class="chapter " data-level="1.2" data-path="../tutorial/buildingConversation.html">
<a href="../tutorial/buildingConversation.html">
Building a Conversation
</a>
<ul class="articles">
<li class="chapter " data-level="1.2.1" data-path="../tutorial/buildingConversation.html">
<a href="../tutorial/buildingConversation.html#asking-a-question">
Asking a question
</a>
</li>
<li class="chapter " data-level="1.2.2" data-path="../tutorial/buildingConversation.html">
<a href="../tutorial/buildingConversation.html#using-quick-replies-for-controlling-conversation">
Using quick replies
</a>
</li>
<li class="chapter " data-level="1.2.3" data-path="../tutorial/buildingConversation.html">
<a href="../tutorial/buildingConversation.html#post-back-is-also-an-action">
Postbacks
</a>
</li>
</ul>
</li>
<li class="chapter " data-level="1.3" data-path="../tutorial/conversationState.html">
<a href="../tutorial/conversationState.html">
Conversation State
</a>
<ul class="articles">
<li class="chapter " data-level="1.3.1" data-path="../tutorial/conversationState.html">
<a href="../tutorial/conversationState.html#accessing-user-profile">
User profile
</a>
</li>
<li class="chapter " data-level="1.3.2" data-path="../tutorial/conversationState.html">
<a href="../tutorial/conversationState.html#using-the-state-in-navigation">
Using state in navigation
</a>
</li>
<li class="chapter " data-level="1.3.3" data-path="../tutorial/conversationState.html">
<a href="../tutorial/conversationState.html#reading-and-modifiing-user-state">
Reading and writing state
</a>
</li>
</ul>
</li>
<li class="chapter " data-level="1.4" data-path="../tutorial/asyncActions.html">
<a href="../tutorial/asyncActions.html">
Asynchronous Actions
</a>
<ul class="articles">
<li class="chapter " data-level="1.4.1" data-path="../tutorial/asyncActions.html">
<a href="../tutorial/asyncActions.html#blocking-asynchronous-actions">
Blocking Actions
</a>
</li>
<li class="chapter " data-level="1.4.2" data-path="../tutorial/asyncActions.html">
<a href="../tutorial/asyncActions.html#non-blocking-asynchronous-actions">
Non Blocking Actions
</a>
</li>
<li class="chapter " data-level="1.4.3" data-path="../tutorial/asyncActions.html">
<a href="../tutorial/asyncActions.html#loading-attachments-to-buffer">
Loading Attachments
</a>
</li>
</ul>
</li>
<li class="chapter " data-level="1.5" data-path="../tutorial/advancedRouting.html">
<a href="../tutorial/advancedRouting.html">
Advanced Routing
</a>
<ul class="articles">
<li class="chapter " data-level="1.5.1" data-path="../tutorial/advancedRouting.html">
<a href="../tutorial/advancedRouting.html#resolving-actions">
Resolving Actions
</a>
</li>
<li class="chapter " data-level="1.5.2" data-path="../tutorial/advancedRouting.html">
<a href="../tutorial/advancedRouting.html#simple-text-actions">
Text Actions
</a>
</li>
<li class="chapter " data-level="1.5.3" data-path="../tutorial/advancedRouting.html">
<a href="../tutorial/advancedRouting.html#integrating-with-ai-prediction">
Integrating AI
</a>
</li>
<li class="chapter " data-level="1.5.4" data-path="../tutorial/advancedRouting.html">
<a href="../tutorial/advancedRouting.html#redirecting-flow-with-post-back">
Redirecting with Postback
</a>
</li>
</ul>
</li>
<li class="chapter " data-level="1.6" data-path="../tutorial/nestingRouters.html">
<a href="../tutorial/nestingRouters.html">
Nesting - Reusable Blocks
</a>
<ul class="articles">
<li class="chapter " data-level="1.6.1" data-path="../tutorial/nestingRouters.html">
<a href="../tutorial/nestingRouters.html#basic-concept">
Concept
</a>
</li>
<li class="chapter " data-level="1.6.2" data-path="../tutorial/nestingRouters.html">
<a href="../tutorial/nestingRouters.html#example">
Example
</a>
</li>
</ul>
</li>
<li class="chapter " data-level="1.7" data-path="../tutorial/templates.html">
<a href="../tutorial/templates.html">
Sending Templates
</a>
<ul class="articles">
<li class="chapter " data-level="1.7.1" data-path="../tutorial/templates.html">
<a href="../tutorial/templates.html#button-template">
Button Template
</a>
</li>
<li class="chapter " data-level="1.7.2" data-path="../tutorial/templates.html">
<a href="../tutorial/templates.html#generic-template">
Generic Template
</a>
</li>
<li class="chapter " data-level="1.7.3" data-path="../tutorial/templates.html">
<a href="../tutorial/templates.html#receipt-template">
Receipt Template
</a>
</li>
<li class="chapter " data-level="1.7.4" data-path="../tutorial/templates.html">
<a href="../tutorial/templates.html#working-with-webviews">
Webviews
</a>
</li>
</ul>
</li>
<li class="chapter " data-level="1.8" data-path="../tutorial/testing.html">
<a href="../tutorial/testing.html">
Testing
</a>
</li>
<li class="chapter " data-level="1.9" data-path="../tutorial/analytics.html">
<a href="../tutorial/analytics.html">
Analytics
</a>
</li>
<li class="chapter " data-level="1.10" data-path="../tutorial/usingWithWingbot.html">
<a href="../tutorial/usingWithWingbot.html">
Using with Wingbot.ai
</a>
<ul class="articles">
<li class="chapter " data-level="1.10.1" data-path="../tutorial/usingWithWingbot.html">
<a href="../tutorial/usingWithWingbot.html#bot-configuration">
Bot configuration
</a>
</li>
<li class="chapter " data-level="1.10.2" data-path="../tutorial/usingWithWingbot.html">
<a href="../tutorial/usingWithWingbot.html#express-mongodb">
Express Mongodb
</a>
</li>
<li class="chapter " data-level="1.10.3" data-path="../tutorial/usingWithWingbot.html">
<a href="../tutorial/usingWithWingbot.html#serverless-aws-lambda">
Serverless AWS Lambda
</a>
</li>
</ul>
</li>
<li class="header">API</li>
<li class="chapter " data-level="2.1" data-path="Request.html">
<a href="Request.html">
Request
</a>
</li>
<li class="chapter " data-level="2.2" data-path="Responder.html">
<a href="Responder.html">
Responder
</a>
</li>
<li class="chapter " data-level="2.3" data-path="Router.html">
<a href="Router.html">
Router
</a>
</li>
<li class="chapter " data-level="2.4" data-path="Tester.html">
<a href="Tester.html">
Tester
</a>
</li>
<li class="chapter active" data-level="2.5" data-path="ButtonTemplate.html">
<a href="ButtonTemplate.html">
Template Builders
</a>
<ul class="articles">
<li class="chapter " data-level="2.5.1" data-path="ButtonTemplate.html">
<a href="ButtonTemplate.html#ButtonTemplate">
ButtonTemplate
</a>
</li>
<li class="chapter " data-level="2.5.2" data-path="ButtonTemplate.html">
<a href="ButtonTemplate.html#GenericTemplate">
GenericTemplate
</a>
</li>
<li class="chapter " data-level="2.5.3" data-path="ButtonTemplate.html">
<a href="ButtonTemplate.html#ReceiptTemplate">
ReceiptTemplate
</a>
</li>
</ul>
</li>
<li class="chapter " data-level="2.6" data-path="Settings.html">
<a href="Settings.html">
Bot Settings
</a>
</li>
<li class="chapter " data-level="2.7" data-path="express.html">
<a href="express.html">
Express/MongoDb tools
</a>
</li>
<li class="chapter " data-level="2.8" data-path="bufferloader.html">
<a href="bufferloader.html">
Utils
</a>
</li>
<li class="chapter " data-level="2.9" data-path="Ai.html">
<a href="Ai.html">
Ai
</a>
</li>
<li class="chapter " data-level="2.10" data-path="serverlessAWS.html">
<a href="serverlessAWS.html">
Serverless
</a>
</li>
<li class="chapter " data-level="2.11" data-path="BuildRouter.html">
<a href="BuildRouter.html">
Wingbot.ai
</a>
</li>
<li class="chapter " data-level="2.12" data-path="callback.html">
<a href="callback.html">
Middlewares
</a>
</li>
<li class="divider"></li>
<li>
<a href="https://www.gitbook.com" target="blank" class="gitbook-link">
Published with GitBook
</a>
</li>
</ul>
</nav>
</div>
<div class="book-body">
<div class="body-inner">
<div class="book-header" role="navigation">
<!-- Title -->
<h1>
<i class="fa fa-circle-o-notch fa-spin"></i>
<a href=".." >Template Builders</a>
</h1>
</div>
<div class="page-wrapper" tabindex="-1" role="main">
<div class="page-inner">
<div id="book-search-results">
<div class="search-noresults">
<section class="normal markdown-section">
<h2 id="classes"><a name="classes" class="plugin-anchor" href="#classes"><i class="fa fa-link" aria-hidden="true"></i></a>Classes</h2>
<dl>
<dt><a href="#ButtonTemplate">ButtonTemplate</a> ⇐ <code>BaseTemplate</code></dt>
<dd></dd>
<dt><a href="#GenericTemplate">GenericTemplate</a> ⇐ <code>ButtonTemplate</code></dt>
<dd></dd>
<dt><a href="#ReceiptTemplate">ReceiptTemplate</a> ⇐ <code>BaseTemplate</code></dt>
<dd></dd>
</dl>
<div id="ButtonTemplate"> </div>
<h2 id="buttontemplate-⇐-basetemplate"><a name="buttontemplate-⇐-basetemplate" class="plugin-anchor" href="#buttontemplate-⇐-basetemplate"><i class="fa fa-link" aria-hidden="true"></i></a>ButtonTemplate ⇐ <code>BaseTemplate</code></h2>
<p><strong>Kind</strong>: global class<br><strong>Extends</strong>: <code>BaseTemplate</code> </p>
<ul>
<li><a href="#ButtonTemplate">ButtonTemplate</a> ⇐ <code>BaseTemplate</code><ul>
<li><a href="#new_ButtonTemplate_new">new ButtonTemplate()</a></li>
<li><a href="#ButtonTemplate_urlButton">.urlButton(title, linkUrl, hasExtension, [webviewHeight])</a> ⇒ <code>this</code></li>
<li><a href="#ButtonTemplate_postBackButton">.postBackButton(title, action, [data])</a> ⇒ <code>this</code></li>
<li><a href="#ButtonTemplate_shareButton">.shareButton()</a> ⇒ <code>this</code></li>
</ul>
</li>
</ul>
<div id="new_ButtonTemplate_new"> </div>
<h3 id="new-buttontemplate"><a name="new-buttontemplate" class="plugin-anchor" href="#new-buttontemplate"><i class="fa fa-link" aria-hidden="true"></i></a>new ButtonTemplate()</h3>
<p>Helps with creating of button template
Instance of button template is returned by {Responder}</p>
<div id="ButtonTemplate_urlButton"> </div>
<h3 id="buttontemplateurlbuttontitle-linkurl-hasextension-webviewheight-⇒-this"><a name="buttontemplateurlbuttontitle-linkurl-hasextension-webviewheight-⇒-this" class="plugin-anchor" href="#buttontemplateurlbuttontitle-linkurl-hasextension-webviewheight-⇒-this"><i class="fa fa-link" aria-hidden="true"></i></a>buttonTemplate.urlButton(title, linkUrl, hasExtension, [webviewHeight]) ⇒ <code>this</code></h3>
<p>Adds button. When <code>hasExtension</code> is set to <code>true</code>, url will contain hash like:
<code>#token=foo&senderId=23344</code></p>
<p><strong>Kind</strong>: instance method of <a href="#ButtonTemplate"><code>ButtonTemplate</code></a> </p>
<table>
<thead>
<tr>
<th>Param</th>
<th>Type</th>
<th>Default</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>title</td>
<td><code>string</code></td>
<td></td>
<td>button text</td>
</tr>
<tr>
<td>linkUrl</td>
<td><code>string</code></td>
<td></td>
<td>button url</td>
</tr>
<tr>
<td>hasExtension</td>
<td><code>boolean</code></td>
<td><code>false</code></td>
<td>includes token in url</td>
</tr>
<tr>
<td>[webviewHeight]</td>
<td><code>string</code></td>
<td><code>null</code></td>
<td>compact</td>
<td>tall</td>
<td>full</td>
</tr>
</tbody>
</table>
<div id="ButtonTemplate_postBackButton"> </div>
<h3 id="buttontemplatepostbackbuttontitle-action-data-⇒-this"><a name="buttontemplatepostbackbuttontitle-action-data-⇒-this" class="plugin-anchor" href="#buttontemplatepostbackbuttontitle-action-data-⇒-this"><i class="fa fa-link" aria-hidden="true"></i></a>buttonTemplate.postBackButton(title, action, [data]) ⇒ <code>this</code></h3>
<p>Adds button, which makes another action</p>
<p><strong>Kind</strong>: instance method of <a href="#ButtonTemplate"><code>ButtonTemplate</code></a> </p>
<table>
<thead>
<tr>
<th>Param</th>
<th>Type</th>
<th>Default</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>title</td>
<td><code>string</code></td>
<td></td>
<td>Button title</td>
</tr>
<tr>
<td>action</td>
<td><code>string</code></td>
<td></td>
<td>Button action (can be absolute or relative)</td>
</tr>
<tr>
<td>[data]</td>
<td><code>object</code></td>
<td><code>{}</code></td>
<td>Action data</td>
</tr>
</tbody>
</table>
<div id="ButtonTemplate_shareButton"> </div>
<h3 id="buttontemplatesharebutton-⇒-this"><a name="buttontemplatesharebutton-⇒-this" class="plugin-anchor" href="#buttontemplatesharebutton-⇒-this"><i class="fa fa-link" aria-hidden="true"></i></a>buttonTemplate.shareButton() ⇒ <code>this</code></h3>
<p><strong>Kind</strong>: instance method of <a href="#ButtonTemplate"><code>ButtonTemplate</code></a> </p>
<div id="GenericTemplate"> </div>
<h2 id="generictemplate-⇐-buttontemplate"><a name="generictemplate-⇐-buttontemplate" class="plugin-anchor" href="#generictemplate-⇐-buttontemplate"><i class="fa fa-link" aria-hidden="true"></i></a>GenericTemplate ⇐ <a href="#ButtonTemplate"><code>ButtonTemplate</code></a></h2>
<p><strong>Kind</strong>: global class<br><strong>Extends</strong>: <a href="#ButtonTemplate"><code>ButtonTemplate</code></a> </p>
<ul>
<li><a href="#GenericTemplate">GenericTemplate</a> ⇐ <a href="#ButtonTemplate"><code>ButtonTemplate</code></a><ul>
<li><a href="#new_GenericTemplate_new">new GenericTemplate()</a></li>
<li><a href="#GenericTemplate_addElement">.addElement(title, [subtitle], [dontTranslate])</a> ⇒ <code>this</code></li>
<li><a href="#GenericTemplate_setElementActionShare">.setElementActionShare()</a> ⇒ <code>this</code></li>
<li><a href="#GenericTemplate_setElementActionPostback">.setElementActionPostback(action, [data])</a> ⇒ <code>this</code></li>
<li><a href="#GenericTemplate_setElementImage">.setElementImage(image)</a> ⇒ <code>this</code></li>
<li><a href="#GenericTemplate_setElementAction">.setElementAction(url, hasExtension, [webviewHeight])</a></li>
<li><a href="#ButtonTemplate_urlButton">.urlButton(title, linkUrl, hasExtension, [webviewHeight])</a> ⇒ <code>this</code></li>
<li><a href="#ButtonTemplate_postBackButton">.postBackButton(title, action, [data])</a> ⇒ <code>this</code></li>
<li><a href="#ButtonTemplate_shareButton">.shareButton()</a> ⇒ <code>this</code></li>
</ul>
</li>
</ul>
<div id="new_GenericTemplate_new"> </div>
<h3 id="new-generictemplate"><a name="new-generictemplate" class="plugin-anchor" href="#new-generictemplate"><i class="fa fa-link" aria-hidden="true"></i></a>new GenericTemplate()</h3>
<p>Generic template utility</p>
<div id="GenericTemplate_addElement"> </div>
<h3 id="generictemplateaddelementtitle-subtitle-donttranslate-⇒-this"><a name="generictemplateaddelementtitle-subtitle-donttranslate-⇒-this" class="plugin-anchor" href="#generictemplateaddelementtitle-subtitle-donttranslate-⇒-this"><i class="fa fa-link" aria-hidden="true"></i></a>genericTemplate.addElement(title, [subtitle], [dontTranslate]) ⇒ <code>this</code></h3>
<p>Adds element to generic template</p>
<p><strong>Kind</strong>: instance method of <a href="#GenericTemplate"><code>GenericTemplate</code></a> </p>
<table>
<thead>
<tr>
<th>Param</th>
<th>Type</th>
<th>Default</th>
</tr>
</thead>
<tbody>
<tr>
<td>title</td>
<td><code>string</code></td>
<td></td>
</tr>
<tr>
<td>[subtitle]</td>
<td><code>string</code></td>
<td><code>null</code></td>
</tr>
<tr>
<td>[dontTranslate]</td>
<td><code>boolean</code></td>
<td><code>false</code></td>
</tr>
</tbody>
</table>
<div id="GenericTemplate_setElementActionShare"> </div>
<h3 id="generictemplatesetelementactionshare-⇒-this"><a name="generictemplatesetelementactionshare-⇒-this" class="plugin-anchor" href="#generictemplatesetelementactionshare-⇒-this"><i class="fa fa-link" aria-hidden="true"></i></a>genericTemplate.setElementActionShare() ⇒ <code>this</code></h3>
<p>Sets url of recently added element</p>
<p><strong>Kind</strong>: instance method of <a href="#GenericTemplate"><code>GenericTemplate</code></a> </p>
<div id="GenericTemplate_setElementActionPostback"> </div>
<h3 id="generictemplatesetelementactionpostbackaction-data-⇒-this"><a name="generictemplatesetelementactionpostbackaction-data-⇒-this" class="plugin-anchor" href="#generictemplatesetelementactionpostbackaction-data-⇒-this"><i class="fa fa-link" aria-hidden="true"></i></a>genericTemplate.setElementActionPostback(action, [data]) ⇒ <code>this</code></h3>
<p>Sets url of recently added element</p>
<p><strong>Kind</strong>: instance method of <a href="#GenericTemplate"><code>GenericTemplate</code></a> </p>
<table>
<thead>
<tr>
<th>Param</th>
<th>Type</th>
<th>Default</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>action</td>
<td><code>string</code></td>
<td></td>
<td>Button action (can be absolute or relative)</td>
</tr>
<tr>
<td>[data]</td>
<td><code>object</code></td>
<td><code>{}</code></td>
<td>Action data</td>
</tr>
</tbody>
</table>
<div id="GenericTemplate_setElementImage"> </div>
<h3 id="generictemplatesetelementimageimage-⇒-this"><a name="generictemplatesetelementimageimage-⇒-this" class="plugin-anchor" href="#generictemplatesetelementimageimage-⇒-this"><i class="fa fa-link" aria-hidden="true"></i></a>genericTemplate.setElementImage(image) ⇒ <code>this</code></h3>
<p>Sets image of recently added element</p>
<p><strong>Kind</strong>: instance method of <a href="#GenericTemplate"><code>GenericTemplate</code></a> </p>
<table>
<thead>
<tr>
<th>Param</th>
<th>Type</th>
</tr>
</thead>
<tbody>
<tr>
<td>image</td>
<td><code>string</code></td>
</tr>
</tbody>
</table>
<div id="GenericTemplate_setElementAction"> </div>
<h3 id="generictemplatesetelementactionurl-hasextension-webviewheight"><a name="generictemplatesetelementactionurl-hasextension-webviewheight" class="plugin-anchor" href="#generictemplatesetelementactionurl-hasextension-webviewheight"><i class="fa fa-link" aria-hidden="true"></i></a>genericTemplate.setElementAction(url, hasExtension, [webviewHeight])</h3>
<p>Sets default action of recently added element</p>
<p><strong>Kind</strong>: instance method of <a href="#GenericTemplate"><code>GenericTemplate</code></a> </p>
<table>
<thead>
<tr>
<th>Param</th>
<th>Type</th>
<th>Default</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>url</td>
<td><code>string</code></td>
<td></td>
<td>button url</td>
</tr>
<tr>
<td>hasExtension</td>
<td><code>boolean</code></td>
<td><code>false</code></td>
<td>includes token in url</td>
</tr>
<tr>
<td>[webviewHeight]</td>
<td><code>string</code></td>
<td><code>null</code></td>
<td>compact</td>
<td>tall</td>
<td>full</td>
</tr>
</tbody>
</table>
<div id="ButtonTemplate_urlButton"> </div>
<h3 id="generictemplateurlbuttontitle-linkurl-hasextension-webviewheight-⇒-this"><a name="generictemplateurlbuttontitle-linkurl-hasextension-webviewheight-⇒-this" class="plugin-anchor" href="#generictemplateurlbuttontitle-linkurl-hasextension-webviewheight-⇒-this"><i class="fa fa-link" aria-hidden="true"></i></a>genericTemplate.urlButton(title, linkUrl, hasExtension, [webviewHeight]) ⇒ <code>this</code></h3>
<p>Adds button. When <code>hasExtension</code> is set to <code>true</code>, url will contain hash like:
<code>#token=foo&senderId=23344</code></p>
<p><strong>Kind</strong>: instance method of <a href="#GenericTemplate"><code>GenericTemplate</code></a> </p>
<table>
<thead>
<tr>
<th>Param</th>
<th>Type</th>
<th>Default</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>title</td>
<td><code>string</code></td>
<td></td>
<td>button text</td>
</tr>
<tr>
<td>linkUrl</td>
<td><code>string</code></td>
<td></td>
<td>button url</td>
</tr>
<tr>
<td>hasExtension</td>
<td><code>boolean</code></td>
<td><code>false</code></td>
<td>includes token in url</td>
</tr>
<tr>
<td>[webviewHeight]</td>
<td><code>string</code></td>
<td><code>null</code></td>
<td>compact</td>
<td>tall</td>
<td>full</td>
</tr>
</tbody>
</table>
<div id="ButtonTemplate_postBackButton"> </div>
<h3 id="generictemplatepostbackbuttontitle-action-data-⇒-this"><a name="generictemplatepostbackbuttontitle-action-data-⇒-this" class="plugin-anchor" href="#generictemplatepostbackbuttontitle-action-data-⇒-this"><i class="fa fa-link" aria-hidden="true"></i></a>genericTemplate.postBackButton(title, action, [data]) ⇒ <code>this</code></h3>
<p>Adds button, which makes another action</p>
<p><strong>Kind</strong>: instance method of <a href="#GenericTemplate"><code>GenericTemplate</code></a> </p>
<table>
<thead>
<tr>
<th>Param</th>
<th>Type</th>
<th>Default</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>title</td>
<td><code>string</code></td>
<td></td>
<td>Button title</td>
</tr>
<tr>
<td>action</td>
<td><code>string</code></td>
<td></td>
<td>Button action (can be absolute or relative)</td>
</tr>
<tr>
<td>[data]</td>
<td><code>object</code></td>
<td><code>{}</code></td>
<td>Action data</td>
</tr>
</tbody>
</table>
<div id="ButtonTemplate_shareButton"> </div>
<h3 id="generictemplatesharebutton-⇒-this"><a name="generictemplatesharebutton-⇒-this" class="plugin-anchor" href="#generictemplatesharebutton-⇒-this"><i class="fa fa-link" aria-hidden="true"></i></a>genericTemplate.shareButton() ⇒ <code>this</code></h3>
<p><strong>Kind</strong>: instance method of <a href="#GenericTemplate"><code>GenericTemplate</code></a> </p>
<div id="ReceiptTemplate"> </div>
<h2 id="receipttemplate-⇐-basetemplate"><a name="receipttemplate-⇐-basetemplate" class="plugin-anchor" href="#receipttemplate-⇐-basetemplate"><i class="fa fa-link" aria-hidden="true"></i></a>ReceiptTemplate ⇐ <code>BaseTemplate</code></h2>
<p><strong>Kind</strong>: global class<br><strong>Extends</strong>: <code>BaseTemplate</code> </p>
<ul>
<li><a href="#ReceiptTemplate">ReceiptTemplate</a> ⇐ <code>BaseTemplate</code><ul>
<li><a href="#new_ReceiptTemplate_new">new ReceiptTemplate()</a></li>
<li><a href="#ReceiptTemplate_addElement">.addElement(title, [price], [quantity], [image], [subtitle])</a> ⇒ <code>this</code></li>
</ul>
</li>
</ul>
<div id="new_ReceiptTemplate_new"> </div>
<h3 id="new-receipttemplate"><a name="new-receipttemplate" class="plugin-anchor" href="#new-receipttemplate"><i class="fa fa-link" aria-hidden="true"></i></a>new ReceiptTemplate()</h3>
<p>Provides fluent interface to make nice Receipts
Instance of button template is returned by {Responder}</p>
<div id="ReceiptTemplate_addElement"> </div>
<h3 id="receipttemplateaddelementtitle-price-quantity-image-subtitle-⇒-this"><a name="receipttemplateaddelementtitle-price-quantity-image-subtitle-⇒-this" class="plugin-anchor" href="#receipttemplateaddelementtitle-price-quantity-image-subtitle-⇒-this"><i class="fa fa-link" aria-hidden="true"></i></a>receiptTemplate.addElement(title, [price], [quantity], [image], [subtitle]) ⇒ <code>this</code></h3>
<p>Adds item to receipt</p>
<p><strong>Kind</strong>: instance method of <a href="#ReceiptTemplate"><code>ReceiptTemplate</code></a> </p>
<table>
<thead>
<tr>
<th>Param</th>
<th>Type</th>
<th>Default</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>title</td>
<td><code>string</code></td>
<td></td>
<td></td>
</tr>
<tr>
<td>[price]</td>
<td><code>number</code></td>
<td><code>0</code></td>
<td>a item price</td>
</tr>
<tr>
<td>[quantity]</td>
<td><code>number</code></td>
<td><code></code></td>
<td>amount of items</td>
</tr>
<tr>
<td>[image]</td>
<td><code>string</code></td>
<td><code>null</code></td>
<td>image of item</td>
</tr>
<tr>
<td>[subtitle]</td>
<td><code>string</code></td>
<td><code>null</code></td>
<td>optional subtitle</td>
</tr>
</tbody>
</table>
</section>
</div>
<div class="search-results">
<div class="has-results">
<h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
<ul class="search-results-list"></ul>
</div>
<div class="no-results">
<h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
</div>
</div>
</div>
</div>
</div>
</div>
<a href="Tester.html" class="navigation navigation-prev " aria-label="Previous page: Tester">
<i class="fa fa-angle-left"></i>
</a>
<a href="ButtonTemplate.html#ButtonTemplate" class="navigation navigation-next " aria-label="Next page: ButtonTemplate">
<i class="fa fa-angle-right"></i>
</a>
</div>
<script>
var gitbook = gitbook || [];
gitbook.push(function() {
gitbook.page.hasChanged({"page":{"title":"Template Builders","level":"2.5","depth":1,"next":{"title":"ButtonTemplate","level":"2.5.1","depth":2,"anchor":"#ButtonTemplate","path":"api/ButtonTemplate.md","ref":"api/ButtonTemplate.md#ButtonTemplate","articles":[]},"previous":{"title":"Tester","level":"2.4","depth":1,"path":"api/Tester.md","ref":"api/Tester.md","articles":[]},"dir":"ltr"},"config":{"plugins":["theme-default","collapsible-menu","anchors"],"styles":{"ebook":"styles/ebook.css","epub":"styles/epub.css","mobi":"styles/mobi.css","pdf":"styles/pdf.css","print":"styles/print.css","website":"styles/website.css"},"pluginsConfig":{"collapsible-menu":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"theme-api":{"theme":"dark","languages":[{"lang":"js","name":"JavaScript","default":true}]},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"showLevel":false,"styles":{"ebook":"styles/ebook.css","epub":"styles/epub.css","mobi":"styles/mobi.css","pdf":"styles/pdf.css","print":"styles/print.css","website":"styles/website.css"}},"anchors":{}},"theme":"default","author":"David Menger","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{"twitter":"https://twitter.com/davidmenger"},"title":"Botnaut","gitbook":"*","description":"Facebook Messenger framework for Node.js"},"file":{"path":"api/ButtonTemplate.md","mtime":"2018-05-23T15:31:55.042Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-05-23T15:31:59.833Z"},"basePath":"..","book":{"language":""}});
});
</script>
</div>
<script src="../gitbook/gitbook.js"></script>
<script src="../gitbook/theme.js"></script>
<script src="../gitbook/gitbook-plugin-collapsible-menu/plugin.js"></script>
<script src="../gitbook/gitbook-plugin-search/search-engine.js"></script>
<script src="../gitbook/gitbook-plugin-search/search.js"></script>
<script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
<script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
<script src="../gitbook/gitbook-plugin-sharing/buttons.js"></script>
<script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
</body>
</html>