build a messenger bot using HTML
An advanced tiny bots scripting engine using the power of XML/HTML.
Expression Engine
to support simple scriptingmeta, text, label, p, line, span, embed, resource, media, div, menu, nav, dialog, form, template
Menus
to be compatible with messenger max-items-limit
BKIT
is in its first release, we wanted to keep it as simple as possible, we are planning to add more features in the future
<meta />
<text></text>
, <label></label>
, <span></span>
, <p></p>
, <line></line>
, <inline></inline>
<media src="" type="" />
, <resource src="" type="" />
, <embed type="" src="" />
<menu></menu>
, <nav></nav>
<form></form>
, <dialog></dialog>
<template></template>
a very simple messenger bot that will collects the user info
<html>
<head>
<!-- here we define the main-menu element, `main` is the id of the main menu -->
<meta name="main-menu" content="main" />
<!-- here we define the welcome menu "after pressing get started button" -->
<meta name="welcome-menu" content="welcome" />
<!-- whether the bkit server should verify the incoming request "from messenger itself" or not -->
<meta name="messenger-verify" content="true" />
<!-- set the facebook app secret -->
<meta name="messenger-app-secret" content="***************************" />
<!-- the verify token in the bot settings in facebook messenger platform -->
<meta name="messenger-verify-token" content="*************" />
<!-- the facebook page token -->
<meta name="messenger-page-token" content="****************" />
<!-- this content will be displayed when a new user opens the messenger window -->
<meta name="description" content="Hi, I'm your bot"/>
</head>
<body>
<menu id="main" title="Under your command, Sir :)">
<!-- reset means "clear the current session if there were some old previous data" -->
<a href="#about" reset="true">About</a>
<a href="#collect" reset="true">Collect Data</a>
</menu>
<menu id="welcome">
<a href="#about">Click Here 1</a>
<a href="#about">Click Here 2</a>
</menu>
<div id="about">
<text>I'm bkit, the bots-kit engine</text>
<text>;)</text>
</div>
<form id="collect" action="http://some/backend">
<text>enter your name</text>
<input name="user_name" />
<text>'Hi ' + user_name + ' ;)'</text>
<text>Select a type ...</text>
<select name="type">
<option value="a">Type 1</option>
<option value="b">Type 2</option>
</select>
<text if="type == 'a'">You selected Type 1</text>
<text if="type == 'b'">You selected Type 2</text>
<text>Thank You!</text>
</form>
</body>
</html>
save that file as
demo.html
then just runbkit -html "demo.html" -https ":443" -http ":80" -server-name "bkit.domain.com"
Point your facebook messenger webhook tohttps://bkit.domain.com/messenger
docker run -v $(pwd)/demo.html:/demo.html --network host alash3al/bkit -html /demo.html -https ":443" -http ":80" -server-name "bkit.domain.com"
go get github.com/RobustaStudio/bkit
Copyright 2018 (c) Robustastudio