Telegram Bot

Send messages, photos, and documents via a Telegram bot.

CommunicationAPI key7 actionsAll integrations

On this page
  1. Connect
  2. Call it from a workflow
  3. Actions (7)
  4. get_chat_member
  5. send_media
  6. send_text_message
  7. create_invite_link
  8. custom_api_call
  9. get_file
  10. request_approval_message
  11. Details

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.

Workflow
// 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);
});
Try it from your agent
{
  "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"
  }
}
From another backend (connector proxy)
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

InputTypeDescription
chat_idrequiredtextChat Id
user_idrequiredtextUnique identifier for the user

send_media

Send Media. Send a media message through a Telegram bot

InputTypeDescription
chat_idrequiredtextChat Id
message_thread_idoptionaltextUnique identifier for the target message thread of the forums; for forums supergroups only
media_typeoptionalone of "photo" | "video" | "sticker" | "animation"Media Type
mediaoptionalobject (depends on other props)Media Properties
formatoptionalone of "MarkdownV2" | "HTML"Choose format you want
messagerequiredlong textThe message to be sent
reply_markupoptionalJSONAdditional 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

InputTypeDescription
chat_idrequiredtextChat Id
message_thread_idoptionaltextUnique identifier for the target message thread of the forums; for forums supergroups only
formatoptionalone of "MarkdownV2" | "HTML"Choose format you want
web_page_previewoptionalbooleanDisable link previews for links in this message
messagerequiredlong textThe message to be sent
reply_markupoptionalJSONAdditional 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 an invite link for a chat

InputTypeDescription
chat_idrequiredtextChat Id
nameoptionaltextName of the invite link (max 32 chars)
expire_dateoptionaldate-time (ISO)Point in time when the link will expire
member_limitoptionalnumberMaximum 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

InputTypeDescription
urlrequiredobject (depends on other props)url
methodrequiredone of "GET" | "POST" | "PATCH" | "PUT" | "DELETE" | "HEAD"Method
headersrequiredobjectAuthorization headers are injected automatically from your connection.
queryParamsrequiredobjectQuery Parameters
body_typeoptionalone of "none" | "json" | "form_data" | "raw"Body Type
bodyoptionalobject (depends on other props)Body
response_is_binaryoptionalbooleanEnable for files like PDFs, images, etc.
failsafeoptionalbooleanNo Error on Failure
timeoutoptionalnumberTimeout (in seconds)
followRedirectsoptionalbooleanFollow redirects

get_file

Get File. Get file information and download a file from Telegram

InputTypeDescription
file_idrequiredtextFile identifier to get information about
downloadoptionalbooleanIf 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

InputTypeDescription
chat_idrequiredtextChat Id
messagerequiredlong textThe approval message to be sent
parse_modeoptionalone of "MarkdownV2" | "HTML" | "None"Choose format for the message
approve_button_textoptionaltextText for the approve button
disapprove_button_textoptionaltextText 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