Security News
cURL Project and Go Security Teams Reject CVSS as Broken
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
wa-chat-server-telegram
Advanced tools
wa-chat-server-telegram is a wa-chat-server adapter for the Telegram messenger.
/newbot
and answer the questions.An initialization of the wa-chat-server (in a chat application using wa-chat-server to communicate with Watson Assistant) with a wa-chat-server-telegram adapter looks like this:
require('dotenv').config();
import { WAChatServer, Types } from 'wa-chat-server';
import { WAChatServerTelegramAdapter } from 'wa-chat-server-telegram';
const server: WAChatServer = new WAChatServer((process.env as any) as Types.IWAChatServerConfig);
server.addAdapter('telegram', WAChatServerTelegramAdapter);
server.serve();
We must set the following environment variables (e. g. in .env
):
Variable | Obligatory | Meaning |
---|---|---|
adapter__telegram__token | Y | The Bot token generated by the BotFather |
adapter__telegram__apiUrl | Y | The Telegram endpoint, typically https://api.telegram.org) |
adapter__telegram__callbackUrl | Y | The endpoint to be called by Telegram (without the path adapters/telegram |
adapter__telegram__webhookLifetimeS | N | The Telegram webhook lifetime in seconds. Whenever the lifetime is reached a new webhook URL (containing a random token) is generated. 0 by default which means "generate URL only once at application startup" |
For local development we need to set up a secure tunnel localhost and Telegram. We can use ngrok for this purpose:
ngrok http 3023
opens a tunel and gives us a public HTTPS URL to be used by Telegram (without an ngrook account the lifetime of the tunnel will be 2 hours). We must then use the Telegram API to configure this URL in Telegram:
export ENDPOINT="[NGROK_URL]"; export TOKEN=[BOT_TOKEN]; curl -X POST -H "Content-Type:application/json" -d "{\"url\":\"$ENDPOINT/adapters/telegram\"}" "https://api.telegram.org/bot$TOKEN/setwebhook"
We may inspect the communication tunneled by ngrok to localhost on http://localhost:4040.
IMPORTANT: Don't do it for a Telegram bot that is already attached to some server installation. Create your own Telegram bot instead.
Run
npm run dev
Run
npm link
from the wa-chat-server-telegram root folder.
and then
npm link wa-chat-server-telegram
from the root of your chat application.
FAQs
wa-chat-server adapter for Telegram
The npm package wa-chat-server-telegram receives a total of 0 weekly downloads. As such, wa-chat-server-telegram popularity was classified as not popular.
We found that wa-chat-server-telegram demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
Security News
Biden's executive order pushes for AI-driven cybersecurity, software supply chain transparency, and stronger protections for federal and open source systems.