Skip to content

Instantly share code, notes, and snippets.

@yi-jiayu
Last active November 6, 2017 12:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yi-jiayu/62aa874f4368912963f6bed9605a8748 to your computer and use it in GitHub Desktop.
Save yi-jiayu/62aa874f4368912963f6bed9605a8748 to your computer and use it in GitHub Desktop.
Source code for a simple Telegram bot on Google Cloud Functions
exports.haha = function (req, res) {
const update = req.body;
console.log(JSON.stringify(update));
// update contains a message
if (update.hasOwnProperty('message')) {
// call the sendMessage method
const reply = {
method: 'sendMessage',
chat_id: update.message.chat.id,
text: 'haha',
};
return res.json(reply);
}
return res.sendStatus(200);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment