Our great sponsors
-
SurveyJS
Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App. With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.
-
nodejs.dev
Discontinued A redesign of Nodejs.org built using Gatsby.js with React.js, TypeScript, and Remark.
-
WorkOS
The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.
Secondly, Telegram is open source and can be rebuilt from the ground up using the source code (check out the React version). So if you have fun with our project, there's no limit to how far you can extend it in the ecosystem!
The node package we're working with, [node-telegram-bot-api](https://github.com/yagop/node-telegram-bot-api/blob/master/doc/tutorials.md), comes with great documentation. Let's start with one of the methods from the README. We'll tell our bot to send an introduction anytime a user runs /start.
Basic knowledge of NodeJS
Download Telegram desktop. Visit Botfather to immediately open a chat and begin creating your bot.
// helpers.js const fs = require('fs') const request = require('request') const sanityClient = require('@sanity/client') const client = sanityClient({ // ... }) const download = (url, path, callback) => { //the "request" library helps us make HTTP requests in node //though it is deprecated, it works for our purposes. //more here: https://www.npmjs.com/package/request request.head(url, (err, res, body) => { request(url) //using Node's .pipe() method, we connect the //readable stream to a writeable stream. .pipe(fs.createWriteStream(path)) .on('close', callback) }) } module.exports = { client, download }