Telegram
This package makes creating Telegram bots so simple!

Official Websitehttps://telegram.org/
Documentationhttps://grammy.dev/guide/
NodeJS packagehttps://www.npmjs.com/package/grammy
Version1.12.0
Source Codehttps://github.com/grammyjs/grammY
Tagsmessaging, bot
Credential configuration
To configure this credential you need the token from your Telegram Bot. You can create a bot or create a token for an existing bot using Telegram's BotFather.
Optionally you can set any of the extra config params you can see here.
Here you have an example of a filled credential configuration form in YepCode:

Telegram snippets available in editor
note
The title is the triggering text for YepCode to autocomplete the script
Integration
New integration from credential
const telegram = yepcode.integration.telegram('credential-slug');
New integration from plain authentication data
const { Bot } = require('grammy');
const telegram = new Bot("your-bot-token");
Set webhook
You may want to receive messages to your bot using a webhook to a YepCode process which handles them. You can do this using this snippet:
Set webhook
await telegram.api.setWebhook("webhook-url");
You can also set the webhook by doing a request to this url with your bot token and your webhook URL:
https://api.telegram.org/bot<your-bot-token>/setWebhook?url=https://cloud.yepcode.io/api/<your-team-name>/webhooks/<processId>
Set bot commands
Set bot commands
await telegram.api.setMyCommands([
{ command: "commandName", description: "Command description" },
{ command: "commandName", description: "Command description" },
]);
Send message
Send message
await telegram.api.sendMessage(chatId, "message-content");
Send HTML message
Send HTML message
await telegram.api.sendMessage(
chatId,
"<b>Hi</b> from <a href="https://yepcode.io">YepCode</a>!",
{ parse_mode: "HTML" }
);
Send Markdown message
Send Markdown message
await telegram.api.sendMessage(
chatId,
"*Hi* from [YepCode](https://yepcode.io)\\!",
{ parse_mode: "MarkdownV2" }
);