This file contains 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> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=0,viewport-fit=cover"> | |
<title>My LIFF App</title> | |
<style> | |
body { padding: 256px } | |
button { display: none; width: 50%; padding: 16px 0; margin: 16px auto } | |
</style> |
This file contains 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"); | |
exports.myCallable = functions.https.onCall(async (data, context) => { | |
// รับค่า base64 ที่ได้จาก LIFF app โดย split เพื่อตัด type ที่นำหน้าออก | |
const base64 = data.base64.split(",") | |
// import และ initial ตัว lib ของ Cloud Vision API | |
const vision = require('@google-cloud/vision') | |
const client = new vision.ImageAnnotatorClient() | |
This file contains 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 admin = require("firebase-admin"); | |
admin.initializeApp({ | |
credential: admin.credential.applicationDefault(), | |
databaseURL: 'https://<YOUR-PROJECT-ID>.firebaseio.com' |
This file contains 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
exports.dialogflowFirebaseFulfillment = functions.https.onRequest((request, response) => { | |
const agent = new WebhookClient({ request, response }); | |
function confirmAppointment(agent) { | |
const dateTimeStart = new Date( | |
Date.parse(agent.parameters.date.split('T')[0] + 'T' + agent.parameters.time.split('T')[1]) | |
); | |
const appointmentTimeString = dateTimeStart.toLocaleString( | |
'en-US', | |
{ weekday: 'short', day: 'numeric', month: 'short', hour: 'numeric', minute: 'numeric', timeZone: 'Asia/Bangkok' } | |
); |
This file contains 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, Payload } = require("dialogflow-fulfillment"); | |
const functions = require("firebase-functions"); | |
const { google } = require('googleapis'); | |
const calendarId = "88888888888888@group.calendar.google.com"; | |
const serviceAccount = { | |
"type": "service_account", | |
"project_id": "line-bot", |
This file contains 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
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>My LIFF v2</title> | |
<style> | |
#pictureUrl { display: block; margin: 0 auto } | |
</style> | |
</head> | |
<body> |
This file contains 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> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<title>LIFF - LINE Front-end Framework</title> | |
<style> | |
body { margin: 16px } | |
button, img { display: none; width: 40% } | |
button { padding: 16px } |
This file contains 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 request = require("request-promise"); | |
const LINE_MESSAGING_API = "https://api.line.me/v2/bot/message"; | |
const LINE_HEADER = { | |
"Content-Type": "application/json", | |
"Authorization": "Bearer <CHANNEL-ACCESS-TOKEN>" | |
}; | |
exports.AdvanceMessage = functions.https.onRequest((req, res) => { |
NewerOlder