Last active
May 27, 2019 19:44
-
-
Save jirawatee/9c0d29a1f73c259d94f8281038bd40dd to your computer and use it in GitHub Desktop.
Structure of UCL Webhook API by Cloud Functions for Firebase
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
exports.UCL = functions.region(region).runWith(runtimeOpts) | |
.https.onRequest(async (req, res) => { | |
let event = req.body.events[0] | |
switch (event.type) { | |
case 'message': | |
if (event.message.type === 'image') { | |
// [8.3] | |
} else if (event.message.type === 'text' && event.message.text === 'subscribe') { | |
// [8.2] | |
} else { | |
// [8.1] | |
} | |
break; | |
case 'postback': { | |
// [8.4] | |
break; | |
} | |
} | |
return null; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment