intergram icon indicating copy to clipboard operation
intergram copied to clipboard

Intergram installation issue

Open tshpr opened this issue 5 years ago • 1 comments

I am trying to install the Intergram bot on my sever, but getting an issue. Is the hook supposed to return anything?

Also, second question: How does one set environment variables on nodejs?

curl -v localhost:3000/intergram/hook

  • About to connect() to localhost port 3000 (#0)
  • Trying ::1...
  • Connected to localhost (::1) port 3000 (#0)

GET /intergram/hook HTTP/1.1 User-Agent: curl/7.29.0 Host: localhost:3000 Accept: /

< HTTP/1.1 404 Not Found < X-Powered-By: Express < X-Content-Type-Options: nosniff < Content-Type: text/html; charset=utf-8 < Content-Length: 27 < Date: Sun, 23 Jun 2019 10:51:46 GMT < Connection: keep-alive < Cannot GET /intergram/hook

  • Connection #0 to host localhost left intact

tshpr avatar Jun 23 '19 10:06 tshpr

HI, yes, this path /hook supposed to return something, but to telegram server, that's why you have to send this request to them: https://api.telegram.org/bot<TOKEN>/setWebhook?url=<Server url>/hook. You try to send GET request to your server, but look to server.js file, there is no endpoint GET: /hook, however there is a POST. To set env variable, use: export TELEGRAM_TOKEN=................. or you can start your server like this: TELEGRAM_TOKEN=... PORT=88 node server.js or you can modify your package.json :

  "scripts": {
    "start": "PORT=3003 TELEGRAM_TOKEN=...  node server.js",
....

and then just user classic 'npm run start' command to launch it.

balalamba avatar Oct 31 '20 09:10 balalamba