Skip to content

Instantly share code, notes, and snippets.

@jirawatee
Last active May 25, 2020 08:35
Show Gist options
  • Save jirawatee/528544fe9bbdd68cca07c0ba9207fdd0 to your computer and use it in GitHub Desktop.
Save jirawatee/528544fe9bbdd68cca07c0ba9207fdd0 to your computer and use it in GitHub Desktop.
Resize image by Firebase Extension - 1
exports.uploadPhoto = functions.https.onRequest(async (req, res) => {
let event = req.body.events[0]
if (event.type === 'message' && event.message.type === 'image') {
// เรียกฟังก์ชัน upload เมื่อเข้าเงื่อนไข
let urls = await upload(event)
// reply ตัว URL ที่ได้กลับไปยังห้องแชท
await reply(event.replyToken, { type: "text", text: urls })
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment