Closed Matvert closed 2 years ago
You can use API and webhooks separately.
Monolith way:
const cryptoPay = new CryptoPay(token, {
hostname: 'testnet-pay.crypt.bot',
webhook: { serverHostname: '0.0.0.0', serverPort: process.env.PORT, path: '/secret-path' }
})
// API method
cryptoPay.getMe().then(app => console.log(app))
// Webhook update
cryptoPay.invoicePaid(update => console.log(update.payload))
Separate work:
const cryptoPay = new CryptoPay(token, { hostname: 'testnet-pay.crypt.bot' })
// API method
cryptoPay.getMe().then(app => console.log(app))
const cryptoPay = new CryptoPay(token, {
webhook: { serverHostname: '0.0.0.0', serverPort: process.env.PORT, path: '/secret-path' }
})
// Webhook update
cryptoPay.invoicePaid(update => console.log(update.payload))
I am hosting my bot on heroku and cannot use webhooks with your library because of heroku limitations. It would be very useful to be able to mount webhooks to an existing http server.