Skip to content

Instantly share code, notes, and snippets.

@tandevmode
Created November 1, 2019 10:28
Show Gist options
  • Save tandevmode/7fcc2aa75322ea8b752bc0fe355d9eb2 to your computer and use it in GitHub Desktop.
Save tandevmode/7fcc2aa75322ea8b752bc0fe355d9eb2 to your computer and use it in GitHub Desktop.
exports.LineWebhook = functions.region(REGION).runWith(runtimeOpts).https.onRequest(async (req, res) => {
let event = req.body.events[0];
if (event.message.type === 'text') {
let input = event.message.text;
await admin.firestore().collection('translations').doc('inputText').set({
input: input
}).then(function () {
console.log("Document successfully written!");
}).catch(function (error) {
console.error("Error writing document: ", error);
});
}
return res.status(200).send(req.method);;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment