Skip to content

Instantly share code, notes, and snippets.

Dariusz Zabrzeński dzabrzenski

Block or report user

Report or block dzabrzenski

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@dzabrzenski
dzabrzenski / restaurant_bot.js
Last active Mar 15, 2019
restaurant_bot.js
View restaurant_bot.js
'use strict';
const TOKEN = '{{YOUR_TOKEN}}'; // put your authorization token here
const express = require('express');
const { Router } = require('express');
const router = new Router();
const app = express();
const functions = require('firebase-functions');
const firebase = require('firebase-admin');
View example_widget.html
<!-- Start of BotEngine (www.botengine.ai) code -->
<script type="text/javascript">
window.__be = window.__be || {};
window.__be.id = "5bf1c94058b7d56896764446";
(function() {
var be = document.createElement('script'); be.type = 'text/javascript'; be.async = true;
be.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'cdn.botengine.ai/widget/plugin.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(be, s);
View widget.js
var BE_API = window.BE_API || {};
// open chat widget after 45 seconds
BE_API.onLoad = function () {
var time = 45 * 1000; // 45 seconds
setTimeout(function() {
BE_API.openChat();
}, time);
View widget.html
<!-- Start of BotEngine (www.botengine.ai) code -->
<script type="text/javascript">
var enabledPages = [
"/home"
]
if (enabledPages.indexOf(window.location.pathname) > -1) {
window.__be = window.__be || {};
window.__be.id = "5a9e58267d596a0007028a15"; // here put your widget id
(function() {
View widget1.html
<!-- Start of BotEngine (www.botengine.ai) code -->
<script type="text/javascript">
var disabledPages = [
"/home"
]
if (disabledPages.indexOf(window.location.pathname) === -1) {
window.__be = window.__be || {};
window.__be.id = "5a9e58267d596a0007028a15";
View widget.html
<!-- Start of BotEngine (www.botengine.ai) code -->
<script type="text/javascript">
var default = "5a9e58267d596a0007028a15";
var pages = {
"/home": "5a9e58267d596a0007028a25",
"/contact": "5a9e58267d596a0007028a25"
};
window.__be = window.__be || {};
window.__be.id = pages[window.location.pathname] || default;
View webhook_with_attributes.js
'use strict';
const http = require('http');
const url = require('url');
const querystring = require('querystring');
const token = 'secret'; // replace to process.env.TOKEN for non development
const server = http
.createServer((req, res) => {
View index.html
<html>
<head>
<title>Landing bot with BotEngine.ai</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet">
<style type="text/css">
* {
font-family: 'Open Sans', sans-serif;
box-sizing: border-box;
View example_webhook_response.json
{
"parameters": {
"name": "John",
"email": "john@example.com"
}
}
View livechat-parameters.md

ChatBot with LiveChat

1. Supported parameters:

  • default_id
  • default_name
  • default_email
  • default_ip
  • default_city
  • default_region
You can’t perform that action at this time.