https://developers.google.com/assistant/conversational/build
https://developers.google.com/assistant/conversational/prompts
https://developers.google.com/assistant/conversational/webhooks
function drawMap() { | |
// draw a map using leafletjs and tiles from mapbox | |
var mymap = L.map('mapid').setView([32.221041, -110.971143], 15); | |
L.tileLayer('https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token={accessToken}', { | |
attribution: 'Map data © <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, <a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery © <a href="https://www.mapbox.com/">Mapbox</a>', | |
maxZoom: 18, | |
id: 'mapbox/streets-v11', | |
tileSize: 512, | |
zoomOffset: -1, | |
accessToken: 'ACCESS_TOKEN_HERE' |
function addPin(mymap, lat, lon, name) { | |
// add a pin to mymap at lat, lon with a popup | |
L.marker([lat, lon]).addTo(mymap).bindPopup(name); | |
} |
<?xml version="1.0" encoding="UTF-8" ?> | |
<rss version="2.0"> | |
<channel> | |
<title>FEED TITLE</title> | |
<link>FEED LINK</link> | |
<description>FEED DESCRIPTION</description> | |
<item> | |
<pubDate>Mon, 19 Oct 2020 09:00:00 -0700</pubDate> | |
<title>ITEM ONE TITLE</title> | |
<link>ITEM ONE LINK</link> |
const { conversation } = require('@assistant/conversation'); | |
const functions = require('firebase-functions'); | |
const app = conversation(); | |
// ************ | |
// panda trivia | |
// ************ | |
app.handle('panda_handle', conv => { | |
// create a variable to hold the response |
app.handle('coin_handle', (conv) => { | |
// create a variable to hold the response | |
var response = ""; | |
// create a constant to hold what the user picked | |
const userSide = conv.intent.params.coin_slot.resolved; | |
response += "You picked " + userSide + ". "; | |
// generate a random number between 0 and 1 |
// **************** | |
// read an rss feed | |
// **************** | |
app.handle('rss_handle', async (conv) => { | |
// build a date string | |
var date = new Date(); | |
var dateMonthDate = date.getMonth() + 1; | |
dateMonthDate += "-"; | |
dateMonthDate += date.getDate(); |
// ************************* | |
// play media in an rss feed | |
// ************************* | |
app.handle('play_handle', async (conv) => { | |
// rss-parser (https://www.npmjs.com/package/rss-parser) | |
let Parser = require('rss-parser'); | |
// create a new parser with custom fields | |
let parser = new Parser({ |
app.handle('loop_handle', (conv) => { | |
var response = ""; | |
var loopCounter = conv.user.params.counter; | |
if (loopCounter > 0) { | |
loopCounter += 1; | |
} else { | |
loopCounter = 1; |
app.handle('sheet_handle', async (conv) => { | |
// create a response | |
var response = ""; | |
// setup the package | |
const { GoogleSpreadsheet } = require('google-spreadsheet'); | |
// the spreadsheet id can be found in the URL of your sheet | |
const doc = new GoogleSpreadsheet('SHEET_ID_HERE'); |