Skip to content

Instantly share code, notes, and snippets.

@dtinth dtinth/index.ts
Created Oct 27, 2018

What would you like to do?
import * as functions from 'firebase-functions'
import * as admin from 'firebase-admin'
import 'firebase-functions'
import express from 'express'
import { middleware, Client } from '@line/bot-sdk'
export const bot = functions.https.onRequest((req, res) => {
const config = {
channelAccessToken: functions.config(),
channelSecret: functions.config()
middleware(config)(req, res, err => {
if (err) {
console.error('LINE bot middleware error:', err)
res.status(500).send('LINE bot middleware error')
const client = new Client(config)
for (const event of {
if (event.type === 'message') {
client.replyMessage(event.replyToken, [{ type: 'text', text: 'meow' }])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.