Comments (11)
@gomez-git could you take a look at #30 and leave an approval there if you could make it work?
I think about this one
import { Bot, webhookCallback } from 'grammy';
import fastify from 'fastify';
import ngrok from '@ngrok/ngrok';
const { BOT_TOKEN, PORT, SECRET_TOKEN } = process.env;
const bot = new Bot(BOT_TOKEN);
bot.on('message:text', (ctx) => ctx.reply(ctx.message.text));
const server = fastify();
server.post('/webhook', webhookCallback(bot, 'fastify', { secretToken: SECRET_TOKEN }));
server.listen({ port: +PORT }, async (err, address) => {
if (err) {
console.error(err);
process.exit(1);
}
const url = await ngrok.connect(+PORT);
await bot.api.setWebhook(`${url}/webhook`, { secret_token: SECRET_TOKEN });
});
from examples.
Yes, let's do that. @AbbassAlmusawi could you update your code in #30 with the above package? I'll merge after that.
from examples.
@gomez-git could you take a look at #30 and leave an approval there if you could make it work?
from examples.
Perhaps we should use the official package https://www.npmjs.com/package/@ngrok/ngrok instead?
from examples.
Perhaps we should use the official package https://www.npmjs.com/package/@ngrok/ngrok instead?
I use it in my snippet, isn't it?
from examples.
No. You're using https://github.com/bubenshchykov/ngrok. See https://t.me/grammyjs/166618.
from examples.
@KnorpelSenf They are importing @ngrok/ngrok
in #29 (comment), 3rd line.
from examples.
Oh what
from examples.
I'm blind
from examples.
Dockerfile
FROM node:18-alpine
WORKDIR /usr/src
COPY ./package*.json ./
EXPOSE 443
RUN npm ci
COPY . ./
CMD ["ts-node", "fastify-ngrok-webhook.ts"]
.dockerignore
node_modules
command
docker build --tag grammy_fastify_example .
docker run --detach \
--name grammy_fe \
-e BOT_TOKEN='' \
-e PORT='' \
-e SECRET_TOKEN='' \
grammy_fastify_example
from examples.
Done, please see #30 and tell me if there are any mistakes of suggestions
from examples.
Related Issues (8)
- Conversations. switching between questions. & input validation HOT 5
- Add stickers (including animated) examples HOT 3
- next-node webhook example fails in Vercel production environment HOT 1
- Im trying to use grammy on my next.js project but whatever i do i get this HOT 5
- Deno deploy example HOT 5
- need Nuxt3 example HOT 3
- Fastify + grammyjs + long polling HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from examples.