Skip to content

Instantly share code, notes, and snippets.

@drewrothstein
Created June 28, 2021 23:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save drewrothstein/7babd3470b41d84320a42a530ea973e0 to your computer and use it in GitHub Desktop.
Save drewrothstein/7babd3470b41d84320a42a530ea973e0 to your computer and use it in GitHub Desktop.
Function Webhook
const {
conversation,
} = require('@assistant/conversation');
const functions = require('firebase-functions');
const fetch = require('node-fetch');
const app = conversation({debug: true});
const URL = 'https://<YOUR FUNCTION URL>.cloudfunctions.net/automower';
app.handle('default', async conv => {
const apiResponse = await fetch(URL);
const text = await apiResponse.text();
conv.add(text);
});
exports.ActionsOnGoogleFulfillment = functions.https.onRequest(app);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment