Skip to content

Instantly share code, notes, and snippets.

Last active March 10, 2022 11:09
  • Star 16 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save waylybaye/f0ba12d5f0959adcab998d2675b37760 to your computer and use it in GitHub Desktop.
Send Notification using Telegram when new IAP is purchased
const functions = require('firebase-functions');
const TelegramBot = require('node-telegram-bot-api');
const token = "***"
const chatID = 1024 // your telegram id, you must first send a message to your bot
exports.notifyIAP ='in_app_purchase').onLog((event) => {
const purchaseValue = event.valueInUSD;
if (purchaseValue > 0) {
const bot = new TelegramBot(token, {polling: false});
return bot.sendMessage(chatID, "苹果宝到账: $" + (purchaseValue * 0.7).toFixed(2))
Copy link

arkilis commented Jun 19, 2020

你好,如何才能得到 firebase events,一个event被出发,firebase console里面好像没有可以指定后续动作的地方,谢谢

Copy link

你好,如何才能得到 firebase events,一个event被出发,firebase console里面好像没有可以指定后续动作的地方,谢谢


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment