Telegram
This package makes creating Telegram bots so simple!
- JavaScript
- Python
Comming soon
We are releasing new Python features every week
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 parameters you can see here.
Here is an example of a filled credential configuration form in YepCode:
Telegram Snippets available in Editor
The title is the triggering text for YepCode to autocomplete the script.
- JavaScript
- Python
Integration
const telegram = yepcode.integration.telegram('credential-slug');
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:
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
await telegram.api.setMyCommands([
{ command: "commandName", description: "Command description" },
{ command: "commandName", description: "Command description" },
]);
Send Message
await telegram.api.sendMessage(chatId, "message-content");
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
await telegram.api.sendMessage(
chatId,
"*Hi* from [YepCode](https://yepcode.io)\\!",
{ parse_mode: "MarkdownV2" }
);
Comming soon
We are releasing new Python features every week