Skip to content

Instantly share code, notes, and snippets.

View kamnan43's full-sized avatar

Sitthi Thiammekha kamnan43

View GitHub Profile
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<!-- <meta http-equiv = "refresh" content = "0; url = line://app/1234567890-liffappid/path?id=xxx" /> -->
<title>Facebook to LINE LIFF Redirect</title>
</head>
<body>
<script>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=0, shrink-to-fit=no" />
<meta name="theme-color" content="#000000" />
<title>TEST</title>
</head>
{
"size": {
"width": 2500,
"height": 843
},
"selected": true,
"name": "Rich Menu A",
"chatBarText": "เมนู",
"areas": [
{
{
"size": {
"width": 2500,
"height": 1686
},
"selected": true,
"name": "Rich Menu B",
"chatBarText": "เมนู",
"areas": [
{
liff.getFriendship().then(data => {
if (data.friendFlag) {
// something you want to do
} else {
// not friend or being blocked, force to add friend
window.location = 'https://line.me/R/ti/p/<OA_BASICID>'
}
})
@kamnan43
kamnan43 / dialogflow.js
Last active January 18, 2022 14:12
dialogflow.js
const functions = require("firebase-functions");
const request = require('request');
const crypto = require('crypto');
const config = {
agentId: functions.config().dialogflow.agent_id,
channelSecret: functions.config().line.channel_secret
}
function postToDialogflow(req) {
@kamnan43
kamnan43 / app.ts
Last active December 23, 2021 21:08
import * as cors from 'cors';
import * as express from 'express';
import Line from './line';
class App {
private _basePathApi = '';
public app: express.Application;
public line: Line
constructor() {
@kamnan43
kamnan43 / line.ts
Last active December 23, 2021 21:11
import {
Client,
middleware,
WebhookEvent,
MessageAPIResponseBase,
TextMessage
} from "@line/bot-sdk"
import { Request, Response } from 'express';
const functions = require('firebase-functions');
import DB from './firestore'
import { initializeApp, firestore } from "firebase-admin"
interface UserProfile {
displayName: string
statusMessage: string
userId: string
pictureUrl: string
allowNotification: boolean
}
import { StrictMode } from "react";
import ReactDOM from "react-dom";
import App from "./App";
const rootElement = document.getElementById("root");
ReactDOM.render(
<StrictMode>
<App />
</StrictMode>,