Skip to content

Instantly share code, notes, and snippets.

View anton-dudarev's full-sized avatar
🎯
Focusing

Anoubis anton-dudarev

🎯
Focusing
View GitHub Profile
@pkarthikr
pkarthikr / index.js
Created January 25, 2019 17:17
Implementing Fulfillments and Webhooks in Dialogflow
// 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
@naranjja
naranjja / index.js
Last active March 10, 2022 00:16
Google Analytics tracking using Dialogflow API v2 and some REST API
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":
@anton-dudarev
anton-dudarev / DatabaseFromSpreadsheet.js
Created January 4, 2019 18:17 — forked from brainysmurf/DatabaseFromSpreadsheet.js
In AppMaker, use this to read in data from a Spreadsheet.
/**
* 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)
@brainysmurf
brainysmurf / Descriptors.gs
Last active January 4, 2019 17:47
Descriptors for Google Apps Scripts
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) {
'use strict';
const {WebhookClient} = require('dialogflow-fulfillment');
const {
Permission,
dialogflow,
Image,
BasicCard,
BrowseCarousel,
BrowseCarouselItem,
@balsimpson
balsimpson / dialogflowResponses.js
Last active January 6, 2020 21:33
Dialogflow responses for FB Messenger integration.
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`
@onimenotsuki
onimenotsuki / index.js
Created December 24, 2018 07:04
Fulfilment for musixmatch chatbot
// 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
@ekumachidi
ekumachidi / virtualbanker.js
Created November 25, 2018 15:19
firebase functions for virtual banker
'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;
@maxim-uvarov
maxim-uvarov / PrettySourcesDateTableRu.m
Created November 14, 2018 13:27 — forked from DmitriyVlasov/PrettySourcesDateTableRu.m
функция в Power Query (язык M) создает таблицу с датами. Дополняет ее различными столбцами, включая данные о государственных выходных дня в РФ.
// 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 - год
<!doctype html>
<html>
<head>
<title>API Connection Test!</title>
<style>
body {
font: 13px Helvetica, Arial;
height: 400px;
width: 50%;
margin: 200px auto;