remotepn
v1.0.8
Published
Looking for a way to prompt users for a string or OTP while running a server bash script or scheduled server code? Look no further than Remote Prompt Notification! This npm package sends a Telegram notification where users can respond, and the answer will
Downloads
4
Readme
Remote Prompt Notification
Looking for a way to prompt users for a string or OTP while running a server bash script or scheduled server code? Look no further than Remote Prompt Notification! This npm package sends a Telegram notification where users can respond, and the answer will be received by your script. Plus, it supports thumbs-up 👍 and thumbs-down 👎 emojis to output a "Y" or "N" string for easy interaction.
- Lightweight (less than 10kb)
- Zero external depedencies
- Uses Telegram APIs with native node fetch
How to use it
- Create a BOT on Telegram with Bothfather and take note of the bot TOKEN
- Start a chat with your bot on Telegram (Important in order to allow the BOT to send messages to you)
- Retrieve your Telegram User ID in telegram by starting a chat with
@userinfobot
you will receive your user id number (eg. 101111333)
Bash / Shell
Command:
npx remotepn --telegramToken=6953209111:AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA --telegramUser=101111333 --message="How are you?"
Output: Message answer string or "Y"/"N" in case of thumbs-up or thumbs-down reaction.
Javascript / Typescript
npm i remotepn
import RemotePN from "remotepn";
const client = new RemotePN({
telegramToken: "6953209111:AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
telegramUser: 101111333,
});
const answer = await client.prompt("Hello World");
console.log(answer); // Message answer string or "Y"/"N" in case of thumbs-up or thumbs-down reaction.
Answering the prompt
You must reply directly to the message, rather than simply sending a message to the bot. Alternatively, you can use the thumbs-up or thumbs-down reaction.