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. | 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
}
}
}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. | 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
}
}
}Triggers
New Message
Name: newMessage
Trigger on new incoming message of any kind — text, photo, sticker, and so on.
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"
}How is this guide?
Last updated on