How do I made ngrok server run forever? - ngrok

I want to have my website online on ngrok 24/7, but it's session will expire after 2 hours. Is there any way to have it run forever, or any alternative software that I should use?

If you sign up for an account on ngrok.com, whether free or paid, you will have tunnels that run with no time limit (aka "forever").

If you don't care about domain address persistence and you use Discord and you want to use it just for testing, sharing it for friends to view you can use this:
https://github.com/winter-b/ngrok-bot
It's a Discord bot which executes shell commands every two hours to restart ngrok tunnel, get the url, and send it to the specified Discord channel.
First create a Discord bot, how to here https://discord.com/developers/docs/intro, get the bot token, put the bot in your Discord server, get the channel id you want to send url's to, put the discord bot token and channel id in settings.json
run in directory
npm install
npm start
it's not perfect, but gets the job done for particular scenarios

Related

Run telegram bot in multiple clusters using pm2

I'm currently running a telegram bot using the node-telegram-bot-api.
But now the project is getting bigger and bigger and more users are using my bot.
So I had some difficulties when I had to re-deploy my app while many people are still on access.
I tried to run multiple clusters using pm2 and then use pm2 reload to gracefully restart my app in zero downtime.
But then I got an error from telegram:
error: [polling_error] {"code":"ETELEGRAM","message":"ETELEGRAM: 409 Conflict: terminated by other getUpdates request; make sure that only one bot instance is running"}
I think telegram doesn't provide multiple instances in the same server.
Is there any solutions for this kind of problem?
Even if you could run script twice, users will get answers twice when they sends commands to bot.
you have two options two do:
Upgrade Your resources (RAM/CPU/...)
Handle incoming messages with your main script, make a API and do processes in API backend.

Make http request from local device using DialogFlow

I'm a newbie to DialogFlow and I don't event know if what I want to achieve is possible.
I'm trying to create a DialogFlow intent that would make an HTTP request from the user device after receiving a given command. I know how to do this with webhooks, but problem is that webhooks HTTP requests come from Google servers, and not the user device.
The reason why I want the request to come from user device is that the receiver will only listen to local network (it's a web server running in an internet router). So this will only work if the HTTP request comes from a device connected to the router.
A workaround could be to create a public tunnel to the router (with softs like ngrok), but my application aims at real users, so I would prefer to avoid this complex setup.
Is it possible to do local requests with DialogFlow? Or is there another Google-Assistant API I could use for this purpose, like Google IoT solution?
Thanks
You could do this, but you wouldn't necessarily do it like a regular Dialogflow project. Here are the steps:
Build your Action through Dialogflow and add web fulfillment
Add a way to push a notification of some sort to your local device
This could listening to a database, polling, push notifications, etc.
When your device gets that notification, it performs the action locally
If you want this local action response to be sent back, you could update the webhook through an HTTP response (if making an HTTP call) or updating a field in a cloud-based database.
Actions do have a timeout of around 5 seconds to get a response, so be aware of that limit if you want to do this

Can a telegram bot running on node.js be hacked

Lets say we have a telegram bot running on node.js using node library: node-telegram-bot-api
Do we need to worry about any security problems, like can someone hack my server and access the source code or data through the API connection?
Don't worry about it, every API connection is through HTTPS, which is regarded as safe.

Connecting Slack, Api.ai & Google Calendar

I know exactly what I want to achieve, but need some help to be able to start.
Flow:
Automatic periodic checking of my gCalendar to see if I just finished a meeting
Sending message to Slack with question "What is to-do list after the meeting?"
User writes a response.
Response get stored in Google Sheet.
My main concern right now are steps 1 and 2: is Api.ai capable of automatic periodic checking of my gCalendar by itself, so when my meeting is over, I get message in Slack and then I can continue normal communication with the Api.ai bot?
The problem I see here is that I expect Api.ai to push a message to Slack after some external trigger instead of waiting trigger from me as a Slack user.
If you haven't done so, you may want to check Bot Users which enable teams to conversationally interact with external services or your custom code by building bot users.
What can bot users do?
The primary way bot users interact with people on a given team is by connecting to the Real Time Messaging API (RTM API for short) and opening up a websocket connection with Slack.
The Events API is an alternative way to receive and respond to events as a bot user contained within a Slack App. Instead of connecting over a websocket, you subscribe to specific events and messages and Slack sends them to your server.
Secondly, you may want to also check the Bot implementation given in this GitHub post or you may try to customize your bot behavior using the following steps:
Clone the repository https://github.com/api-ai/api-ai-slack-bot
Change the code to index.js
In the Docker, use the run command specifying the full path to the directory containing the index.js file:
run command:
docker run -d --name slack_bot \
-e accesstoken="Api.ai client token" \
-e slackkey="Slack bot user key" \
-v /full/path/to/your/src:/usr/app/src \
speaktoit/api-ai-slack-bot
Lastly, for additional information, please also see Slack Integration documentation wherein it gives guidelines on how you can set up Slack Integration in API.AI. Please also see Slack Help Center for ways on how you can connect Google Calendar to Slack.

SNS push notification service only success on dedicated device

I've been trying to use AWS SNS service to send notifications to Apple Sandbox environment . I think I setup everything ok and my dev iPhone can get notification without trouble.
But when I start to send notifications to others who install the test app , I keep seeing error message state that
Platform token associated with the endpoint is not valid
With a messageId :147975e0-8a09-5223-8537-256320ab3733
From what I understand , if one device can success, others can success too.
Could anyone tell me how to debug this probelm.
Thanks.
I believe that the apps that the other people are installing were not built with a dev cert (probably built with an adhoc or production provisioning profile), so you probably should use the production certificate.
You could try adding another application on SNS using the production certificate (or the same one, but not using Sandbox, depending on how you generated it), if it works, that this is it.
Also make sure you are using the correct bundle id associated with the certificate.

Resources