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 admin = require('firebase-admin'); | |
admin.initializeApp({ | |
credential: admin.credential.applicationDefault(), | |
storageBucket: "YOUR STORAGE BUCKET URL HERE" | |
}); | |
const settings = { timestampsInSnapshots: true}; | |
const db = admin.firestore(); | |
db.settings(settings); | |
const bucket = admin.storage().bucket(); |
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 axios = require('axios'); | |
function getFacebookData(){ | |
const PAGE_ACCESS_TOKEN=`YOUR_PAGE_ACCESS_TOKEN`; | |
const fb_id = request.body.originalDetectIntentRequest.payload.data.sender.id; | |
return axios.get(`https://graph.facebook.com/v6.0/${fb_id}?fields=first_name,last_name,profile_pic&access_token=${PAGE_ACCESS_TOKEN}`); | |
} | |
function welcome(agent) { | |
return getFacebookData() |
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 unirest = require('unirest'); | |
const { base64encode } = require('nodejs-base64'); | |
function sendWhatsappMedia(MediaUrl){ | |
// ENTER THE DETAILS BELOW | |
const AccountSID = "YOUR TWILIO ACCOUNT SID"; | |
const AuthToken = "YOUR TWILIO AUTH TOKEN"; | |
// DO NOT CHANGE ANYTHING BELOW | |
const data = request.body.originalDetectIntentRequest.payload; |
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 functions = require('firebase-functions'); | |
const {WebhookClient} = require('dialogflow-fulfillment'); | |
const {Card, Suggestion} = require('dialogflow-fulfillment'); | |
const axios = require('axios'); | |
const nodemailer = require("nodemailer"); | |
const mysql = require('mysql'); | |
const transporter = nodemailer.createTransport({ |
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 axios = require('axios'); | |
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 | |
exports.dialogflowFirebaseFulfillment = functions.https.onRequest((request, response) => { |
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 mysql = require('mysql'); | |
function connectToDatabase(){ | |
const connection = mysql.createConnection({ | |
host : 'HOST', | |
user : 'USER', | |
password : 'PASSWORD', | |
database : 'DATABASE' | |
}); | |
return new Promise((resolve,reject) => { |
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 nodemailer = require("nodemailer"); | |
const transporter = nodemailer.createTransport({ | |
service: 'gmail', | |
auth: { | |
user: 'YOUR_GMAIL_ID', | |
pass: 'YOUR_GMAIL_PASSWORD' | |
} | |
}); |
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 functions = require('firebase-functions'); | |
const admin = require('firebase-admin'); | |
const {WebhookClient} = require('dialogflow-fulfillment'); | |
admin.initializeApp({ | |
credential: admin.credential.applicationDefault(), | |
databaseURL: 'ws://DATABASE_UNIQUE_ID.firebaseio.com/' | |
}); | |
exports.dialogflowFirebaseFulfillment = functions.https.onRequest((request, response) => { |