UNPKG

botnaut

Version:

Facebook Messenger Chatbot Framework

1,159 lines (577 loc) 39.4 kB
<!DOCTYPE HTML> <html lang="" > <head> <meta charset="UTF-8"> <meta content="text/html; charset=utf-8" http-equiv="Content-Type"> <title>Using with Wingbot.ai · 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="usingWithWingbot.html" /> <link rel="prev" href="analytics.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="buildingConversation.html"> <a href="buildingConversation.html"> Building a Conversation </a> <ul class="articles"> <li class="chapter " data-level="1.2.1" data-path="buildingConversation.html"> <a href="buildingConversation.html#asking-a-question"> Asking a question </a> </li> <li class="chapter " data-level="1.2.2" data-path="buildingConversation.html"> <a href="buildingConversation.html#using-quick-replies-for-controlling-conversation"> Using quick replies </a> </li> <li class="chapter " data-level="1.2.3" data-path="buildingConversation.html"> <a href="buildingConversation.html#post-back-is-also-an-action"> Postbacks </a> </li> </ul> </li> <li class="chapter " data-level="1.3" data-path="conversationState.html"> <a href="conversationState.html"> Conversation State </a> <ul class="articles"> <li class="chapter " data-level="1.3.1" data-path="conversationState.html"> <a href="conversationState.html#accessing-user-profile"> User profile </a> </li> <li class="chapter " data-level="1.3.2" data-path="conversationState.html"> <a href="conversationState.html#using-the-state-in-navigation"> Using state in navigation </a> </li> <li class="chapter " data-level="1.3.3" data-path="conversationState.html"> <a href="conversationState.html#reading-and-modifiing-user-state"> Reading and writing state </a> </li> </ul> </li> <li class="chapter " data-level="1.4" data-path="asyncActions.html"> <a href="asyncActions.html"> Asynchronous Actions </a> <ul class="articles"> <li class="chapter " data-level="1.4.1" data-path="asyncActions.html"> <a href="asyncActions.html#blocking-asynchronous-actions"> Blocking Actions </a> </li> <li class="chapter " data-level="1.4.2" data-path="asyncActions.html"> <a href="asyncActions.html#non-blocking-asynchronous-actions"> Non Blocking Actions </a> </li> <li class="chapter " data-level="1.4.3" data-path="asyncActions.html"> <a href="asyncActions.html#loading-attachments-to-buffer"> Loading Attachments </a> </li> </ul> </li> <li class="chapter " data-level="1.5" data-path="advancedRouting.html"> <a href="advancedRouting.html"> Advanced Routing </a> <ul class="articles"> <li class="chapter " data-level="1.5.1" data-path="advancedRouting.html"> <a href="advancedRouting.html#resolving-actions"> Resolving Actions </a> </li> <li class="chapter " data-level="1.5.2" data-path="advancedRouting.html"> <a href="advancedRouting.html#simple-text-actions"> Text Actions </a> </li> <li class="chapter " data-level="1.5.3" data-path="advancedRouting.html"> <a href="advancedRouting.html#integrating-with-ai-prediction"> Integrating AI </a> </li> <li class="chapter " data-level="1.5.4" data-path="advancedRouting.html"> <a href="advancedRouting.html#redirecting-flow-with-post-back"> Redirecting with Postback </a> </li> </ul> </li> <li class="chapter " data-level="1.6" data-path="nestingRouters.html"> <a href="nestingRouters.html"> Nesting - Reusable Blocks </a> <ul class="articles"> <li class="chapter " data-level="1.6.1" data-path="nestingRouters.html"> <a href="nestingRouters.html#basic-concept"> Concept </a> </li> <li class="chapter " data-level="1.6.2" data-path="nestingRouters.html"> <a href="nestingRouters.html#example"> Example </a> </li> </ul> </li> <li class="chapter " data-level="1.7" data-path="templates.html"> <a href="templates.html"> Sending Templates </a> <ul class="articles"> <li class="chapter " data-level="1.7.1" data-path="templates.html"> <a href="templates.html#button-template"> Button Template </a> </li> <li class="chapter " data-level="1.7.2" data-path="templates.html"> <a href="templates.html#generic-template"> Generic Template </a> </li> <li class="chapter " data-level="1.7.3" data-path="templates.html"> <a href="templates.html#receipt-template"> Receipt Template </a> </li> <li class="chapter " data-level="1.7.4" data-path="templates.html"> <a href="templates.html#working-with-webviews"> Webviews </a> </li> </ul> </li> <li class="chapter " data-level="1.8" data-path="testing.html"> <a href="testing.html"> Testing </a> </li> <li class="chapter " data-level="1.9" data-path="analytics.html"> <a href="analytics.html"> Analytics </a> </li> <li class="chapter active" data-level="1.10" data-path="usingWithWingbot.html"> <a href="usingWithWingbot.html"> Using with Wingbot.ai </a> <ul class="articles"> <li class="chapter " data-level="1.10.1" data-path="usingWithWingbot.html"> <a href="usingWithWingbot.html#bot-configuration"> Bot configuration </a> </li> <li class="chapter " data-level="1.10.2" data-path="usingWithWingbot.html"> <a href="usingWithWingbot.html#express-mongodb"> Express Mongodb </a> </li> <li class="chapter " data-level="1.10.3" data-path="usingWithWingbot.html"> <a href="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="../api/Request.html"> <a href="../api/Request.html"> Request </a> </li> <li class="chapter " data-level="2.2" data-path="../api/Responder.html"> <a href="../api/Responder.html"> Responder </a> </li> <li class="chapter " data-level="2.3" data-path="../api/Router.html"> <a href="../api/Router.html"> Router </a> </li> <li class="chapter " data-level="2.4" data-path="../api/Tester.html"> <a href="../api/Tester.html"> Tester </a> </li> <li class="chapter " data-level="2.5" data-path="../api/ButtonTemplate.html"> <a href="../api/ButtonTemplate.html"> Template Builders </a> <ul class="articles"> <li class="chapter " data-level="2.5.1" data-path="../api/ButtonTemplate.html"> <a href="../api/ButtonTemplate.html#ButtonTemplate"> ButtonTemplate </a> </li> <li class="chapter " data-level="2.5.2" data-path="../api/ButtonTemplate.html"> <a href="../api/ButtonTemplate.html#GenericTemplate"> GenericTemplate </a> </li> <li class="chapter " data-level="2.5.3" data-path="../api/ButtonTemplate.html"> <a href="../api/ButtonTemplate.html#ReceiptTemplate"> ReceiptTemplate </a> </li> </ul> </li> <li class="chapter " data-level="2.6" data-path="../api/Settings.html"> <a href="../api/Settings.html"> Bot Settings </a> </li> <li class="chapter " data-level="2.7" data-path="../api/express.html"> <a href="../api/express.html"> Express/MongoDb tools </a> </li> <li class="chapter " data-level="2.8" data-path="../api/bufferloader.html"> <a href="../api/bufferloader.html"> Utils </a> </li> <li class="chapter " data-level="2.9" data-path="../api/Ai.html"> <a href="../api/Ai.html"> Ai </a> </li> <li class="chapter " data-level="2.10" data-path="../api/serverlessAWS.html"> <a href="../api/serverlessAWS.html"> Serverless </a> </li> <li class="chapter " data-level="2.11" data-path="../api/BuildRouter.html"> <a href="../api/BuildRouter.html"> Wingbot.ai </a> </li> <li class="chapter " data-level="2.12" data-path="../api/callback.html"> <a href="../api/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=".." >Using with Wingbot.ai</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"> <h1 id="using-with-wingbot"><a name="using-with-wingbot" class="plugin-anchor" href="#using-with-wingbot"><i class="fa fa-link" aria-hidden="true"></i></a>Using With Wingbot</h1> <h2 id="bot-configuration"><a name="bot-configuration" class="plugin-anchor" href="#bot-configuration"><i class="fa fa-link" aria-hidden="true"></i></a>Bot configuration</h2> <p><strong>bot.js</strong> - common file for every configuration</p> <pre><code class="lang-javascript"><span class="hljs-meta">&apos;use strict&apos;</span>; <span class="hljs-keyword">const</span> { BuildRouter, Blocks, Router, ai } = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;botnaut&apos;</span>); <span class="hljs-keyword">const</span> wingbotConfig = { botId: <span class="hljs-string">&apos;2d48492a-a281-4223-8e6f-7f60a447bc41&apos;</span>, snapshot: <span class="hljs-string">&apos;development&apos;</span>, token: <span class="hljs-string">&apos;wingbot-token&apos;</span> }; <span class="hljs-keyword">const</span> botName = <span class="hljs-string">&apos;bot-name&apos;</span>; <span class="hljs-keyword">const</span> blocks = <span class="hljs-keyword">new</span> Blocks(); blocks.code(<span class="hljs-string">&apos;exampleBlock&apos;</span>, <span class="hljs-function"><span class="hljs-keyword">function</span>* (<span class="hljs-params">req, res, postBack, context, params</span>) </span>{ <span class="hljs-keyword">yield</span> res.run(<span class="hljs-string">&apos;responseBlockName&apos;</span>); }); ai.register(<span class="hljs-string">`<span class="hljs-subst">${botName}</span>-<span class="hljs-subst">${wingbotConfig.snapshot}</span>`</span>); <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">botFactory</span> (<span class="hljs-params"></span>) </span>{ <span class="hljs-keyword">const</span> bot = <span class="hljs-keyword">new</span> BuildRouter(wingbotConfig, blocks); bot.use((req, res) =&gt; { <span class="hljs-comment">// example middleware</span> <span class="hljs-keyword">return</span> Router.CONTINUE; }); <span class="hljs-keyword">return</span> bot; } <span class="hljs-built_in">module</span>.exports = { botFactory, wingbotConfig }; </code></pre> <h2 id="express-mongodb"><a name="express-mongodb" class="plugin-anchor" href="#express-mongodb"><i class="fa fa-link" aria-hidden="true"></i></a>Express Mongodb</h2> <p><strong>app.js</strong></p> <pre><code class="lang-javascript"><span class="hljs-meta">&apos;use strict&apos;</span>; <span class="hljs-keyword">const</span> express = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;express&apos;</span>); <span class="hljs-keyword">const</span> bodyParser = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;body-parser&apos;</span>); <span class="hljs-keyword">const</span> mongoose = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;mongoose&apos;</span>); <span class="hljs-keyword">const</span> { createRouter, createProcessor, createValidator, createUpdater } = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;botnaut/express&apos;</span>); <span class="hljs-keyword">const</span> { botFactory, wingbotConfig } = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;./bot&apos;</span>); <span class="hljs-keyword">const</span> bot = botFactory(); <span class="hljs-keyword">const</span> processor = createProcessor(bot, { pageToken: <span class="hljs-string">&apos;--fb-page-token--&apos;</span>, appSecret: <span class="hljs-string">&apos;--fb-app-secret&apos;</span>, autoTyping: <span class="hljs-literal">true</span>, }); <span class="hljs-keyword">const</span> app = express(); app.use(<span class="hljs-string">&apos;/botnaut&apos;</span>, createRouter(processor, <span class="hljs-string">&apos;--webhook-verification-token--&apos;</span>)); app.post(<span class="hljs-string">&apos;/update&apos;</span>, createUpdater(bot, wingbotConfig.token)); app.post(<span class="hljs-string">&apos;/validate&apos;</span>, createValidator(bodyParser, { routerFactory: botFactory, token: wingbotConfig.token })); mongoose.connect(<span class="hljs-string">&apos;mongodb://localhost/myapp&apos;</span>) .then(() =&gt; app.listen(<span class="hljs-number">3000</span>)); </code></pre> <h2 id="serverless-aws-lambda"><a name="serverless-aws-lambda" class="plugin-anchor" href="#serverless-aws-lambda"><i class="fa fa-link" aria-hidden="true"></i></a>Serverless AWS Lambda</h2> <p>example application for</p> <p><strong>botHandler.js</strong></p> <pre><code class="lang-javascript"><span class="hljs-meta">&apos;use strict&apos;</span>; <span class="hljs-keyword">const</span> AWS = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;aws-sdk&apos;</span>); <span class="hljs-keyword">const</span> { createHandler, createProcessor, createValidator } = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;botnaut/serverlessAWS&apos;</span>); <span class="hljs-keyword">const</span> { botFactory, wingbotConfig } = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;./bot&apos;</span>); <span class="hljs-keyword">const</span> dynamoDb = <span class="hljs-keyword">new</span> AWS.DynamoDB({ <span class="hljs-comment">// for localhost</span> <span class="hljs-comment">// endpoint: new AWS.Endpoint(&apos;http://localhost:8000&apos;),</span> <span class="hljs-comment">// region: &apos;eu-west-1&apos;</span> apiVersion: <span class="hljs-string">&apos;2012-08-10&apos;</span> }); <span class="hljs-keyword">const</span> bot = botFactory(); <span class="hljs-keyword">const</span> processor = createProcessor(bot, { pageToken: <span class="hljs-string">&apos;--fb-page-token--&apos;</span>, appSecret: <span class="hljs-string">&apos;--fb-app-secret&apos;</span>, autoTyping: <span class="hljs-literal">true</span>, dynamo: { db: dynamoDb, tablePrefix: <span class="hljs-string">`<span class="hljs-subst">${process.env.PREFIX}</span>-`</span> } }); <span class="hljs-built_in">module</span>.exports.handleRequest = createHandler(processor, <span class="hljs-string">&apos;--webhook-verification-token--&apos;</span>); <span class="hljs-built_in">module</span>.exports.validateBot = createValidator({ routerFactory: botFactory, token: wingbotConfig.token }); </code></pre> <p><strong>updateHandler.js</strong></p> <pre><code class="lang-javascript"><span class="hljs-keyword">const</span> { createUpdater } = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;botnaut/serverlessAWS&apos;</span>); <span class="hljs-built_in">module</span>.exports.update = createUpdater(<span class="hljs-string">&apos;lambda-fn-name&apos;</span>, <span class="hljs-string">&apos;wingbot-token&apos;</span>); </code></pre> <p><strong>serverless.yml</strong></p> <pre><code class="lang-yaml"><span class="hljs-attr">service:</span> wingbot-botnaut <span class="hljs-attr">custom:</span> <span class="hljs-attr"> accountId:</span> <span class="hljs-number">12344566</span> <span class="hljs-attr"> stage:</span> ${opt:stage, self:provider.stage} <span class="hljs-attr"> prefix:</span> ${self:service}-${self:custom.stage} <span class="hljs-attr">provider:</span> <span class="hljs-attr"> name:</span> aws <span class="hljs-attr"> runtime:</span> nodejs6<span class="hljs-number">.10</span> <span class="hljs-attr"> region:</span> eu-west<span class="hljs-bullet">-1</span> <span class="hljs-attr"> stage:</span> staging <span class="hljs-attr"> memorySize:</span> <span class="hljs-number">256</span> <span class="hljs-attr"> iamRoleStatements:</span> <span class="hljs-comment"># permissions for all of your functions can be set here</span> <span class="hljs-attr"> - Effect:</span> Allow <span class="hljs-attr"> Action:</span> <span class="hljs-comment"># Gives permission to DynamoDB tables in a specific region</span> <span class="hljs-attr"> - dynamodb:</span>DescribeTable <span class="hljs-attr"> Resource:</span> arn:aws:dynamodb:${self:provider.region}:*:* <span class="hljs-attr"> - Effect:</span> Allow <span class="hljs-attr"> Action:</span> <span class="hljs-comment"># Gives permission to DynamoDB tables in a specific region</span> <span class="hljs-attr"> - dynamodb:</span>DescribeTable <span class="hljs-attr"> - dynamodb:</span>Query <span class="hljs-attr"> - dynamodb:</span>Scan <span class="hljs-attr"> - dynamodb:</span>GetItem <span class="hljs-attr"> - dynamodb:</span>PutItem <span class="hljs-attr"> - dynamodb:</span>UpdateItem <span class="hljs-attr"> - dynamodb:</span>DeleteItem <span class="hljs-attr"> Resource:</span> arn:aws:dynamodb:${self:provider.region}:*:table/${self:custom.prefix}* <span class="hljs-attr"> environment:</span> <span class="hljs-attr"> PREFIX:</span> ${self:custom.prefix} <span class="hljs-attr"> NODE_ENV:</span> ${self:custom.stage} <span class="hljs-attr">functions:</span> <span class="hljs-attr"> botnaut:</span> <span class="hljs-attr"> handler:</span> botHandler.handleRequest <span class="hljs-attr"> maxRetries:</span> <span class="hljs-number">1</span> <span class="hljs-attr"> timeout:</span> <span class="hljs-number">30</span> <span class="hljs-attr"> events:</span> <span class="hljs-attr"> - http:</span> GET /botnaut <span class="hljs-attr"> - http:</span> POST /botnaut <span class="hljs-attr"> validateBot:</span> <span class="hljs-attr"> handler:</span> botHandler.validateBot <span class="hljs-attr"> memorySize:</span> <span class="hljs-number">192</span> <span class="hljs-attr"> events:</span> <span class="hljs-attr"> - http:</span> POST /validate <span class="hljs-attr"> updateLambdaHandler:</span> <span class="hljs-attr"> handler:</span> updateLambdaHandler.update <span class="hljs-attr"> memorySize:</span> <span class="hljs-number">192</span> <span class="hljs-attr"> timeout:</span> <span class="hljs-number">30</span> <span class="hljs-attr"> role:</span> DeployRole <span class="hljs-attr"> events:</span> <span class="hljs-attr"> - http:</span> POST /update <span class="hljs-attr">resources:</span> <span class="hljs-attr"> Resources:</span> <span class="hljs-attr"> DeployRole:</span> <span class="hljs-attr"> Type:</span> AWS::IAM::Role <span class="hljs-attr"> Properties:</span> <span class="hljs-attr"> AssumeRolePolicyDocument:</span> <span class="hljs-attr"> Statement:</span> <span class="hljs-attr"> - Effect:</span> Allow <span class="hljs-attr"> Principal:</span> <span class="hljs-attr"> Service:</span> lambda.amazonaws.com <span class="hljs-attr"> Action:</span> <span class="hljs-attr"> - sts:</span>AssumeRole <span class="hljs-attr"> Path:</span> <span class="hljs-string">&apos;/&apos;</span> <span class="hljs-attr"> RoleName:</span> ${self:custom.prefix}-${self:provider.region}-workerRole <span class="hljs-attr"> Policies:</span> <span class="hljs-attr"> - PolicyName:</span> ${self:custom.prefix}-workerLambda <span class="hljs-attr"> PolicyDocument:</span> <span class="hljs-attr"> Statement:</span> <span class="hljs-attr"> - Effect:</span> Allow <span class="hljs-attr"> Action:</span> <span class="hljs-bullet"> -</span> <span class="hljs-string">&quot;logs:CreateLogGroup&quot;</span> <span class="hljs-bullet"> -</span> <span class="hljs-string">&quot;logs:CreateLogStream&quot;</span> <span class="hljs-attr"> Resource:</span> <span class="hljs-bullet"> -</span> <span class="hljs-string">&apos;arn:aws:logs:${self:provider.region}:${self:custom.accountId}:log-group:/aws/lambda/${self:custom.prefix}-updateLambdaHandler:*&apos;</span> <span class="hljs-attr"> - Effect:</span> Allow <span class="hljs-attr"> Action:</span> <span class="hljs-bullet"> -</span> <span class="hljs-string">&quot;logs:PutLogEvents&quot;</span> <span class="hljs-attr"> Resource:</span> <span class="hljs-bullet"> -</span> <span class="hljs-string">&apos;arn:aws:logs:${self:provider.region}:${self:custom.accountId}:log-group:/aws/lambda/${self:custom.prefix}-updateLambdaHandler:*:*&apos;</span> <span class="hljs-attr"> - Effect:</span> Allow <span class="hljs-attr"> Action:</span> <span class="hljs-bullet"> -</span> <span class="hljs-string">&quot;lambda:GetFunctionConfiguration&quot;</span> <span class="hljs-bullet"> -</span> <span class="hljs-string">&quot;lambda:UpdateFunctionConfiguration&quot;</span> <span class="hljs-attr"> Resource:</span> <span class="hljs-bullet"> -</span> <span class="hljs-string">&quot;arn:aws:lambda:${self:provider.region}:${self:custom.accountId}:function:${self:custom.prefix}-botnaut&quot;</span> <span class="hljs-attr"> StatesTable:</span> <span class="hljs-attr"> Type:</span> AWS::DynamoDB::Table <span class="hljs-attr"> Properties:</span> <span class="hljs-attr"> TableName:</span> ${self:custom.prefix}-states <span class="hljs-attr"> AttributeDefinitions:</span> <span class="hljs-attr"> - AttributeName:</span> senderId <span class="hljs-attr"> AttributeType:</span> S <span class="hljs-attr"> KeySchema:</span> <span class="hljs-attr"> - AttributeName:</span> senderId <span class="hljs-attr"> KeyType:</span> HASH <span class="hljs-attr"> ProvisionedThroughput:</span> <span class="hljs-attr"> ReadCapacityUnits:</span> <span class="hljs-number">1</span> <span class="hljs-attr"> WriteCapacityUnits:</span> <span class="hljs-number">1</span> <span class="hljs-attr"> ChatlogTable:</span> <span class="hljs-attr"> Type:</span> AWS::DynamoDB::Table <span class="hljs-attr"> Properties:</span> <span class="hljs-attr"> TableName:</span> ${self:custom.prefix}-chatlog <span class="hljs-attr"> AttributeDefinitions:</span> <span class="hljs-attr"> - AttributeName:</span> userId <span class="hljs-attr"> AttributeType:</span> S <span class="hljs-attr"> - AttributeName:</span> time <span class="hljs-attr"> AttributeType:</span> S <span class="hljs-attr"> KeySchema:</span> <span class="hljs-attr"> - AttributeName:</span> userId <span class="hljs-attr"> KeyType:</span> HASH <span class="hljs-attr"> - AttributeName:</span> time <span class="hljs-attr"> KeyType:</span> RANGE <span class="hljs-attr"> ProvisionedThroughput:</span> <span class="hljs-attr"> ReadCapacityUnits:</span> <span class="hljs-number">1</span> <span class="hljs-attr"> WriteCapacityUnits:</span> <span class="hljs-number">1</span> <span class="hljs-attr"> BottokensTable:</span> <span class="hljs-attr"> Type:</span> AWS::DynamoDB::Table <span class="hljs-attr"> Properties:</span> <span class="hljs-attr"> TableName:</span> ${self:custom.prefix}-bottokens <span class="hljs-attr"> AttributeDefinitions:</span> <span class="hljs-attr"> - AttributeName:</span> senderId <span class="hljs-attr"> AttributeType:</span> S <span class="hljs-attr"> - AttributeName:</span> token <span class="hljs-attr"> AttributeType:</span> S <span class="hljs-attr"> KeySchema:</span> <span class="hljs-attr"> - AttributeName:</span> senderId <span class="hljs-attr"> KeyType:</span> HASH <span class="hljs-attr"> GlobalSecondaryIndexes:</span> <span class="hljs-attr"> - IndexName:</span> token <span class="hljs-attr"> KeySchema:</span> <span class="hljs-attr"> - AttributeName:</span> token <span class="hljs-attr"> KeyType:</span> HASH <span class="hljs-attr"> Projection:</span> <span class="hljs-attr"> ProjectionType:</span> ALL <span class="hljs-attr"> ProvisionedThroughput:</span> <span class="hljs-attr"> ReadCapacityUnits:</span> <span class="hljs-number">1</span> <span class="hljs-attr"> WriteCapacityUnits:</span> <span class="hljs-number">1</span> <span class="hljs-attr"> ProvisionedThroughput:</span> <span class="hljs-attr"> ReadCapacityUnits:</span> <span class="hljs-number">1</span> <span class="hljs-attr"> WriteCapacityUnits:</span> <span class="hljs-number">1</span> </code></pre> </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="analytics.html" class="navigation navigation-prev " aria-label="Previous page: Analytics"> <i class="fa fa-angle-left"></i> </a> <a href="usingWithWingbot.html#bot-configuration" class="navigation navigation-next " aria-label="Next page: Bot configuration"> <i class="fa fa-angle-right"></i> </a> </div> <script> var gitbook = gitbook || []; gitbook.push(function() { gitbook.page.hasChanged({"page":{"title":"Using with Wingbot.ai","level":"1.10","depth":1,"next":{"title":"Bot configuration","level":"1.10.1","depth":2,"anchor":"#bot-configuration","path":"tutorial/usingWithWingbot.md","ref":"tutorial/usingWithWingbot.md#bot-configuration","articles":[]},"previous":{"title":"Analytics","level":"1.9","depth":1,"path":"tutorial/analytics.md","ref":"tutorial/analytics.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":"tutorial/usingWithWingbot.md","mtime":"2018-01-10T14:39:54.718Z","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>