This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// See https://github.com/dialogflow/dialogflow-fulfillment-nodejs | |
// for Dialogflow fulfillment library docs, samples, and to report issues | |
'use strict'; | |
const functions = require('firebase-functions'); | |
const {WebhookClient} = require('dialogflow-fulfillment'); | |
const {Card, Suggestion} = require('dialogflow-fulfillment'); | |
process.env.DEBUG = 'dialogflow:debug'; // enables lib debugging statements | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const ua = require("universal-analytics"); | |
const request = require("request-promise"); | |
const { https } = require("firebase-functions"); | |
function getUserID (obj) { | |
if (!obj.source) { | |
return "dialogflow"; | |
} else { | |
switch (obj.source) { | |
case "twilio": |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* DataFromSpreadsheet: Read in Spreadsheet info for a Calculated Datasource in AppMaker. Use a spreadsheet to define a datasource. | |
* Useful for data modeling, simple Apps. | |
* Does not support paging; sheets with large number of rows will see performance penalties | |
* @param {object} params | |
* @param {string} params.spreadsheetId The ID of the source spreadsheet | |
* @param {string} params.sheetName The name of the source sheet | |
* @param {string} params.datasource The name of the target datasource | |
* @param {number} params.numHeaders How many rows are headers (default = 1) | |
* @param {number} params.headerRow Which row contains the name of the field (default=params.numHeaders-1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Object.defineProperty(Object.prototype, '__descriptor', { | |
set: function (options) { | |
if (options.getter) { | |
Object.defineProperty(this, options.property, { | |
get: options.getter, | |
configurable: true, | |
enumerable: true | |
}); | |
} | |
if (options.set) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const {WebhookClient} = require('dialogflow-fulfillment'); | |
const { | |
Permission, | |
dialogflow, | |
Image, | |
BasicCard, | |
BrowseCarousel, | |
BrowseCarouselItem, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Dialogflow = { | |
fulfillmentMessages: [], | |
text: function (txt) { | |
// console.log(typeof txt); | |
if (typeof txt === 'string') { | |
txt = `${txt}` | |
} else { | |
txt = `${txt.title}\n\n${txt.upvotes} upvotes | ${txt.comments} comments\n\n` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// See https://github.com/dialogflow/dialogflow-fulfillment-nodejs | |
// for Dialogflow fulfillment library docs, samples, and to report issues | |
'use strict'; | |
const functions = require('firebase-functions'); | |
const { WebhookClient } = require('dialogflow-fulfillment'); | |
const axios = require('axios'); | |
process.env.DEBUG = 'dialogflow:debug'; // enables lib debugging statements | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
var https = require('https'); | |
const functions = require('firebase-functions'); | |
exports.dialogflowFirebaseFulfillment = functions.https.onRequest((request, response) => { | |
const action = request.body.result.action; | |
response.setHeader('Content-Type','application/json'); | |
const parameters = request.body.result.parameters; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// killerDateTableRu | |
// функция killerDateTableRu создает таблицу с датами. Дополняет ее различными полезными для Time Intelligence столбцами. | |
// В случае, если четвертый аргумент принимает Дни 1, то функция добавляет столбец с выходными. | |
// Оригинальная идея philbritton https://gist.github.com/philbritton/9677152 | |
// пример: killerDateTableRu(#date(2017, 2, 1), #date(2017, 2, 4), "RU-ru", 1) | |
// Описание полей результирующей таблицы: | |
// =================================================== | |
// Date - дата | |
// Year - год |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
<title>API Connection Test!</title> | |
<style> | |
body { | |
font: 13px Helvetica, Arial; | |
height: 400px; | |
width: 50%; | |
margin: 200px auto; |