Created
November 1, 2019 10:28
-
-
Save tandevmode/7fcc2aa75322ea8b752bc0fe355d9eb2 to your computer and use it in GitHub Desktop.
This file contains 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.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