Make Kik Bot listen on port 8080 without ngrok

191 views Asked by At

Hello,

I am programming a Kik Bot in node.js and I'm using a VPS where my website (on an apache server) is located aswell. I used ngrok for the tunneling but I don't want to change the link every time I reload. So now I want to use the domain of my website instead.

But I am not sure how to do that. The last line of my index.js is

let server = http.createServer(bot.incoming()).listen(process.env.PORT || 8080);

and on the top I have

let Bot = require('@kikinteractive/kik');
let bot = new Bot({
    username: 'mybotname',
    apiKey: 'my-api-key-goes-here', 
    baseUrl: 'http://example.com'
});

That doesn't quite work though. With ngrok the bot worked perfectly fine but I have no idea how to use the server without ngrok. I also tried to change the port in the last line from 8080 to 80. But that doesn't work because I get an exception telling me, the port is already in use (obviously by apache).

Thank you

1

There are 1 answers

0
Conquer Requiem On

Don't know if it is any help, but running a bot off a domain is a little tricky. You can use the port of the domains IP address, but you'd need to have a static address.

Try this link

You will need a static IP and then direct your program to the domain's IP that is setup.