Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GUIDE - Standalone install on Ubuntu 18.04 in 5 minutes #88

Open
xewonder opened this issue Apr 30, 2020 · 2 comments
Open

GUIDE - Standalone install on Ubuntu 18.04 in 5 minutes #88

xewonder opened this issue Apr 30, 2020 · 2 comments

Comments

@xewonder
Copy link

xewonder commented Apr 30, 2020

Install on Ubuntu 18.04.4 LTS to run standalone
(I condense a 14 hour research and headaches into a 5 minutes install)

Make sure you have the latest node.js and npm

Create your bot with @Botfather (/newbot)

add TELEGRAM_TOKEN with the value you got from @Botfather in /etc/environment (TELEGRAM_TOKEN="theToken Value")

apt-get update

apt-get install -y curl gnupg2 git build-essential

cd /opt

git clone https://github.com/idoco/intergram

cd /opt/intergram

edit server.js and add the following at the top:

const fs = require('fs') // Required for reading the certificate and key files
let options = { key: fs.readFileSync("/opt/intergram/key.pem"), cert: fs.readFileSync("/opt/intergram/bundle.crt") };

replace the line
const http = require ('http').Server(app);
with
const http = require ('https').Server(options,app);

change the port as 3000 does not seem to be allowed -i have also added a line to see if we get the TELEGRAM_TOKEN from environment
http.listen(process.env.PORT || 8443, function(){
console.log('listening on port:' + (process.env.PORT || 8443));
console.log(process.env.TELEGRAM_TOKEN);
});

IMPORTANT! YOUR CERTIFICATE MUST ALSO CONTAIN THE INTERMEDIATE CERTIFICATE AT THE BOTTOM OTHERWISE THE HOOK WILL NOT WORK
SEE https://cubewebsites.com/guides/fix-telegram-webhooks-not-working/

Point the bot webhook to your bot server by making a GET request to the following url (just put the address in your browser)
https://api.telegram.org/bot<TOKEN>/setWebhook?url=<https://yourServerURL:8443>/hook

npm install

npm run build

npm start

you should see:
listening on port:8443
1xxxxxxxxxxxxxxxxxV10etq-UVxxxxxxxxxxxxxhAIU3XYZtkI

test by navigating on your browser to https://yourServerURL:8443
you should get the demo page

type /start in your bot in order to get the client-id

in your project:
window.intergramId = "client-id"
window.intergramServer = "https://yourServerURL:8443"

<script id="intergram" type="text/javascript" src="yourServerURL:8443/js/widget.js"></script>

Hope this helps

@xewonder xewonder changed the title Standalone install on Ubuntu 18.04 in 5 minutes GUIDE - Standalone install on Ubuntu 18.04 in 5 minutes Apr 30, 2020
fox34 added a commit to fox34/intergram that referenced this issue May 4, 2020
Add Ubuntu Guide from idoco#88
@MaxflowO2
Copy link

thank you... made my 14 hours about 5 hours... should have read this first

@mdestafadilah
Copy link

mdestafadilah commented Dec 13, 2022

Done. my problem #121 (missing parameter)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants