Telegram
Telegram is a cloud-based messaging platform that enables users to send messages, media, and files, and supports automation and integrations through its API.
Categories: Communication
Type: telegram/v1
Connections
Version: 1
custom
Properties
| Name | Label | Type | Description | Required |
|---|---|---|---|---|
| botToken | Bot Token | STRING | true |
Connection Setup
Create a Telegram Bot and get the Bot Token
- In Telegram, start a chat with
BotFather. - Send the
/newbotcommand and follow the prompts:- Choose a display name (can be changed later).
- Choose a unique username that ends with
bot(e.g.,my_bytechef_bot).
- Copy the Bot Token provided by BotFather (format:
1234567890:AA...). Keep it secret.
Helpful links:
- Telegram Bot API: https://core.telegram.org/bots/api
Actions
Send Media
Name: sendMedia
Sends a media message through a Telegram bot.
Properties
| Name | Label | Type | Description | Required |
|---|---|---|---|---|
| chat_id | Chat ID | STRING | Unique identifier for the target chat or username of the target channel. Your bot has to be member of that chat or group. | true |
| mediaType | null | STRING Optionsdocument, photo, video | Type of media to send. | true |
| document | Document | FILE_ENTRY | Document to send. | true |
| photo | Photo | FILE_ENTRY | Photo to send. | true |
| video | Video | FILE_ENTRY | Video to send. | true |
| direct_messages_topic_id | Direct Messages Topic ID | STRING | Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat. | false |
Example JSON Structure
{
"label" : "Send Media",
"name" : "sendMedia",
"parameters" : {
"chat_id" : "",
"mediaType" : "",
"document" : {
"extension" : "",
"mimeType" : "",
"name" : "",
"url" : ""
},
"photo" : {
"extension" : "",
"mimeType" : "",
"name" : "",
"url" : ""
},
"video" : {
"extension" : "",
"mimeType" : "",
"name" : "",
"url" : ""
},
"direct_messages_topic_id" : ""
},
"type" : "telegram/v1/sendMedia"
}Output
Type: OBJECT
Properties
| Name | Type | Description |
|---|---|---|
| ok | BOOLEAN Optionstrue, false | |
| result | OBJECT Properties{INTEGER(message_id), INTEGER(message_thread_id), {INTEGER(topic_id), {INTEGER(id), BOOLEAN(is_bot), STRING(first_name), STRING(last_name), STRING(username)}(user)}(direct_messages_topic), {INTEGER(id), BOOLEAN(is_bot), STRING(first_name), STRING(last_name), STRING(username)}(from), {INTEGER(id), STRING(title), STRING(username), STRING(type), BOOLEAN(is_direct_messages)}(sender_chat), INTEGER(date), {INTEGER(id), STRING(title), STRING(username), STRING(type), BOOLEAN(is_direct_messages)}(chat), STRING(text), {INTEGER(topic_id), {INTEGER(id), BOOLEAN(is_bot), STRING(first_name), STRING(last_name), STRING(username)}(user)}(direct_messages_topic), {STRING(file_id), STRING(file_unique_id), {STRING(file_id), STRING(file_unique_id), INTEGER(width), INTEGER(height), INTEGER(file_size)}(thumbnail), STRING(file_name), STRING(mime_type), INTEGER(file_size)}(document), [{STRING(file_id), STRING(file_unique_id), INTEGER(width), INTEGER(height), INTEGER(file_size)}](photo), {STRING(file_id), STRING(file_unique_id), STRING(width), STRING(height), INTEGER(duration), STRING(file_name), STRING(mime_type), INTEGER(file_size)}(video)} |
Output Example
{
"ok" : false,
"result" : {
"message_id" : 1,
"message_thread_id" : 1,
"direct_messages_topic" : {
"topic_id" : 1,
"user" : {
"id" : 1,
"is_bot" : false,
"first_name" : "",
"last_name" : "",
"username" : ""
}
},
"from" : {
"id" : 1,
"is_bot" : false,
"first_name" : "",
"last_name" : "",
"username" : ""
},
"sender_chat" : {
"id" : 1,
"title" : "",
"username" : "",
"type" : "",
"is_direct_messages" : false
},
"date" : 1,
"chat" : {
"id" : 1,
"title" : "",
"username" : "",
"type" : "",
"is_direct_messages" : false
},
"text" : "",
"document" : {
"file_id" : "",
"file_unique_id" : "",
"thumbnail" : {
"file_id" : "",
"file_unique_id" : "",
"width" : 1,
"height" : 1,
"file_size" : 1
},
"file_name" : "",
"mime_type" : "",
"file_size" : 1
},
"photo" : [ {
"file_id" : "",
"file_unique_id" : "",
"width" : 1,
"height" : 1,
"file_size" : 1
} ],
"video" : {
"file_id" : "",
"file_unique_id" : "",
"width" : "",
"height" : "",
"duration" : 1,
"file_name" : "",
"mime_type" : "",
"file_size" : 1
}
}
}Find Chat or Group ID
To find the Chat or Group ID, click here.
Find Direct Message Topic ID
To find the Direct Message Topic ID, click here.
Send Message
Name: sendMessage
Sends a message through a Telegram bot.
Properties
| Name | Label | Type | Description | Required |
|---|---|---|---|---|
| chat_id | Chat ID | STRING | Unique identifier for the target chat or username of the target channel. Your bot has to be member of that chat or group. | true |
| text | Text | STRING | Text of the message to be sent. | true |
| direct_messages_topic_id | Direct Messages Topic ID | STRING | Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat. | false |
Example JSON Structure
{
"label" : "Send Message",
"name" : "sendMessage",
"parameters" : {
"chat_id" : "",
"text" : "",
"direct_messages_topic_id" : ""
},
"type" : "telegram/v1/sendMessage"
}Output
Type: OBJECT
Properties
| Name | Type | Description |
|---|---|---|
| ok | BOOLEAN Optionstrue, false | |
| result | OBJECT Properties{INTEGER(message_id), INTEGER(message_thread_id), {INTEGER(topic_id), {INTEGER(id), BOOLEAN(is_bot), STRING(first_name), STRING(last_name), STRING(username)}(user)}(direct_messages_topic), {INTEGER(id), BOOLEAN(is_bot), STRING(first_name), STRING(last_name), STRING(username)}(from), {INTEGER(id), STRING(title), STRING(username), STRING(type), BOOLEAN(is_direct_messages)}(sender_chat), INTEGER(date), {INTEGER(id), STRING(title), STRING(username), STRING(type), BOOLEAN(is_direct_messages)}(chat), STRING(text), {INTEGER(topic_id), {INTEGER(id), BOOLEAN(is_bot), STRING(first_name), STRING(last_name), STRING(username)}(user)}(direct_messages_topic), {STRING(file_id), STRING(file_unique_id), {STRING(file_id), STRING(file_unique_id), INTEGER(width), INTEGER(height), INTEGER(file_size)}(thumbnail), STRING(file_name), STRING(mime_type), INTEGER(file_size)}(document), [{STRING(file_id), STRING(file_unique_id), INTEGER(width), INTEGER(height), INTEGER(file_size)}](photo), {STRING(file_id), STRING(file_unique_id), STRING(width), STRING(height), INTEGER(duration), STRING(file_name), STRING(mime_type), INTEGER(file_size)}(video)} |
Output Example
{
"ok" : false,
"result" : {
"message_id" : 1,
"message_thread_id" : 1,
"direct_messages_topic" : {
"topic_id" : 1,
"user" : {
"id" : 1,
"is_bot" : false,
"first_name" : "",
"last_name" : "",
"username" : ""
}
},
"from" : {
"id" : 1,
"is_bot" : false,
"first_name" : "",
"last_name" : "",
"username" : ""
},
"sender_chat" : {
"id" : 1,
"title" : "",
"username" : "",
"type" : "",
"is_direct_messages" : false
},
"date" : 1,
"chat" : {
"id" : 1,
"title" : "",
"username" : "",
"type" : "",
"is_direct_messages" : false
},
"text" : "",
"document" : {
"file_id" : "",
"file_unique_id" : "",
"thumbnail" : {
"file_id" : "",
"file_unique_id" : "",
"width" : 1,
"height" : 1,
"file_size" : 1
},
"file_name" : "",
"mime_type" : "",
"file_size" : 1
},
"photo" : [ {
"file_id" : "",
"file_unique_id" : "",
"width" : 1,
"height" : 1,
"file_size" : 1
} ],
"video" : {
"file_id" : "",
"file_unique_id" : "",
"width" : "",
"height" : "",
"duration" : 1,
"file_name" : "",
"mime_type" : "",
"file_size" : 1
}
}
}Find Chat or Group ID
To find the Chat or Group ID, click here.
Find Direct Message Topic ID
To find the Direct Message Topic ID, click here.
Triggers
New Message
Name: newMessage
Trigger on new incoming message of any kind — text, photo, sticker, and so on. Incoming message has to be in a group that your bot is member of.
Type: DYNAMIC_WEBHOOK
Output
Type: OBJECT
Properties
| Name | Type | Description |
|---|---|---|
| update_id | INTEGER | |
| message | OBJECT Properties{INTEGER(message_id), INTEGER(message_thread_id), {INTEGER(topic_id), {INTEGER(id), BOOLEAN(is_bot), STRING(first_name), STRING(last_name), STRING(username)}(user)}(direct_messages_topic), {INTEGER(id), BOOLEAN(is_bot), STRING(first_name), STRING(last_name), STRING(username)}(from), {INTEGER(id), STRING(title), STRING(username), STRING(type), BOOLEAN(is_direct_messages)}(sender_chat), INTEGER(date), {INTEGER(id), STRING(title), STRING(username), STRING(type), BOOLEAN(is_direct_messages)}(chat), STRING(text), {INTEGER(topic_id), {INTEGER(id), BOOLEAN(is_bot), STRING(first_name), STRING(last_name), STRING(username)}(user)}(direct_messages_topic), {STRING(file_id), STRING(file_unique_id), {STRING(file_id), STRING(file_unique_id), INTEGER(width), INTEGER(height), INTEGER(file_size)}(thumbnail), STRING(file_name), STRING(mime_type), INTEGER(file_size)}(document), [{STRING(file_id), STRING(file_unique_id), INTEGER(width), INTEGER(height), INTEGER(file_size)}](photo), {STRING(file_id), STRING(file_unique_id), STRING(width), STRING(height), INTEGER(duration), STRING(file_name), STRING(mime_type), INTEGER(file_size)}(video)} |
JSON Example
{
"label" : "New Message",
"name" : "newMessage",
"type" : "telegram/v1/newMessage"
}Find Chat or Group ID
To find the Chat or Group ID, click here.
What to do if your action is not listed here?
If this component doesn't have the action you need, you can use Custom Action to create your own. Custom Actions empower you to define HTTP requests tailored to your specific requirements, allowing for greater flexibility in integrating with external services or APIs.
To create a Custom Action, simply specify the desired HTTP method, path, and any necessary parameters. This way, you can extend the functionality of your component beyond the predefined actions, ensuring that you can meet all your integration needs effectively.
Additional Instructions
How to find Chat or Group ID
- Method 1: Telegram Web URL
- Login to Telegram Web.
- Open chat or group you want to find ID of.
- URL will be in the format:
https://web.telegram.org/k/#-5291165340 - Extract the number after
#-to get the Chat ID or Group ID.
- Method 2: Using ByteChef Telegram Trigger Output
- Create a ByteChef workflow that includes a Telegram trigger.
- Run the workflow and observe the output from the Telegram trigger.
- Look for the
idin thechatobject in the JSON response to get the Chat ID or Group ID.
How to find Direct Message Topic ID
- Create a ByteChef workflow that includes a Telegram trigger.
- Run the workflow and observe the output from the Telegram trigger.
- Look for the
topic_idin thedirect_messages_topicobject in the JSON response to get the Chat ID or Group ID.
How is this guide?
Last updated on