Telegram Bot
Send messages, photos, and documents via a Telegram bot.
On this page
Connect
Auth type: API key (secret_text). Pass the provider's API key or token as the connection's credential. It is sealed at rest and only opened on the server when an action runs.
- From your agent: integrations {action: "connect", piece, credentials, env} stores the credentials for dev, prod or all. Answers name the fields, never the values.
- Or set the integration's project secrets with the secrets tool (SLACK_BOT_TOKEN, DISCORD_WEBHOOK_URL, TELEGRAM_BOT_TOKEN, TWILIO_ACCOUNT_SID and TWILIO_AUTH_TOKEN …): a call uses the connection, else those secrets. integrations {action: "catalog", piece} lists which ones work.
- Try one action now with integrations {action: "call", piece, piece_action, input}. It really sends.
Call it from a workflow
step.ctx.integrations.invoke("telegram_bot", action, input) resolves with the provider's answer and rejects when Telegram Bot isn't connected or refuses. Wrap it in step.run so a retry sends once. See step.ctx. send_text_message runs in the platform itself; the other actions run through the integration runner, which the server's operator turns on.
// workflows/notify.ts: call Telegram Bot when a booking is confirmed
import { on } from "@appbricx/workflows";
export const tellTelegramBot = on.transition("booking", "status", "confirmed", async (_event, step) => {
// Recorded once: a retry doesn't send it twice. Rejects when Telegram Bot isn't connected.
const output = await step.run("Telegram Bot", () =>
step.ctx.integrations.invoke("telegram_bot", "get_chat_member", {
"chat_id": "<chat id>",
"user_id": "<user id>"
}),
);
step.ctx.log("Telegram Bot answered", output);
});{
"name": "integrations",
"arguments": {
"project_id": "<project-id>",
"action": "call",
"piece": "telegram_bot",
"piece_action": "get_chat_member",
"input": {
"chat_id": "<chat id>",
"user_id": "<user id>"
},
"env": "dev"
}
}curl -X POST "$APP_ORIGIN/__appbricx/connector-proxy/telegram_bot/get_chat_member" \
-H "Authorization: Bearer $APP_KEY" \
-H "content-type: application/json" \
-d '{"props":{"chat_id":"<chat id>","user_id":"<user id>"}}'Actions
get_chat_member
Get Chat Member. Get member info (or null) for provided chat id and user id
| Input | Type | Description |
|---|---|---|
chat_idrequired | text | Chat Id |
user_idrequired | text | Unique identifier for the user |
send_media
Send Media. Send a media message through a Telegram bot
| Input | Type | Description |
|---|---|---|
chat_idrequired | text | Chat Id |
message_thread_idoptional | text | Unique identifier for the target message thread of the forums; for forums supergroups only |
media_typeoptional | one of "photo" | "video" | "sticker" | "animation" | Media Type |
mediaoptional | object (depends on other props) | Media Properties |
formatoptional | one of "MarkdownV2" | "HTML" | Choose format you want |
messagerequired | long text | The message to be sent |
reply_markupoptional | JSON | Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. Use special actions such… |
send_text_messagebuilt in
Send Text Message. Send a message through a Telegram bot
| Input | Type | Description |
|---|---|---|
chat_idrequired | text | Chat Id |
message_thread_idoptional | text | Unique identifier for the target message thread of the forums; for forums supergroups only |
formatoptional | one of "MarkdownV2" | "HTML" | Choose format you want |
web_page_previewoptional | boolean | Disable link previews for links in this message |
messagerequired | long text | The message to be sent |
reply_markupoptional | JSON | Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. Use special actions such… |
create_invite_link
Create Invite Link. Create an invite link for a chat
| Input | Type | Description |
|---|---|---|
chat_idrequired | text | Chat Id |
nameoptional | text | Name of the invite link (max 32 chars) |
expire_dateoptional | date-time (ISO) | Point in time when the link will expire |
member_limitoptional | number | Maximum number of users that can be members of the chat simultaneously after joining the chat via this invite link; 1-99999 |
custom_api_call
Custom API Call. Make a custom API call to a specific endpoint
| Input | Type | Description |
|---|---|---|
urlrequired | object (depends on other props) | url |
methodrequired | one of "GET" | "POST" | "PATCH" | "PUT" | "DELETE" | "HEAD" | Method |
headersrequired | object | Authorization headers are injected automatically from your connection. |
queryParamsrequired | object | Query Parameters |
body_typeoptional | one of "none" | "json" | "form_data" | "raw" | Body Type |
bodyoptional | object (depends on other props) | Body |
response_is_binaryoptional | boolean | Enable for files like PDFs, images, etc. |
failsafeoptional | boolean | No Error on Failure |
timeoutoptional | number | Timeout (in seconds) |
followRedirectsoptional | boolean | Follow redirects |
get_file
Get File. Get file information and download a file from Telegram
| Input | Type | Description |
|---|---|---|
file_idrequired | text | File identifier to get information about |
downloadoptional | boolean | If enabled, the file will be downloaded and returned as base64 |
request_approval_message
Request Approval Message. Send an approval message to a chat and wait until the message is approved or disapproved
| Input | Type | Description |
|---|---|---|
chat_idrequired | text | Chat Id |
messagerequired | long text | The approval message to be sent |
parse_modeoptional | one of "MarkdownV2" | "HTML" | "None" | Choose format for the message |
approve_button_textoptional | text | Text for the approve button |
disapprove_button_textoptional | text | Text for the disapprove button |
Details
- Id
telegram_bot- Category
- Communication
- Tags
- chat, messaging, bot, telegram
- Package
@activepieces/piece-telegram-bot@0.5.6- Runs
- send_text_message in the platform; the rest through the integration runner